

function Client_index(method,url) {
	var ajax = new HttpRequest(method,url);
	var request;
	function post(callback,param) {
		request = ajax.init();
		ajax.post(request,callback,param);
	}


	/**
	 * 首页搜索层的显示
	 *
	 * @author andy
	 */
    this.show_search_div = show_search_div;
	function show_search_div(id) {
		var div_tradeleads = document.getElementById("div_tradeleads_show");
		var div_company = document.getElementById("div_company_show");
		var div_partner = document.getElementById("div_partner_show");
		var div_expo = document.getElementById("div_expo_show");

		var span_tradeleads_selected = document.getElementById("span_tradeleads_selected");
		var span_tradeleads_unselected = document.getElementById("span_tradeleads_unselected");
		var span_tradeleads_unselected1 = document.getElementById("span_tradeleads_unselected1");
		var span_company_selected = document.getElementById("span_company_selected");
		var span_company_unselected = document.getElementById("span_company_unselected");
		var span_company_unselected1 = document.getElementById("span_company_unselected1");
		var span_partner_selected = document.getElementById("span_partner_selected");
		var span_partner_unselected = document.getElementById("span_partner_unselected");
		var span_partner_unselected1 = document.getElementById("span_partner_unselected1");
		var span_expo_selected = document.getElementById("span_expo_selected");
		var span_expo_unselected = document.getElementById("span_expo_unselected");

		var form_search = document.getElementById("form_search");
		var hidden_action = document.getElementById("hidden_action");

		switch(id) {
			case 1:
				   div_tradeleads.style.display = "";
				   div_company.style.display = "none";
				   div_partner.style.display = "none";
				   div_expo.style.display = "none";

				   span_tradeleads_selected.style.display = "";
				   span_tradeleads_unselected.style.display = "none";
				   span_tradeleads_unselected1.style.display = "none";
				   span_company_selected.style.display = "none";
				   span_company_unselected.style.display = "";
				   span_company_unselected1.style.display = "none";
				   span_partner_selected.style.display = "none";
				   span_partner_unselected.style.display = "";
				   span_partner_unselected1.style.display = "none";
				   span_expo_selected.style.display = "none";
				   span_expo_unselected.style.display = "";
				   hidden_action.value='tradeleads';
                   break;

			case 2:
				   div_tradeleads.style.display = "none";
				   div_company.style.display = "";
				   div_partner.style.display = "none";
				   div_expo.style.display = "none";

				   span_tradeleads_selected.style.display = "none";
				   span_tradeleads_unselected.style.display = "none";
				   span_tradeleads_unselected1.style.display = "";
				   span_company_selected.style.display = "";
				   span_company_unselected.style.display = "none";
				   span_company_unselected1.style.display = "none";
				   span_partner_selected.style.display = "none";
				   span_partner_unselected.style.display = "";
				   span_partner_unselected1.style.display = "none";
				   span_expo_selected.style.display = "none";
				   span_expo_unselected.style.display = "";
				   hidden_action.value='company';
				   break;

			case 3:
				   div_tradeleads.style.display = "none";
				   div_company.style.display = "none";
				   div_partner.style.display = "";
				   div_expo.style.display = "none";

				   span_tradeleads_selected.style.display = "none";
				   span_tradeleads_unselected.style.display = "";
				   span_tradeleads_unselected1.style.display = "none";
				   span_company_selected.style.display = "none";
				   span_company_unselected.style.display = "none";
				   span_company_unselected1.style.display = "";
				   span_partner_selected.style.display = "";
				   span_partner_unselected.style.display = "none";
				   span_partner_unselected1.style.display = "none";
				   span_expo_selected.style.display = "none";
				   span_expo_unselected.style.display = "";
				   hidden_action.value='partner';
				   break;

			case 4:
				   div_tradeleads.style.display = "none";
				   div_company.style.display = "none";
				   div_partner.style.display = "none";
				   div_expo.style.display = "";

				   span_tradeleads_selected.style.display = "none";
				   span_tradeleads_unselected.style.display = "";
				   span_tradeleads_unselected1.style.display = "none";
				   span_company_selected.style.display = "none";
				   span_company_unselected.style.display = "";
				   span_company_unselected1.style.display = "none";
				   span_partner_selected.style.display = "none";
				   span_partner_unselected.style.display = "none";
				   span_partner_unselected1.style.display = "";
				   span_expo_selected.style.display = "";
				   span_expo_unselected.style.display = "none";
				   hidden_action.value='expo';
				   break;

		}
	}


	/**
	 * 今日最新采购 今日最新供应 今日最新公司
	 *
	 * @function 显示不同层
	 */

	 this.show_span = show_span;
	 function show_span(id) {
		 var li_buy = document.getElementById("li_buy");
		 var li_sell = document.getElementById("li_sell");
		 var li_company = document.getElementById("li_company");

         var span_buy = document.getElementById("span_buy");
		 var span_sell = document.getElementById("span_sell");
		 var span_company = document.getElementById("span_company");
		//行业资讯   社区精华
		 var li_information = document.getElementById("li_information");
		 var li_community = document.getElementById("li_community");
		 
		 var span_information = document.getElementById("span_information");
		 var span_community = document.getElementById("span_community");	
		 	 
		 switch(id) {
                case 1:					
				    li_buy.className = "bg_2 h";
					li_sell.className = "";
					li_company.className = "";
				    span_buy.style.display = "";
					span_sell.style.display = "none";
					span_company.style.display = "none";
					break;
                 case 2:				
				    li_buy.className = "";
					li_sell.className = "bg_2 h_2 h";
					li_company.className = "";
				    span_buy.style.display = "none";
					span_sell.style.display = "";
					span_company.style.display = "none";
					break;
                 case 3:					
				    li_buy.className = "";
					li_sell.className = "";
					li_company.className = "bg_2 h_2 h";
				    span_buy.style.display = "none";
					span_sell.style.display = "none";
					span_company.style.display = "";
					break;
					
                 case 4:	
				    li_information.className = "bg_2 h";
					li_community.className = "";
					span_information.style.display = "";
					span_community.style.display = "none";
					break;					
                 case 5:	
				    li_information.className = "";
					li_community.className = "bg_2 h_2 h";
					span_information.style.display = "none";
					span_community.style.display = "";
					break;	
		 }
		 




	 }

	this.doclick = doclick;
	function doclick() {
		var param = "doclick=1&user_name="+document.getElementById("str_user_name").value+"&password="+document.getElementById("str_password").value;
		post(doclick_result,param);
	}

	this.doclick_result = doclick_result;
	function doclick_result() {
		if( request.readyState == 4 ){
			if( request.responseText == '<span></span>' ){
				ajax.load( "/index.php/js" );
			}
		}
	}

	this.bind = bind;
	function bind() {
		document.getElementById('div_tradeleads').onclick = function() { new Client_index("POST","index.php").show_search_div(1);return false; };
		document.getElementById('div_company').onclick = function() { new Client_index("POST","index.php").show_search_div(2);return false; };
		document.getElementById('div_partner').onclick = function() { new Client_index("POST","index.php").show_search_div(3);return false; };
		document.getElementById('div_expo').onclick = function() { new Client_index("POST","index.php").show_search_div(4);return false; };
		//document.getElementById('li_buy').onmouseover = function() { var strClient_index = "new Client_index('POST','index.php').show_span(1)";window.setTimeout(strClient_index,300);return false; };
		//document.getElementById('li_sell').onmouseover = function() { var strClient_index = "new Client_index('POST','index.php').show_span(2)";window.setTimeout(strClient_index,300);return false; };
		//document.getElementById('li_company').onmouseover = function() { var strClient_index = "new Client_index('POST','index.php').show_span(3)";window.setTimeout(strClient_index,300);return false; };
		//document.getElementById('li_information').onmouseover = function() { var strClient_index = "new Client_index('POST','index.php').show_span(4)";window.setTimeout(strClient_index,300);return false; };
		//document.getElementById('li_community').onmouseover = function() { var strClient_index = "new Client_index('POST','index.php').show_span(5)";window.setTimeout(strClient_index,300);return false; };
		//ajax.$("logo").onclick = function () { new Client_index("POST","index.php").doclick(); return false; };
	}

	this.bindsearch = bindsearch;
	function bindsearch(){
		document.getElementById('div_tradeleads').onclick = function() { new Client_index("POST","index.php").show_search_div(1);return false; };
		document.getElementById('div_company').onclick = function() { new Client_index("POST","index.php").show_search_div(2);return false; };
		document.getElementById('div_partner').onclick = function() { new Client_index("POST","index.php").show_search_div(3);return false; };
		document.getElementById('div_expo').onclick = function() { new Client_index("POST","index.php").show_search_div(4);return false; };
	}



}

