// JavaScript Document

function setNavTab(index){
	for(var i=1; i<=7; i++){
		if(index==i){
			document.getElementById("nav_"+i).className = "on";
		}else{
			document.getElementById("nav_"+i).className = "";
		}
	}
}

function checkOnLine(){
  var obj = document.form;
  var checkemail=/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;

  if(obj.email.value!=""){
    if(!checkemail.test(obj.email.value)){
      alert("电子邮件格式不正确！");
      return false;
    }
  }

  if(obj.company.value==""){
    alert("请填写公司名称！"); 
    return false; 
  }else if(obj.proname.value==""){ 
    alert("请填写产品名称！"); 
    return false; 
  }else if(obj.name.value==""){ 
    alert("请填写联系人！"); 
    return false; 
  }else if(obj.tel.value==""){ 
    alert("请填写联系电话！");
    return false; 
  }else{ 
    obj.action="online.php?type=1"; 
  }
}

function checkOrder(){
  var obj = document.form;
  var checkemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;

  if(obj.email.value!=""){
    if(!checkemail.test(obj.email.value)){
      alert("电子邮件格式不正确！");
      return false;
    }
  }

  if(obj.subject.value==""){
    alert("请填写主题！"); 
    return false; 
  }else if(obj.username.value==""){
    alert("请填写联系人！"); 
    return false; 
  }else if(obj.tel.value==""){
    alert("请填写联系电话！");
    return false;
  }else{ 
    obj.action="provider.php?type=1";
  }
}

function exhibit_over(index){
  document.getElementById("exhibit_"+index).className = "on";
}

function exhibit_out(index){
  document.getElementById("exhibit_"+index).className = "";
}

function link_over(index){
  document.getElementById("link_"+index).className = "on";
}

function link_out(index){
  document.getElementById("link_"+index).className = "";
}

// 创建Flash
function createFlash(ad_id, ad_width, ad_height, xml_url)
{
  str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="'+ad_id+'" name="'+ad_id+'" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ad_width+'" height="'+ad_height+'">';
  str += '<param name="movie" value="flash/bcastr.swf?bcastr_xml_url='+xml_url+'">';
  str += '<param name="quality" value="high">';
  str += '<param name="scale" value="noscale">';
  str += '<param name="loop" value="false">';
  str += '<param name="menu" value="false">';
  str += '<param name="wmode" value="transparent">';
  str += '<embed src="flash/bcastr.swf?bcastr_xml_url='+xml_url+'" width="'+ad_width+'" height="'+ad_height+'" loop="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" salign="T" name="scriptmain" menu="false" wmode="transparent"></embed>';
  str += '</object>';
  document.write(str);
}
