function validatePhone(str){
	var phoneReg =/^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/;
	if(str==""){
		alert("Please enter your contact phone.");
		return false;
	}
	else{
		if(!phoneReg.test(str)){
			alert("Phone number format is invalid. Pls check.");
			return false;
		}
	}
	return true;
}

function validateEmail(str){

	var emailReg =/^[0-9A-Za-z\-\.\_]+@[0-9A-Za-z\-\.\_]+\.[A-Za-z]+$/;
	
	if(str==""){
		alert("E-Mail address can not be blank!");
		return false;
	}
	else{
		if(!emailReg.test(str)){
			alert("Email format is incorrect. Pls check.");
			return false;
		}
	}
	return true;
}

function checkNumInput(){   
  var n=event.keyCode;   
  if((n<48 || n>57)&& n!=40 && n!=41 && n!=45 && n!=32) event.keyCode=0;   
}   

var red_style_id=null; //保存红色样式的页面元素的ID

function change_style(){ 
/*该函数主要用来切换两个导航元素的样式，第一个参数为要切换样式的导航元素，第二个参数为新样式，第三个参数为旧样式，第四个参数是可选的，为要恢复样式的导航元素*/
	var a=change_style.arguments;
	a[0].className=a[1];
	if(red_style_id!=null&&red_style_id!=a[0]){
		red_style_id.className=a[2];
	}
	
	if(a[3]!=a[0]){
		a[3].className=a[2];
	}
	red_style_id=a[0];
}





function new_window(url){
	if (window.navigator.userAgent.indexOf("MSIE")>=1){
		var imgObj = new Image();
		imgObj.src = url;
		var Width=imgObj.width+20;
		var Height=imgObj.height+30;
		if(Width<800) Width=800;
		if(Height<600) Height=600;

		window.open(url,'','width='+Width+',height='+Height+',resizable=yes,scrollbars=no,left=0,top=0,lacation=0');
	}else{
		window.open(url,'','width=818,height=618,resizable=yes,scrollbars=no,left=0,top=0,lacation=0');
	}
}