//交易平台的div
function jiaoyipt(divName,over,counts){

		for(var i=0;i<=parseInt(counts);i++){
			document.getElementById(divName+'_'+i).style.display = "none";
		}
		document.getElementById(divName+'_'+over).style.display = "block";
		//document.getElementById(test).style.cssText = "FONT-SIZE: 14px; FLOAT: left; font-weight:bold; COLOR: #000000; ";
	}
//导航菜单背景更换

function daohang()
{
	var color=document.getElementById("color").value;
	if(color=="index")
	{
		document.getElementById("index").id="red";
	}
	if(color=="jiaoyipt" || color=="jiaoyi_liebiao" || color=="jiaoyi_xiangxi")
	{
		document.getElementById("jiaoyi").id="red";
	}
	if(color=="baojia" || color=="search")
	{
		document.getElementById("baojia").id="red";
	}
	if(color=="zixun" || color=="zixun_list" || color=="zixun_xiangxi" || color=="jiage_list" || color=="jiage_xiangxi" || color=="caigou_list" || color=="caigou_xiangxi" || color=="zhishu")
	{
		document.getElementById("zixun").id="red";
		}
	if(color=="rongzi")
	{
		document.getElementById("rongzi").id="red";
		}
	if(color=="wuliu" || color=="wuliu_xiangxi")
	{
		document.getElementById("wuliu").id="red";
		}
	if(color=="navigation")
	{
		document.getElementById("navigation").id="red";
		}
	if(color=="kehuzhongxin" || color=="join"  || color=="register" || color=="huiyuan" || color=="denglu")
	{
		document.getElementById("kehuzhongxin").id="red";
		}
}

//返回顶部
function pageScroll() {  
 window.scrollBy(0,-10);  
 scrolldelay = setTimeout('pageScroll()',100);  
  if(document.documentElement.scrollTop==0) clearTimeout(scrolldelay); 
}  

function GetXmlHttpObject()
{
	var xmlHttp;
	try
 	{
 // Firefox, Opera 8.0+, Safari
 	xmlHttp=new XMLHttpRequest();
 	}
	catch (e)
 	{
 // Internet Explorer
	 	try
	  	{
	  		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  	}
	 	catch (e)
	  	{
	  		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  	}
 	}
	return xmlHttp;
}
//验证注册的用户名
function user_zhuce(obj)
{

	xmlHttp=GetXmlHttpObject();
    var url1="ajax.php";
    url=url1+"?action=delMsg&user_id="+obj;
    xmlHttp.open("get",url,true);
    xmlHttp.onreadystatechange=function()
    {
    	
    	if (xmlHttp.readyState==4)
		{
			//alert(123);
			if(xmlHttp.responseText==2)
			{
				document.getElementById('user_name').innerHTML="<font color='red'>用户名已存在</font>";
			}
				else
			{
				document.getElementById('user_name').innerHTML="<font color='green'>用户名可以使用</font>";
			} 
		}
    }
    xmlHttp.send(null);
}
//验证注册的公司名称
function user_company(obj)
{

	xmlHttp=GetXmlHttpObject();


	xmlHttp.open("post","ajax.php",true);
	xmlHttp.setRequestHeader("cache-control","no-cache");  //此行和下一行是解决中文参数问题
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.onreadystatechange=function()
    {
    	//alert(xmlHttp.responseText);
    	if (xmlHttp.readyState==4)
		{
			if(xmlHttp.responseText==2)
			{
				
				document.getElementById('company_zhuce').innerHTML="<font color='red'>对不起，该公司名称已注册</font>";
			}
				else
			{
				document.getElementById('company_zhuce').innerHTML="<font color='green'>可用</font>";
			} 
		}
    }
    xmlHttp.send("action=company_del&company_name="+obj);
}

