﻿// JavaScript Document
//搜索
function sear_check(){
	if(document.formsear.types.value==""){
		alert("Please select category!");
		document.formsear.types.focus();
		return false
	}
	if(document.formsear.keys.value==""){
		alert("Input Keywords!");
		document.formsear.keys.focus();
		return false
	}
}
//产品列表
function remarks(object,proclass){
   if(document.getElementById(object).style.display=="block")
   {
	  proclass.className="pro";
      document.getElementById(object).style.display="none";
   }else{
	  proclass.className="proA";
      document.getElementById(object).style.display="block";
  }
}
//留言F
 function Fcheck(){
   if(document.formF.man.value==""){
      alert("Enter your name!");
	  document.formF.man.focus();
	  return false;
	  }
	if(document.formF.tel.value==""){
      alert("Please fill in your contact telephone!");
	  document.formF.tel.focus();
	  return false;
	  }
    if(document.formF.email.value==""){
      alert("Please fill in your E-mail!");
	  document.formF.email.focus();
	  return false;
	  }
    if(emailcheck(document.formF.email.value)){
		alert("E-mail format is not correct!");
		document.formF.email.focus();
		return false;
   }
   if(document.formF.title.value==""){
      alert("Input header!");
	  document.formF.title.focus();
	  return false;
	  }
	if(document.formF.content.value==""){
      alert("Your message content can not allow!");
	  document.formF.content.focus();
	  return false;
	  }
	if(document.formF.validatecode.value==""){
      alert("Verification Code should not be empty!");
	  document.formF.validatecode.focus();
	  return false;
	  }
}
//订购O
 function ordercheck(){
   if(document.formOrder.quantity.value==""){
      alert("You want the number of products ordered!");
	  document.formOrder.quantity.focus();
	  return false;
	  }
   if(document.formOrder.title.value==""){
      alert("Please enter your order theme!");
	  document.formOrder.title.focus();
	  return false;
	  }
	if(document.formOrder.content.value==""){
      alert("Within the space can not be empty!");
	  document.formOrder.content.focus();
	  return false;
	  }
	if(document.formOrder.man.value==""){
      alert("Enter your real name!");
	  document.formOrder.man.focus();
	  return false;
	  }
	if(document.formOrder.add.value==""){
      alert("Enter your address!");
	  document.formOrder.add.focus();
	  return false;
	  }
    if(document.formOrder.email.value==""){
      alert("Please fill in your E-mail!");
	  document.formOrder.email.focus();
	  return false;
	  }
    if(emailcheck(document.formOrder.email.value)){
		alert("E-mail format is not correct!");
		document.formOrder.email.focus();
		return false;
   }
   if(document.formOrder.tel.value==""){
      alert("Your contact telephone number is what!");
	  document.formOrder.tel.focus();
	  return false;
	  }
	if(document.formOrder.validatecode.value==""){
      alert("Verification Code should not be empty!");
	  document.formOrder.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 CheckAll(Inquire)
  {
  for (var i=0;i<Inquire.elements.length;i++)
    {
    var e = Inquire.elements[i];
    if (e.Name != "chkAll")
       e.checked = Inquire.chkAll.checked;
    }
  }
  //展示图片
function show_image(name)
{
	var imagename=name;
	if (imagename=="")
	{
		document.showpro.src="#";
	}
	else
	{
		//imagepath = "../Upload/Sort/" + imagename;
		imagepath = imagename;
		//document.showpro.src=imagepath;
		document.showpro.src=""+imagepath;
	}
}