﻿function OnEnter( field ) { if( field.value == field.defaultValue ) { field.value = "";} }
function OnExit( field ) { if( field.value == "" ) { field.value = field.defaultValue; } }  


var $=function (obj){
   return document.getElementById(obj);
}
function showTxt(Id1, Id2) {
    var check = document.getElementById(Id1);
    var txt = document.getElementById(Id2);
    if (check.checked) {
        txt.style.display = "block";
       
    }
    else {
        txt.style.display = "none";
       
    }
}

function showCountry() 
{
  if(document.myform.choosecountry[0].checked){
	  $("trcountry1").style.display="none";
	  $("trcountry2").style.display="block";
	  $("trcountry3").style.display="block";
	 
	 $("tel1").value="0086";
	 $("fax1").value="0086";
	 $("mobile1").value="0086";
	 $("exhibitor_tel_01").value="0086";
	 $("exhibitor_fax_01").value="0086";
	 $("exhibitor_worktel01").value="0086";
	 $("exhibitor_workfax01").value="0086";
	 $("exhibitor_worktel01").value="0086";
	 $("exhibitor_workfax01").value="0086";
	 $("exhibitor_workte_more_l01").value="0086";
	 $("exhibitor_workfax_more_l01").value="0086";
	 $("exhibitor_mobile1").value="0086";
	 $("exhibitor_workmobile01").value="0086";
	 $("exhibitor_workmobile_more101").value="0086";
  }
    if(document.myform.choosecountry[1].checked){
	 
	  $("trcountry1").style.display="block";
	  $("trcountry2").style.display="none";
	  $("trcountry3").style.display="none";
	
	 $("tel1").value="";
	 $("fax1").value="";
	  $("tel2").value="";
	 $("fax2").value="";
	 $("mobile1").value="";
	 	 $("exhibitor_tel_01").value="";
	 $("exhibitor_fax_01").value="";
	 $("exhibitor_worktel01").value="";
	 $("exhibitor_workfax01").value="";
	 $("exhibitor_worktel01").value="";
	 $("exhibitor_workfax01").value="";
	 $("exhibitor_workte_more_l01").value="";
	 $("exhibitor_workfax_more_l01").value="";
	 $("exhibitor_mobile1").value="";
	 $("exhibitor_workmobile01").value="";
	 $("exhibitor_workmobile_more101").value="";
	 
	 $("exhibitor_tel_02").value="";
	 $("exhibitor_fax_02").value="";
	 $("exhibitor_worktel02").value="";
	 $("exhibitor_workfax02").value="";
	 $("exhibitor_workte_more_l02").value="";
	 $("exhibitor_workfax_more_l02").value="";
 }
      
}