/*最新采购、供应、公司下的滚动条*/
function startmarquee(lh,speed,delay,divid)
{
	var p=false;
	var t;
	var o=document.getElementById(divid);
	o.innerHTML+=o.innerHTML;
	o.style.marginTop=0;
	o.onmouseover=function(){p=true;}
	o.onmouseout=function(){p=false;}
	
	function start()
	{
		t=setInterval(scrolling,speed);
		if(!p)
		o.style.marginTop=parseInt(o.style.marginTop)-1+"px";
	}
	
	function scrolling()
	{
		if(parseInt(o.style.marginTop)%lh!=0)
		{
			o.style.marginTop=parseInt(o.style.marginTop)-1+"px";
			if(Math.abs(parseInt(o.style.marginTop))>=o.scrollHeight/2)
			o.style.marginTop=0;
		}
		else
		{
			clearInterval(t);
			setTimeout(start,delay);
		}
	}
	setTimeout(start,delay);
}






/*x*/
startList = function() {
if (document.all && document.getElementById) {
cssdropdownRoot = document.getElementById("cssdropdown");
for (i=0; i<cssdropdownRoot.childNodes.length; i++) {
node = cssdropdownRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}

if (window.attachEvent)
window.attachEvent("onload", startList)
else
window.onload=startList;
















