// ActionScript Communications Document
//站内搜索
function procheck(){
	if(document.formSear.keys.value==""){
		alert("Input the keywords!");
		document.formSear.keys.focus();
		return false
	}
}

//留言F
 function Fcheck(){
   if(document.formF.ime1.value==""){
      alert("'Ordering units (or individual) name' can not be empty!");
	 document.formF.ime1.focus();
	  return false;
	  }	
    if(document.formF.ime2.value==""){
      alert("'Ordering units (or individual) addres'can not be empty!");
	  document.formF.ime2.focus();
	  return false;
	  }
	if(document.formF.ime3.value==""){
      alert("'Linkman' can not be empty!！");
	  document.formF.ime3.focus();
	  return false;
	  }
   if(document.formF.ime4.value==""){
      alert("'Tel' can not be empty!");
	  document.formF.ime4.focus();
	  return false;
	  }
	if(emailcheck(document.formF.ime7.value)){
		alert("entered the wrong email format!");
		document.formF.ime7.focus();
		return false;
     } 
   if(document.formF.ime8.value==""){
      alert("'Goods' can not be empty!");
	  document.formF.ime8.focus();
	  return false;
	  }
	if(document.formF.validatecode.value==""){
      alert("'Validatecode' can not be empty!！");
	  document.formF.validatecode.focus();
	  return false;
	  }
}
//判断Email的正确性
function   emailcheck(string){     
  var   str_len   =   string.length;   
  if   (str_len<=5){   
        return   true   
          }       
  for(i=0;i<str_len;i++){   
          if   (string.charCodeAt(i)>127){   
  return   true     
  }   
  }   
  if   (string.indexOf("@")<2){   
          return   true   
          }       
    if   (string.indexOf(".")==1){   
          return   true   
          }       
  if   (string.indexOf(":")!=-1){   
          return   true   
  }   
 }
//弹出窗口
function Win(file,w,h,r,s){
    window.open(file,'','resizable='+r+',width='+w+",height="+h+',scrollbars='+s+',left='+(screen.availWidth-w)/2+',top='+(screen.availHeight-h)/2);
}

//产品列表
function proDo(obj){
	var cls=document.getElementById("c"+obj);
	var pro=document.getElementById("p"+obj);
	if(pro.style.display=="none" || pro.style.display==""){
		pro.style.display="block";
		//cls.style.background="url(images/products/jia.gif) no-repeat left center";
		return SetCookie("memo",getCookie("memo")+"-"+obj+"-")//记录cookie
	}else{
		pro.style.display="none";
		//cls.style.background="url(images/products/jian.gif) no-repeat left center";
        return SetCookie("memo",getCookie("memo").replace("-"+obj+"-",""))//去除cookie
		
	}
}
function proDo1(obj){
	var cls=document.getElementById("b"+obj);
	var pro=document.getElementById("t"+obj);
	if(pro.style.display=="none" || pro.style.display==""){
		pro.style.display="block";
		cls.style.background="url(images/products/jian.gif) no-repeat left center";
		return SetCookie("memo1",getCookie("memo1")+"-"+obj+"-")//记录cookie
	}else{
		pro.style.display="none";
		cls.style.background="url(images/products/jia.gif) no-repeat left center";
        return SetCookie("memo1",getCookie("memo1").replace("-"+obj+"-",""))//去除cookie
		
	}
}
function SetCookie(name, value)//两个参数，一个是cookie的名子，一个是值 
{
	 var Days = 30; //此 cookie 将被保存 30 天
    var exp = new Date();    //new Date("December 31, 9998");
    exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
    document.cookie = name + "=" + escape(value) + ";"
}

function getCookie(name)//读取cookies函数        
{
      var strcookie=document.cookie;
      var arrcookie=strcookie.split("; ");
      for(var i=0;i<arrcookie.length;i++){
            var arr=arrcookie[i].split("=");
            if(arr[0]==name)return arr[1];
      }
      return "";

}