var myreg1=/([a-z0-9A-Z]+[-|\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-zA-Z]{2,}$/

 function checkform()
 {
    if(document.myform.Name.value=="" ||document.myform.Name.value==null)
	{
	 alert("请填写您的姓名!");
	 return false;
	}
    else if(document.myform.Name.value=="请输入")
	 {
	  alert("请填写您的姓名 ");
	   return false;
	 }
    else if(document.myform.companyC.value==""||document.myform.companyC.value==null)
	{
	   alert("请填写公司名称!");
	   return false;
	   
	}
	else if(document.myform.companyC.value=="请输入")
	{
	  alert("请填写公司名称!");
	  return false;
	}
	 else if(document.myform.address.value==""||document.myform.address.value==null)
	{
	   alert("请填写公司地址!");
	   return false;
	   
	}
	else if(document.myform.address.value=="请输入")
	{
	  alert("请填写公司地址!");
	  return false;
	}
	 else if(document.myform.post.value==""||document.myform.post.value==null)
	{
	   alert("请填写邮编");
	   return false;
	   
	}
	else if(document.myform.post.value=="请输入")
	{
	  alert("请填写公司邮编!");
	  return false;
	}
	 else if(document.myform.tel3.value==""||document.myform.tel3.value==null)
	{
	   alert("请填写公司电话");
	   return false;
	   
	}
	else if(document.myform.tel3.value=="请输入")
	{
	  alert("请填写公司电话!");
	  return false;
	}
	 else if(document.myform.fax3.value==""||document.myform.fax3.value==null)
	{
	   alert("请填写公司传真!");
	   return false;
	   
	}
	else if(document.myform.fax3.value=="请输入")
	{
	  alert("请填写公司传真!");
	  return false;
	}
	 else if(document.myform.email.value==""||document.myform.email.value==null)
	{
	   alert("请填写邮箱");
	   return false;
	   
	}
	else if(document.myform.email.value=="请输入")
	{
	  alert("请填写邮箱!");
	  return false;
	}
   else if(!myreg1.test(document.myform.email.value))
   {
	 alert("邮箱的格式不正确!");
	 document.myform.email.focus();
     return false;
   }
    else if(document.myform.website.value==""||document.myform.website.value==null)
	{
	   alert("请填写公司网址!");
	   return false;
	   
	}
	else if(document.myform.website.value=="请输入")
	{
	  alert("请填写公司网址!");
	  return false;
	}
	
	return true;
 }
 
 /*******validate 参展商***********/
 function checkform1()
 {
    if(document.myform.Name.value=="" ||document.myform.Name.value==null)
	{
	 alert("请填写您的姓名!");
	 return false;
	}
    else if(document.myform.Name.value=="请输入")
	 {
	  alert("请填写您的姓名 ");
	   return false;
	 }
    else if(document.myform.companyC.value==""||document.myform.companyC.value==null)
	{
	   alert("请填写公司名称!");
	   return false;
	   
	}
	else if(document.myform.companyC.value=="请输入")
	{
	  alert("请填写公司名称!");
	  return false;
	}
	 else if(document.myform.address.value==""||document.myform.address.value==null)
	{
	   alert("请填写公司地址!");
	   return false;
	   
	}
	else if(document.myform.address.value=="请输入")
	{
	  alert("请填写公司地址!");
	  return false;
	}
	 else if(document.myform.post.value==""||document.myform.post.value==null)
	{
	   alert("请填写邮编");
	   return false;
	   
	}
	else if(document.myform.post.value=="请输入")
	{
	  alert("请填写公司邮编!");
	  return false;
	}
	 else if(document.myform.tel3.value==""||document.myform.tel3.value==null)
	{
	   alert("请填写公司电话");
	   return false;
	   
	}
	else if(document.myform.tel3.value=="请输入")
	{
	  alert("请填写公司电话!");
	  return false;
	}
	 else if(document.myform.fax3.value==""||document.myform.fax3.value==null)
	{
	   alert("请填写公司传真!");
	   return false;
	   
	}
	else if(document.myform.fax3.value=="请输入")
	{
	  alert("请填写公司传真!");
	  return false;
	}
	 else if(document.myform.email.value==""||document.myform.email.value==null)
	{
	   alert("请填写邮箱");
	   return false;
	   
	}
	else if(document.myform.email.value=="请输入")
	{
	  alert("请填写邮箱!");
	  return false;
	}
   else if(!myreg1.test(document.myform.email.value))
   {
	 alert("邮箱的格式不正确!");
	 document.myform.email.focus();
     return false;
   }
     else if(document.myform.website.value==""||document.myform.website.value==null)
	{
	   alert("请填写公司网址!");
	   return false;
	   
	}
	else if(document.myform.website.value=="请输入")
	{
	  alert("请填写公司网址!");
	  return false;
	}
	
    else if(document.getElementById("delegate_show").value=="")
	{
	   alert("请选择展位费用和您要订展位号!");
	    return false;
	   
	}
	return true;
 }

/*create xmlhttprequest*/

var http_request = false;
function send_request(method,url,content,responseType,callback){
	http_request=false;
	if(window.XMLHttpRequest){//Mozilla浏览器
		http_request=new XMLHttpRequest();
		if(http_request.overrideMimeType){
			http_request.overrideMimeType("text/xml");
		}
	}
	else{
		try{
			http_request=new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				http_request=new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e){}
		}
	}
	if(!http_request){
		window.alert("不能创建XMLHttpRequest对象实例。");
		return false;
	}
	if(responseType.toLowerCase()=="text"){
		http_request.onreadystatechange=callback;
	}else{
		
		window.alert("响应类别参数错误。");
		return false;
	}
	if(method.toLowerCase()=="get"){
		http_request.open(method,url,true);
	}
	else if(method.toLowerCase()=="post"){
		http_request.open(method,url,true);
		http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	}else{
		window.alert("http请求类别参数错误。");
		return false;
	}
	http_request.send(content);
}
//处理返回文本格式信息的函数
function processTextResponse(){
	if(http_request.readyState==4){
		if(http_request.status==200){
			alert("Text文档响应");
		}else{
			alert("您所请求的页面有异常。");
		}
	}
}
function processXMLResponse(){
	if(http_request.readyState==4){
		if(http_request.status==200){
			alert("XML文档响应");
		}else{
			alert("您所请求的页面有异常。");
		}
	}
}

 function mykeydown(){
   if(event.keyCode==116){
     window.event.keyCode=0;
     return false;
   }
  
 }
 
 document.onkeydown=mykeydown;
 
/*create Table*/
   function showTable(id1,id2,id3,id4,id5){
	   	$(id1).style.display="none";
		$(id2).style.display="block";
		$(id3).style.display="block";
		$(id4).style.display="block";
		
		
        if(id5!=null){
			$(id5).style.display="block";
			}
		
	}
      function showTable1(id1,id2,id3,id4,id5){
	    document.getElementById(id1).style.display = "none";
		document.getElementById(id2).style.display = "none";
		document.getElementById(id3).style.display = "block";
        document.getElementById(id4).style.display = "block";
        if(id5!=null){
			document.getElementById(id5).style.display = "block";
			}
		
	}
	function hideTable(id1,id2,id3,id4,id5){
	    document.getElementById(id1).style.display = "block";
		document.getElementById(id2).style.display = "none";
		document.getElementById(id3).style.display = "none";
        document.getElementById(id4).style.display = "none"; 	
		if(id5!=null){
			document.getElementById(id5).style.display = "none"; 
	 
	 		}
	 
		
	}
	function hideTable1(id1,id2,id3,id4,id5){
	    document.getElementById(id1).style.display = "block";
		document.getElementById(id2).style.display = "block";
		document.getElementById(id3).style.display = "none";
        document.getElementById(id4).style.display = "none"; 	
		if(id5!=null){
			document.getElementById(id5).style.display = "none"; 
			}
		
	}   
