// JavaScript Document
function $(o){	return document.getElementById(o);}

function ashow(m,limit){
	for(var i=0;i<limit;i++){ $("nav_"+m).className="unhover"; }
	$("nav_"+m).className="hoveron";
}

function is_number(str){
	exp=/[^0-9()-]/g;
	if(str.search(exp) != -1){return false;}
	return true;
}

function CheckInput(){

	if(form.name.value==''){
		alert("您没有填写昵称！");
		form.name.focus();
		return false;
	}
	if(form.name.value.length>20){
		alert("昵称不能超过20个字符！");
		form.name.focus();
		return false;
	}

	if(!is_number(document.form.qq.value)){
		alert("QQ号必须是数字！");
		form.qq.focus();
		return false;
	}
	if(document.form.email.value.length!=0)
	  {
	   if (document.form.email.value.charAt(0)=="." ||        
		   document.form.email.value.charAt(0)=="@"||       
		   document.form.email.value.indexOf('@', 0) == -1 || 
		   document.form.email.value.indexOf('.', 0) == -1 || 
		   document.form.email.value.lastIndexOf("@")==document.form.email.value.length-1 || 
		   document.form.email.value.lastIndexOf(".")==document.form.email.value.length-1)
	  {
	   alert("Email地址格式不正确！");
	   document.form.email.focus();
	   return false;
	  }
	}
	 else
	  {
	   alert("Email不能为空！");
	   document.form.email.focus();
	   return false;
	}

	if(form.content.value==''){
		alert("您没有填写留言内容！");
		form.content.focus();
		return false;
	}
	if(form.content.value.length>200){
		alert("留言内容不能超过200个字符！");
		form.content.focus();
		return false;
	}
	return true;
}


function showtab(id){
	for(var i=1;i<=4;i++){
		if(document.getElementById('tab'+i)==null) continue;
		if(i!=id) document.getElementById('tab'+i).style.display='none';
	}
	if(document.getElementById('tab'+id).style.display=='block'){
		document.getElementById('tab'+id).style.display='none';
	}
	else{
		document.getElementById('tab'+id).style.display='block';
	}
}

