function RemoveHTML( strText ) 
{ 
    var regEx = /<[^>]*>/g; 
    return strText.replace(regEx, ""); 
} 

function RemoveA ( strText )
{
    var regEx = /<a[^>]*>[^>]*<[^>]a>/g; 
    return strText.replace(regEx, ""); 
}

function RemoveAH ( strText )
{
    var regEx = /(<a[^>]*>)|(<[^>]a>)/g; 
    return strText.replace(regEx, ""); 
}

/*  
*     ForDight(Dight,How):数值格式化函数，Dight要  
*     格式化的   数字，How要保留的小数位数。  
*/  
function   ForDight(Dight,How)  
{  
           Dight   =   Math.round   (Dight*Math.pow(10,How))/Math.pow(10,How);  
           return   Dight;  
}  


// 说明：用 JavaScript 实现网页图片等比例缩放 
var imgeHeight,imgeWidth
function DrawImage(ImgD,FitWidth,FitHeight) 
{ 
	var image=new Image(); 
	image.src=ImgD.src; 
	if(image.width>0 && image.height>0) 
	{ 
		if(image.width/image.height>= FitWidth/FitHeight) 
		{ 
			if(image.width>FitWidth) 
			{ 
				ImgD.width=imgeWidth=FitWidth; 
				ImgD.height=imgeHeight=(image.height*FitWidth)/image.width; 
			} 
			else 
			{ 
				ImgD.width=imgeWidth=image.width; 
				ImgD.height=imgeHeight=image.height; 
				//ImgD.width=FitWidth
				//ImgD.height=(image.width*FitHeight)/image.height;
			} 
		} 
		else 
		{ 
			if(image.height>FitHeight) 
			{ 
				ImgD.height=imgeHeight=FitHeight; 
				ImgD.width=imgeWidth=(image.width*FitHeight)/image.height; 
			} 
			else 
			{ 
				ImgD.width=imgeWidth=image.width; 
				ImgD.height=imgeHeight=image.height; 
				//ImgD.height=FitHeight; 
				//ImgD.width=(image.height*FitWidth)/image.width; 
			} 
		} 
	} 

	ImgD.style.display="";
} 


function DrawImage2(ImgD2,FitWidth,FitHeight){ 
	var image2=new Image(); 
	image2.src=ImgD2.src; 
	var wb=ForDight(image2.width/image2.height,0);
	ImgD2.width=wb*FitHeight+(wb-1)*4;
	ImgD2.height=FitHeight;
	//ImgD.style.marginLeft="0px";
	}



function DrawDiv(ImgD3){
	var ImgParent=ImgD3.parentNode.parentNode.parentNode;
	var ImgParent2=ImgD3.parentNode.parentNode
		if (ImgD3.width>194)
		{
		ImgParent.style.width=ImgParent2.style.width=ImgD3.width+"px";
		}

		ImgParent.style.textAlign="center";

}
function $(id){return document.getElementById(id);}
function mouseover(id){
a=$("BizPanel");
b=$("ProductPanel");
if (id=="ProductPanel")
{
a.style.display="none";
b.style.display="block";
}
if (id=="BizPanel")
{
b.style.display="none";
a.style.display="block";
}
}

function show(obj){//
	for (var i=0;i<obj.childNodes.length ;i++ )
	{	
		if (obj.childNodes[i].nodeName=="SPAN")
		{
			obj.childNodes[i].style.display="none";
		}else
		if (obj.childNodes[i].nodeName=="DIV")
		{
			obj.childNodes[i].style.display="block";
		}
	}

}

function hidden(obj){
	for (var i=0;i<obj.childNodes.length ;i++ )
	{	
		if (obj.childNodes[i].nodeName=="SPAN")
		{
			obj.childNodes[i].style.display="block";
		}else
		if (obj.childNodes[i].nodeName=="DIV")
		{
			obj.childNodes[i].style.display="none";
		}
	}

}

function FloorMenuOver(obj){//首页楼层函数
obj.style.backgroundPosition='100% -19px';
$("FloorInfo").innerHTML=obj.attributes['FloorInfo'].nodeValue ;
}
function FloorMenuOut(obj){
obj.style.backgroundPosition='100% 0px';

}


