function $(obj)
{
  return document.getElementById(obj);	
}
function createXMLHttpRequest()
{
  if(window.ActiveXObject){
    //MS IE
    try{
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
    }catch(e){
        try{
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }catch(e){ }
    } 
}else if(window.XMLHttpRequest){
    //NOT MS IE
    xmlhttp=new XMLHttpRequest();
    }
if(!xmlhttp){
    xmlhttp=false;
    alert("无法建立 Ajax 请求对象,你的浏览器版本太低，建议升级你的浏览器.");
    //window.location.href="ajaxError.htm";
    }
return xmlhttp;
 }
//内页用切换
function procase(val){
	var overColor = "url(sbc/images/fbtn.jpg)";
	var outColor = "url(hotel/images/fbtn2.jpg)";
	var overtxt = "#e70052"
	var outtxt = "#ffffff"
	
	var i=1
	var len=4

	for(i;i<=len;i++)
	{
		if(i!=val)
		{
			
			document.getElementById("pbox"+i).style.display='none';
			document.getElementById("ptn"+i).style.backgroundImage ="none"
			document.getElementById("ptn"+i).style.color = outtxt;
			
			
			
			
		}
		else
		{
			document.getElementById("pbox"+val).style.display='';	
			document.getElementById("ptn"+val).style.backgroundImage ="url(sbc/images/0"+i+"_01.jpg)";
			document.getElementById("ptn"+val).style.color = overtxt;	
		}
	}
}

//首页用Banner切换
function showDiv(obj,num,len)
{
 for(var id = 1;id<=len;id++)
 {
  var ss=obj+id;
  var snav =obj+"nav"+id;
  if(id==num){
	try{document.getElementById(ss).style.display="block"}catch(e){};
	try{
	//for( i=1, i<len,i++){document.getElementById(snav).className="noactive";}
	document.getElementById(snav).className="active"
	}catch(e){};
  }else{
	try{document.getElementById(ss).style.display="none"}catch(e){};
	try{document.getElementById(snav).className="noactive"}catch(e){};
  }
 }  
}

var currslid = 0;
var picnum=3; //共有图片数量
var slidint;




//产品选项卡
function showDiv(obj,num,len)
{
	for(var id = 1;id<=len;id++)
	{
	var ss=obj+id;
	var snav =obj+"nav"+id;
	if(id==num)
	{
		try{document.getElementById(ss).style.display="block"}catch(e){};
		try
		{
		//for( i=1, i<len,i++){document.getElementById(snav).className="noactive";}
		document.getElementById(snav).className="active"
		}
		catch(e){};
		}
		else
		{
			try{document.getElementById(ss).style.display="none"}catch(e){};
			try{document.getElementById(snav).className="noactive"}catch(e){};
		}
	}  
}





/*
var LocString=String(window.document.location.href);        
function getQueryStr(str)
{   
  var rs = new RegExp("(^|)"+str+"=([^\&]*)(\&|$)","gi").exec(LocString),tmp;      if(tmp=rs)
  {  
	 return tmp[2];   
  }   
	return "";   
}
*/
function addLoadEvent(func){
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function(){
			oldonload();
			func();
		}
	}
}
function getID()
{
	var LocString=String(window.document.location.href);    
	function getQueryStr(str)
	{   
	  var rs = new RegExp("(^|)"+str+"=([^\&]*)(\&|$)","gi").exec(LocString),tmp;      if(tmp=rs)
	  {  
		 return tmp[2];   
	  }   
		return "";   
	}

	var cUrl=location.href;
	if (cUrl.indexOf("order.html") > 0)
	{  
		//alert(getQueryStr("pid"))
		//alert(document.getElementById("proID"))
		document.getElementById("proname").value = getQueryStr("pname");
		document.getElementById("proid").value = getQueryStr("pid");
	}
	if (cUrl.indexOf("orderSearch.html")>0) //订单查询
	{
	  var act=getQueryStr("act");
	  var url="";
	  if (act=="oinfo")
	  {
		var orderid=getQueryStr("orderid");
		url="/ajax/ajax.asp?act=orderinfo&orderid="+orderid;
	  }
	  else
	  {
	    url="/ajax/ajax.asp?act=ordersearch";
	  }
	  //alert(url);
	  AjaxContent(url,"ordersearchform");
	}
}

