function goreg()
{
	$("#zhucess").show( 200 );
	$("#loginsss").hide( 200 );
	$("#xili_zc").show( 200 );
	$("#xili_dl").hide( 200 );
	$("#action").val( "1" ); //注册
}

function gologin()
{
	 $("#zhucess").hide( 200 );
	 $("#loginsss").show( 200 );
	 $("#xili_zc").hide( 200 );
	 $("#xili_dl").show( 200 );
	 $("#action").val( "2" ); //登录
}

function reg()
{
  var email    = $("#email").val().replace(/[\\\/\:\?\*\<\>\|\"\=\' ]/g,'');
  $("#email").val(email);
  var mobile   = $.trim( $("#mobile").val() );
  var nickname = $.trim( $("#nickname").val() );
  var pwd      = $.trim( $("#pwd").val() );
  var repwd    = $.trim( $("#repwd").val() );
  var xieyia = $("#xieyia:checked").val();
  var zhufu = $.trim( $("input[name='zhufu']:checked").val() );

  var otherzhufu = $.trim($("#otherzhufu").val());

  if(email.match(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/ig))
  {
       if( !nickname=="" )
	   {
		    if( pwd.length<6 || pwd.length>20 )
			{
			   alert("您的密码长度应在6－20位之间");
	           $("#pwd").focus();
			}else if( pwd!=repwd )
			{
				alert("两次输入的密码不一致");
			}else
			{
				if( xieyia!=1 )
				{
				    alert("您必须阅读并同意《尚帝网交易条款》和《尚帝用户使用条款》放能注册");
				}else
				{
				    var otherzhufu = $.trim( $("#otherzhufu").val() );	
                    var otherzhufu_words = otherzhufu.length;
				    if( otherzhufu_words>100 )
					{
					   //$("#otherzhufu").addClass( "otherzhufu_red" ); 
					   $("#otherzhufu").css( "border","#FF0000 2px solid" );
					}else
					{
					   $.post("reglogin.php?"+Math.random(),{action:"reg",email:email,mobile:mobile,nickname:nickname,pwd:pwd ,zhufu:zhufu,otherzhufu:otherzhufu},send);
					   function send(text)
					   {
							alert( text );
							//$("input").val("");
							get_marquee_div();
					   }
					}
				}
			}
	   }else
	   {
		    alert("昵称不能为空");
	        $("#nickname").focus();
	   }
  }else
  {
	   alert("邮件格式不对");
	   $("#email").focus();
  }

}

function login()
{
    var email  = $.trim(  $("#lg_email").val() ).replace(/[\\\/\:\?\*\<\>\|\"\=\' ]/g,'');
	$("#email").val(email);

	var passwd = $.trim( $("#lg_passwd").val() );
	var xieyia = $("#xieyia:checked").val();
	var zhufu = $.trim( $("input[name='zhufu']:checked").val() );
    var otherzhufu = $.trim($("#otherzhufu").val());

	if( email=="" || !email.match(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/ig))
	{
	    alert("请输入有效的邮箱");
	}else if( passwd=="" )
	{
	    alert("请输入密码");
	}else
	{
		if( xieyia!=1 )
		{
			alert("您必须阅读并同意《尚帝网交易条款》和《尚帝用户使用条款》放能注册");
		}else
		{
             var otherzhufu = $.trim( $("#otherzhufu").val() );	
             var otherzhufu_words = otherzhufu.length;
			if( otherzhufu_words>100 )
			{
			   //$("#otherzhufu").addClass( "otherzhufu_red" ); 
			   $("#otherzhufu").css( "border","#FF0000 2px solid" );
			}else
			{
			   $.post("reglogin.php?"+Math.random(),{action:"login",email:email,mobile:"",nickname:"",pwd:passwd ,zhufu:zhufu,otherzhufu:otherzhufu},send);
			   function send(text)
			   {
					alert( text );
					//$("input").val("");
					get_marquee_div();
			   }
			}
		}


	}

}


//获取滚动
function get_marquee_div() {
    $.post("index.php?"+Math.random(),{action:"getlist"},send);
	function send(text)
	{
		$("#marquee_div").html( text );
	 }
}

function qieuan_check()
{
   $("input[@type=radio]").attr("checked","其他祝福语"); 
   var max_str = 100;
   var otherzhufu = $.trim( $("#otherzhufu").val() );	
   var shengyu = 100-otherzhufu.length;
   if( shengyu>=0 )
   {
	  $("#otherzhufu").css( "border","" );
	  $("#tishi_1").html( "你还可以输入" );
	  shengyu = String( shengyu );
	  $("#zhufushengyu").html( shengyu ); 
	  $("#chkwordsdiv").removeClass( "chkwordsdiv_class" );
   }else if( shengyu<0)
   {
	  $("#otherzhufu").css( "border","#FF0000 2px solid" );
	  $("#tishi_1").html( "<img src='images/publish_x.png' /> 已超出" );
	  var shengyu = 0-shengyu;
	  shengyu = String( shengyu );
	  $("#zhufushengyu").html( shengyu ); 
	  $("#chkwordsdiv").addClass( "chkwordsdiv_class" );
   }
   
}
