//function killErrors() { 
//	//return true; 
//} 
////window.onerror = killErrors; 
//
//$().ready(function(){
	initMenu();			   
//})

function initMenu(){
	//show or hide
	$("#menu_list>li").bind("mouseover",function(){
		var tmp="#menu_"+$(this).attr("id").replace("m_","");
		$(".menu_li").css("display","none"); 
		$(tmp).css("display","block");
	})	
	
}

function getbyid(id) {
	//获取document节点
	if (document.getElementById) {
		return document.getElementById(id);
	} else if (document.all) {
		return document.all[id];
	} else if (document.layers) {
		return document.layers[id];
	} else {
		return null;
	}
}

/*  函数名 drawImage(ImgD,widthStr,heightStr)
	说明：自动缩放图片以符合高度与宽度，防止撑开页面
	参数：
		ImgD		---- 图片对象
		widthStr	---- 最高宽度
		heightStr	---- 最高高度
	返回值：
*/
function drawImage(ImgD,widthStr,heightStr){ 
	var image=new Image(); 
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){ 
		if(image.width/image.height>= 1){ 
			if(image.width>widthStr){
   				ImgD.width=widthStr; 
   				ImgD.height=(image.height*widthStr)/image.width; 
  			}else{ 
  			 	ImgD.width=image.width;
   				ImgD.height=image.height; 
  			}
		}else{ 
  			if(image.height>heightStr){
   				ImgD.height=heightStr; 
   				ImgD.width=(image.width*heightStr)/image.height; 
  			}else{ 
   				ImgD.width=image.width;
   				ImgD.height=image.height; 
  			} 
		} 
	}
}

function checkForms(){
	var temp,state
	state=true;
	if (getbyid("txtUserNa").value==""){
		getbyid("txtUserNa").className="online_input_err";
		getbyid("check_name").style.display="block";
		state=false;
		}else{
			getbyid("txtUserNa").className="online_input";
			getbyid("check_name").style.display="none";
			}
	if (getbyid("txtTel").value==""){
		getbyid("txtTel").className="online_input_err";
		getbyid("check_tel").style.color="red";
		state=false;
		}else{
			if (isphone(getbyid("txtTel").value)){
				getbyid("txtTel").className="online_input";
				getbyid("check_tel").innerHTML='<img src="/images/_normal.gif">';
			}else{
				getbyid("txtTel").className="online_input_err";
				getbyid("check_tel").innerHTML="您输入的电话号码不符合规范！示例:021-12345678"
				getbyid("check_tel").style.color="red";
				state=false;
			}	
		}
	if (getbyid("txtMail").value==""){
		getbyid("txtMail").className="online_input_err";
		getbyid("check_mail").style.color="red";
		state=false;
		}else{
			if (ismail(getbyid("txtMail").value)){
				getbyid("txtMail").className="online_input";
				getbyid("check_mail").innerHTML='<img src="/images/_normal.gif">';
			}else{
				getbyid("txtMail").className="online_input_err";
				getbyid("check_mail").innerHTML="错误的邮箱地址！"
				getbyid("check_mail").style.color="red";
				state=false;
			}
		}
	if (getbyid("txtMobile").value!=""){
			if (ismobile(getbyid("txtMobile").value)){
				getbyid("txtMobile").className="online_input";
				getbyid("check_mobile").innerHTML='<img src="/images/_normal.gif">';
			}else{
				getbyid("txtMobile").className="online_input_err";
				getbyid("check_mobile").innerHTML="错误的手机号码！"
				getbyid("check_mobile").style.color="red";
				state=false;
			}
	}
	if (getbyid("txtAddress").value!=""){
			if (getbyid("txtAddress").value.length>5){
				getbyid("txtAddress").className="online_input";
				getbyid("check_address").innerHTML='<img src="/images/_normal.gif">';
			}else{
				getbyid("txtAddress").className="online_input_err";
				getbyid("check_address").innerHTML="你输入的地址太短啦！"
				getbyid("check_address").style.color="red";
				state=false;
			}
	}
	if (getbyid("txtContents").value==""){
		getbyid("txtContents").className="online_text_err";
		getbyid("check_content").style.color="red";
		state=false;
		}else{
			getbyid("txtContents").className="online_txt";
			getbyid("check_content").style.color="#999999";
			}
		
	return state;
	
} 


function ismail(x){ 
var reg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; 
if(!reg.test(x)){ 
	return false
	} 
else 
	{ 
	return true
	} 
}


function isphone(x){ 
var reg=/^(^[0-9]{3,4}\-[0-9]{6,8}$)|(^\([0-9]{3,4}\)[0-9]{6,8}$)/; 
	if(!reg.test(x)){ 
		return false
	}else{ 
		return true
	} 
} 
function ismobile(x){ 
	var reg=/^(^0{0,1}13[0-9]{9}$)|(^0{0,1}15[0-9]{9}$)/; 
	if(!reg.test(x)){ 
		return false
	}else{ 
		return true
	} 
} 