//检测公司的名称
function company_jiance()
{
	var obj=document.getElementById("company_name").value;
	xmlHttp=GetXmlHttpObject();


	xmlHttp.open("post","ajax.php",true);
	xmlHttp.setRequestHeader("cache-control","no-cache");  //此行和下一行是解决中文参数问题
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttp.onreadystatechange=function()
    {
    
    	if (xmlHttp.readyState==4)
		{
			if(xmlHttp.responseText=="")
			{
				
				document.getElementById('jiance_name').innerHTML="<font color='red'>没有检测到相关的公司名称</font>";
			}
				else
			{
				document.getElementById('jiance_name').innerHTML="<font color='green'>"+xmlHttp.responseText+"<br></font><font color='red'>如果贵公司已被注册或忘记密码请联系金久和客户服务中心  电话:028-84209766</font>";
			} 
		}
    }
    xmlHttp.send("action=company_jiance&company_name="+obj);
}
//验证注册的验证码
function yanzheng(obj)
{

	xmlHttp=GetXmlHttpObject();
    var url1="ajax.php";
    url=url1+"?action=yanzheng&captcha="+obj;
    xmlHttp.open("get",url,true);
    xmlHttp.onreadystatechange=function()
    {
    	
    	if (xmlHttp.readyState==4)
		{
			if(xmlHttp.responseText==2)
			{
				document.getElementById('yan').innerHTML="<font color='red'>验证码填写错误</font>";
				document.getElementById('yantrue').value=3;
			}
				else
			{
					document.getElementById('yantrue').value=2;
					document.getElementById('yan').innerHTML="<font color='green'>验证码填写正确</font>";
			} 
		}
    }
    xmlHttp.send(null);
}
//首页滚动
function Marquee_qiugou() { 
this.ID = document.getElementById(arguments[0]); 
this.Direction = arguments[1]; 
this.Step = arguments[2]; 
this.Width = arguments[3]; 
this.Height = arguments[4]; 
this.Timer = arguments[5]; 
this.WaitTime = arguments[6]; 
this.StopTime = arguments[7]; 
if (arguments[8]) { this.ScrollStep = arguments[8]; } else { this.ScrollStep = this.Direction > 1 ? this.Width : this.Height; } 
this.CTL = this.StartID = this.Stop = this.MouseOver = 0; 
this.ID.style.overflowX = this.ID.style.overflowY = "hidden"; 
this.ID.noWrap = true; 
this.ID.style.width = this.Width; 
this.ID.style.height = this.Height; 
this.ClientScroll = this.Direction > 1 ? this.ID.scrollWidth : this.ID.scrollHeight; 
this.ID.innerHTML += this.ID.innerHTML; 
this.Start(this, this.Timer, this.WaitTime, this.StopTime); 
} 
Marquee_qiugou.prototype.Start = function(msobj, timer, waittime, stoptime) { 
msobj.StartID = function() { msobj.Scroll(); } 
msobj.Continue = function() { 
if (msobj.MouseOver == 1) { setTimeout(msobj.Continue, waittime); } 
else { clearInterval(msobj.TimerID); msobj.CTL = msobj.Stop = 0; msobj.TimerID = setInterval(msobj.StartID, timer); } 
} 
msobj.Pause = function() { msobj.Stop = 1; clearInterval(msobj.TimerID); setTimeout(msobj.Continue, waittime); } 
msobj.Begin = function() { 
msobj.TimerID = setInterval(msobj.StartID, timer); 
msobj.ID.onmouseover = function() { msobj.MouseOver = 1; clearInterval(msobj.TimerID); } 
msobj.ID.onmouseout = function() { msobj.MouseOver = 0; if (msobj.Stop == 0) { clearInterval(msobj.TimerID); msobj.TimerID = setInterval(msobj.StartID, timer); } } 
} 
setTimeout(msobj.Begin, stoptime); 
} 
Marquee_qiugou.prototype.Scroll = function() { 
switch (this.Direction) { 
case 0: 
this.CTL += this.Step; 
if (this.CTL >= this.ScrollStep && this.WaitTime > 0) { this.ID.scrollTop += this.ScrollStep + this.Step - this.CTL; this.Pause(); return; } 
else { if (this.ID.scrollTop >= this.ClientScroll) this.ID.scrollTop -= this.ClientScroll; this.ID.scrollTop += this.Step; } 
break; 
case 1: 
this.CTL += this.Step; 
if (this.CTL >= this.ScrollStep && this.WaitTime > 0) { this.ID.scrollTop -= this.ScrollStep + this.Step - this.CTL; this.Pause(); return; } 
else { if (this.ID.scrollTop <= 0) this.ID.scrollTop += this.ClientScroll; this.ID.scrollTop -= this.Step; } 
break; 
case 2: 
this.CTL += this.Step; 
if (this.CTL >= this.ScrollStep && this.WaitTime > 0) { this.ID.scrollLeft += this.ScrollStep + this.Step - this.CTL; this.Pause(); return; } 
else { if (this.ID.scrollLeft >= this.ClientScroll) this.ID.scrollLeft -= this.ClientScroll; this.ID.scrollLeft += this.Step; } 
break; 
case 3: 
this.CTL += this.Step; 
if (this.CTL >= this.ScrollStep && this.WaitTime > 0) { this.ID.scrollLeft -= this.ScrollStep + this.Step - this.CTL; this.Pause(); return; } 
else { if (this.ID.scrollLeft <= 0) this.ID.scrollLeft += this.ClientScroll; this.ID.scrollLeft -= this.Step; } 
break; 
} 
} 
