// name属性为tname,id为idname,要显示的层为cname,选中的样式为class1,没有选中的为class2,标签类型tagtype
function chgbgp(tname,idname,cname,class1,class2,tagtype)
	{
	    var obj = document.getElementsByTagName(tagtype);        
        var count=0;
        var elts=[];
        for (var i=0; i<obj.length;i++)
        {
            if(obj[i].getAttribute("name")==tname)
            {
                elts[count++]=obj[i];
            }
        }
        for(var j=0;j<count;j++)
		{
			if(elts[j].id== idname)
			{
				elts[j].className = class1;
				document.getElementById(cname + j).style.display = 'block';
			}
			else
			{
				elts[j].className = class2;
				document.getElementById(cname + j).style.display = 'none';
			}
		}
	}
	function chgfont(id)
	{
	    if (id==0)
	    {
	        document.getElementById("inxw0").className="spantag3";
	        document.getElementById("inxw1").className="spantag4";
	    }
	    else
	    {
	    	document.getElementById("inxw0").className="spantag4";
	    	document.getElementById("inxw1").className="spantag3";	        
	     }
	}
function searchtag(tname,idname,cname,class1,class2,tagtype,tag_a)
	{
	    var obj = document.getElementsByTagName(tagtype);
        var count=0;
        var elts=[];
        
        for (var i=0; i<obj.length;i++)
        {
            if(obj[i].getAttribute("name")==tname)
            {
                elts[count++]=obj[i];
            }
        }
        for(var j=0;j<count;j++)
		{
			if(elts[j].id== idname)
			{
				elts[j].style.backgroundImage="url(images/bg_03.gif)";
				document.getElementById(tag_a + j).className=class1;
				document.getElementById(cname + j).style.display = 'block';
			}
			else
			{
				elts[j].style.backgroundImage="url(images/bg_05.gif)";
				document.getElementById(tag_a + j).className=class2;
				document.getElementById(cname + j).style.display = 'none';
			}
		}
	}	
	
function OpenDiv(ShadeD,PopD){
		var ShadeDiv = document.getElementById(ShadeD);
		var PopDiv = document.getElementById(PopD);

		ShadeDiv.style.display = 'block';
		ShadeDiv.style.height = document.documentElement.scrollHeight + 'px';
		ShadeDiv.style.width = document.body.scrollWidth+'px';

		PopDiv.style.display = 'block';
		PopDiv.style.top = document.documentElement.scrollTop + (document.documentElement.clientHeight-PopDiv.clientHeight)/2 + "px";
		PopDiv.style.left = document.documentElement.scrollLeft +(document.documentElement.clientWidth-PopDiv.clientWidth)/2+"px";
}
function CloseDiv(ShadeDiv,PopDiv){
	document.getElementById(ShadeDiv).style.display = 'none';
	document.getElementById(PopDiv).style.display = 'none';
}

function CusInfoSubmit()
	{
		var d=document.forms["CusFrm"];
		if(d.fName.value=="")
		{
			alert('姓不能为空!');
			d.fName.focus();
			return false;
		}
		if(d.tel.value=="" && d.Email.value=="")
		{
			alert('电话或邮箱请至少填写一项!');
			d.fName.focus();
			return false;
		}
		if(d.tel.value != "")
		{
			if(isNaN(d.tel.value))
			{
			alert('请填写正确格式的电话号码!');
			d.tel.focus();
			return false;					
			}
		}
		d.submit();
	}	

function SouSuo1(changid,showdivid,ExportType,startport,endport)
{
	var tagid,url;
	
	if(changid==1)
	{
		tagid="addpd";
		url="ResultSearch.aspx"
	}
	if(changid==2)
	{
		tagid="addCusinfo";
		url="InfoSearch.aspx"
	}
    url=url+"?showdiv=" + showdivid + "&ExportType="+ExportType+"&sPort="+escape(startport)+"&ePort="+escape(endport)+"&rand=" + Math.random();
	document.getElementById(tagid).src = url;
}

function SouSuo2(changid,showdivid,importtype,portsid)
{
	var tagid;
	if(changid==1)
	{
		tagid="addpd";
		url="ResultSearch.aspx"		
	}
	if(changid==2)
	{
		tagid="addCusinfo";
		url="InfoSearch.aspx"
	}
    url=url+"?showdiv=" + showdivid + "&importtype="+ importtype+"&portsid="+portsid+"&rand=" + Math.random();
	document.getElementById(tagid).src = url;
}
function SouSuo3(changid,showdivid,catagoryid)
{
	var tagid;
	
	if(changid==1)
	{
		tagid="addpd";
		url="ResultSearch.aspx"		
	}
	if(changid==2)
	{
		tagid="addCusinfo";
		url="InfoSearch.aspx"
	}
	
	tagid="addpd";
	url="ResultSearch.aspx"	
    url=url+"?showdiv=" + showdivid + "&showdivCus=3&catagoryid="+ catagoryid+"&rand=" + Math.random();
	document.getElementById(tagid).src = url;
}



function ListSearchKey(wd,showtagid,tagname,frameID)
{
	if(wd!="")
	{
		document.getElementById(frameID).src="getsearchkey.aspx?wd=" + wd +"&showtagid=" +showtagid+"&tagname="+tagname;
	}
}
function SetKeyWord(rsValue,textValue,SearchKeyList)
{
	parent.document.getElementById(textValue).value = rsValue;
	parent.document.getElementById(SearchKeyList).style.display="none";
}


function SelectIt(id)
{
	document.getElementById(id).className = "over";	
}

function MoveIt(id)
{
  document.getElementById(id).className = "";
}
function loginout(str)
{
var d=document.forms["cuslogin"];
    d.cuslog.value = str
  d.submit();
}
