﻿function check(){
//alert("0");

if(document.getElementById("change").style.display=="")
document.getElementById("change").style.display="none";
else
document.getElementById("change").style.display="";
}

	
	function op(obj)
	{
	//alert("ppp");
	if(obj==1)
	{document.getElementById("cun2").style.display="";
	document.getElementById("facebox").style.display="";
	document.getElementById("facebox").innerHTML=str1;}
	else
	{
	document.getElementById("cun2").style.display="";
	document.getElementById("facebox").style.display="";
	document.getElementById("facebox").innerHTML=str2;
	}
	}
	
	function login()
	{
	//alert("ppp");
	document.getElementById("cun2").style.display="";
	document.getElementById("login").style.display="";
	document.getElementById("register").style.display="none";
	}
	function loginover()
	{
	document.getElementById("cun2").style.display="none";
	document.getElementById("login").style.display="none";
	}
    function register()
	{
	//alert("ppp");
	document.getElementById("cun2").style.display="";
	document.getElementById("register").style.display="";
	document.getElementById("login").style.display="none";
	}
	function registerover()
	{
	document.getElementById("cun2").style.display="none";
	document.getElementById("register").style.display="none";
	document.getElementById("login").style.display="none";
	}

	function close_it()
	{
	document.getElementById("cun2").style.display="none";
	document.getElementById("facebox").innerHTML="";
	}
	function $(p){return document.getElementById(p);}
	function check_form1(obj1,obj2)
	{
	var bl1;
    var bl2;
    bl1=$(obj1).value;
    bl2=$(obj2).value;
	
	if($(obj1).value=="" && $(obj2).value=="")
		{
		$("err_msg").innerHTML="<span style='color:#b42b59; margin-right:52px; font-size:10px;'><img src='img/error.gif' width='10' height='10' style='vertical-align:middle;' />&nbsp;You didn't enter both a username and password!</span>";
		//alert("请填写用户名!");
		$(obj1).focus();
		return false;
			}
	
	
	if($(obj1).value=="")
		{
		$("err_msg").innerHTML="<span style='color:#b42b59; margin-right:52px; font-size:10px;'><img src='img/error.gif' width='10' height='10' style='vertical-align:middle;' />&nbsp;You didn't enter a username!</span>";
		//alert("请填写用户名!");
		$(obj1).focus();
		return false;
			}
			if($(obj2).value=="")
		{
		//alert("请填写密码!");
		$("err_msg").innerHTML="<span style='color:#b42b59; margin-right:52px; font-size:10px;'><img src='img/error.gif' width='10' height='10' style='vertical-align:middle;' />&nbsp;You didn't enter  a  password!</span>";
		$(obj2).focus();
		return false;
			}
	}


function $(obj)
{return document.getElementById(obj);}
function check_form2(obj1,obj2,obj3,obj4,id)
{
	//alert(email);
var email = $(obj3).value;          
var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
flag = pattern.test(email); 	
	
if($(obj1).value=="")
{
$(obj1).focus();
return false;
}
if($(obj1).value.length<6)
{
$(obj1).focus();
return false;
}		
if(!($(obj1).value==$(obj2).value))
{
$(obj2).focus();
return false;
}
if(!flag) 
{ 　
$(obj3).value="";
$(obj3).focus();
return false; 
} 
if($(obj4).value=="")
{
$("err_ms5").innerHTML="<span style='color:#b42b59; margin-right:52px; font-size:10px;'>&nbsp;Please enter the captcha!</span>";	
$(obj4).focus();
return false;
}

}
	
	
	
function chk_user(id,obj)
{
//alert("名!");
var u_name=document.getElementById(id).value;
chk_staus(u_name,"check_un.asp",obj);
}

function chk_ps(id,obj)
{
//alert("密码不能太短");
if($(id).value=="")
{
$("err_ms2").innerHTML="<span style='color:#b42b59; margin-right:52px; font-size:10px;'><img src='img/error.gif' width='10' height='10' style='vertical-align:middle;' />&nbsp;Please enter the password!</span>";
$(id).focus();
return;
}
if($(id).value.length<6)
{
$("err_ms2").innerHTML="<span style='color:#b42b59; margin-right:52px; font-size:10px;'><img src='img/error.gif' width='10' height='10' style='vertical-align:middle;' />&nbsp;Must be at least 6 characters long!</span>";
$(id).focus();
return;
}
else
$("err_ms2").innerHTML="<span style='color:#b42b59; margin-right:52px; font-size:10px;'>&nbsp;</span>";
}

function chk_cofps(id1,id2,obj)
{
//alert("密码要一致");
if(!($(id1).value==$(id2).value))
		{
	    $("err_ms3").innerHTML="<span style='color:#b42b59; margin-right:52px; font-size:10px;'><img src='img/error.gif' width='10' height='10' style='vertical-align:middle;' />&nbsp;Passwords do not match!</span>";
		$(id2).focus();
		}
		else
		$("err_ms3").innerHTML="<span style='color:#b42b59; margin-right:52px; font-size:10px;'>&nbsp;</span>";

}

function chk_email(obj) 
　　　　　{ 
　　　　　　var email = $(obj).value; 
             //alert(email);
　　　　　　var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
　　　　　　flag = pattern.test(email); 
　　　　　　if(!flag) 
　　　　　　{ 　
          $("err_ms4").innerHTML="<span style='color:#b42b59; margin-right:52px; font-size:10px;'><img src='img/error.gif' width='10' height='10' style='vertical-align:middle;' />&nbsp;The email provided does not appear to be vaild!</span>";
          $(obj).value="";
		  $(obj).focus();
		   return false; 
　　　　　　} 
          else
		  $("err_ms4").innerHTML="<span style='color:#b42b59; margin-right:52px; font-size:10px;'>&nbsp;</span>";　　　　
　　　　　 } 