addLoadEvent(getID)

function CheckFeedback()
{
	if (document.getElementById("MesName").value=="")
	{
		alert("subject is null!");
		document.getElementById("MesName").focus();
		return false;
	}
	if (document.getElementById("message").value=="")
	{
		alert("message is null!");
		document.getElementById("message").focus();
		return false;
	}
	if (document.getElementById("linkman").value=="")
	{
		alert("name is null!");
		document.getElementById("linkman").focus();
		return false;
	}
	if (document.getElementById("Company").value=="")
	{
		alert("Company is null!");
		document.getElementById("Company").focus();
		return false;
	}
	
	if (document.getElementById("Address").value=="")
	{
		alert("Address is null!");
		document.getElementById("Address").focus();
		return false;
	}
	if (document.getElementById("ZipCode").value=="")
	{
		alert("ZipCode is null!");
		document.getElementById("ZipCode").focus();
		return false;
	}
	if (document.getElementById("Telephone").value=="")
	{
		alert("Telephone is null!");
		document.getElementById("Telephone").focus();
		return false;
	}
	if (document.getElementById("Fax").value=="")
	{
		alert("Fax is null!");
		document.getElementById("Fax").focus();
		return false;
	}
	if (document.getElementById("Mobile").value=="")
	{
		alert("Mobile is null!");
		document.getElementById("Mobile").focus();
		return false;
	}
	if (document.getElementById("Email").value=="")
	{
		alert("Email is null!");
		document.getElementById("Email").focus();
		return false;
	}
	if (document.getElementById("CheckCode").value=="")
	{
		alert("CheckCode is null!");
		document.getElementById("CheckCode").focus();
		return false;
	}
	return true;
}

var pubdiv="";
function AjaxContent(url,divid)
{
	pubdiv=divid;
	createXMLHttpRequest();
	xmlhttp.onreadystatechange=ResultAjaxContent;
	xmlhttp.open("post",url,true);
    xmlhttp.send(null)
}

function ResultAjaxContent()
{if (xmlhttp.readyState==4)
	{
	  if (xmlhttp.status==200)
	  {
		$(pubdiv).innerHTML=xmlhttp.responseText;
	  }			
	}
}
function ac_searorder()
{
  if ($("OrderID").value=="")
  {
	  alert("Please input Order No!");
	  return;
  }
  if ($("pwd").value=="")
  {
	 alert("Please input Search Pwd!");
	 return;
  }
  var ordersn=$("OrderID").value;
  var pwd=$("pwd").value;
  var url="/ajax/ajax.asp?act=ordersearch&ordersn="+ordersn+"&pwd="+pwd;
  AjaxContent(url,"ordersearchform");
	
}

function ChkaddOrder()
{
	if ($("proid").value=="0")
	{
	   if ($("ordersn").value=="")
	   {
		 alert("Please input Order no!");
		 $("ordersn").focus();
		 return false;
	   }
	   if ($("cxpwd").value=="0")
	   {
		 alert("Please input Search pwd!");
		 $("cxpwd").focus();
		 return false;
	   }
	}
	if ($("proname").value=="0")
	   {
		 alert("Please input Product name!");
		 $("proname").focus();
		 return false;
	   }
	 if ($("message").value=="0")
	   {
		 alert("Please input message!");
		 $("message").focus();
		 return false;
	   }
	if ($("linkman").value=="0")
	   {
		 alert("Please input linkman!");
		 $("linkman").focus();
		 return false;
	   }
	if ($("company").value=="0")
	   {
		 alert("Please input Company name!");
		 $("company").focus();
		 return false;
	   }
	 if ($("address").value=="0")
	   {
		 alert("Please input Address!");
		 $("address").focus();
		 return false;
	   }
	   if ($("phone").value=="0")
	   {
		 alert("Please input Phone!");
		 $("phone").focus();
		 return false;
	   }
	   if ($("fax").value=="0")
	   {
		 alert("Please input fax!");
		 $("fax").focus();
		 return false;
	   }
	    if ($("phone2").value=="0")
	   {
		 alert("Please input mobile!");
		 $("phone2").focus();
		 return false;
	   }
	    if ($("email").value=="0")
	   {
		 alert("Please input email!");
		 $("email").focus();
		 return false;
	   }
	 return true;
	
}