function AddFavorite(sURL, sTitle)
{
    try
    {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e)
        {
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}
function SetHome(obj,vrl){
        try{
                obj.style.behavior="url(#default#homepage)";
				obj.setHomePage(vrl);
        }
        catch(e){
                if(window.netscape) {
                        try {
                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
                        } 
                        catch (e)  {
                                alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为’true’"); 
                        }
                        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
                        prefs.setCharPref('browser.startup.homepage',vrl);
                 }
        }
}


/*
    函数名称: Scroll
    Scroll(obj, h, s)
    参数说明:
        obj,[object]  id值或对象.     必需
          h,[height]  展开后的高度.   可选(默认为200px)
          s,[speed]   展开速度,值越小展开速度越慢. 可选(默认为1.2){建议取值为1.1到2.0之间[例如:1.17]}.
    函数返回值:
        true    展开(对象的高度等于展开后的高度)
        false   关闭(对象的高度等于原始高度)
*/
function Scroll(obj, h, s){
    var h = h || 200;
    var s = s || 1.2;
    var obj = typeof(obj)=="string"?document.getElementById(obj):obj;
    if(obj == undefined){return false;}
    var status = obj.getAttribute("status")==null;
    var oh = parseInt(obj.offsetHeight);
    obj.style.height = oh;
    obj.style.display = "block";
	obj.style.overflow = "hidden";
    if(obj.getAttribute("oldHeight") == null){
        obj.setAttribute("oldHeight", oh);
    }else{
        var oldH = Math.ceil(obj.getAttribute("oldHeight"));
    }
    var reSet = function(){
        if(status){
            if(oh < h){
                oh = Math.ceil(h-(h-oh)/s);
                obj.style.height = oh+"px";
            }else{
                obj.setAttribute("status",false);
                window.clearInterval(IntervalId);
            }
        }else{
            obj.style.height = oldH+"px";
            obj.removeAttribute("status");
            window.clearInterval(IntervalId);
        }
    }
    var IntervalId = window.setInterval(reSet,10);
	return status;
}

function ok_submit(){
	document.searchform.action=document.searchform.searchtype.value;
	document.searchform.submit();

}

function showMenu (baseID, divID) {
    baseID = $(baseID);
    divID  = $(divID);
    if (showMenu.timer) clearTimeout(showMenu.timer);
	hideCur();
    divID.style.display = 'block';
	showMenu.cur = divID;

    if (! divID.isCreate) {
        divID.isCreate = true;
        //divID.timer = 0;
        divID.onmouseover = function () {
            if (showMenu.timer) clearTimeout(showMenu.timer);
			hideCur();
            divID.style.display = 'block';
        };

        function hide () {
            showMenu.timer = setTimeout(function () {divID.style.display = 'none';}, 1000);
        }

        divID.onmouseout = hide;
        baseID.onmouseout = hide;
    }
	function hideCur () {
		showMenu.cur && (showMenu.cur.style.display = 'none');
	}
}

function IMGPostion(ImgD,FitWidth,FitHeight) 
{ 	//alert(imgeHeight)
	var image=new Image(); 
	image.src=ImgD.src; 
	ImgD.style.marginTop=(FitHeight-imgeHeight)/2+"PX";
	//ImgD.style.marginLeft=(FitWidth-imgeWidth)/5+"PX";

}

function MArray(len){ 
this.length = len; 
for(i=1;i<=len;i++) this[i] = 0; 
return this; 
} 

function addLoadEvent(func){ 
var oldonload=window.onload; 
if(typeof window.onload!='function'){ 
window.onload=func; 
}else{ 
window.onload=function(){ 
oldonload(); 
func(); 
} 
} 
} 


// Trim() , Ltrim() , RTrim()
String.prototype.Trim = function() 
{ 
return this.replace(/(^\s*)|(\s*$)/g, ""); 
} 
String.prototype.LTrim = function() 
{ 
return this.replace(/(^\s*)/g, ""); 
} 
String.prototype.RTrim = function() 
{ 
return this.replace(/(\s*$)/g, ""); 
} 