// JavaScript Document
<!--
//check login
function check_login(){
			               $.ajax({
			                     type     : "GET",
				                 url      : "/zmr.php?m=zmr&c=login&a=check",
                                 dataType : "json",
				                 global   : false,
				                 success  : function(json){
									        if(json.status){
												 $("#lgstatus").html("<div style=\"float:left; width:150px; padding-top:10px; *padding-top:25px;\" class=\"tjsd\">欢迎您:"+json.user+", <a id=\'logout\' style=\"cursor:pointer\">退出</a>");
												 $("#logout").click(function (){
																			     $.ajax({
																						type     : "GET",
																						url      : "/zmr.php?m=zmr&c=login&a=out",
																						dataType : "script",
																						global   : false,
																						success  : function(json){
																						            $("#loginjs").html(json);
																									alert('退出成功!');
																									init_login();
																						}
																						});
																			  });
												}else{
														init_login();
													}
									 }	   		 
 			                     });
	}

$(document).ready(function(){
                $("body").append('<div id=\"loginjs\" style=\"display:none\"></div>');
				check_login();
});

function init_login(){
	 var html = '<div class=\"z_h\">'+
	            '<input style=\"background:url(/images/edition/zhanghao_bg.jpg) no-repeat; border:0; width:120px; height:24px; color:#FFFFFF; font-weight:bold; padding-left:5px;\" id=\"username\" type=\"text\" maxlength=\"32\" size=\"18\" name=\"username\" value=\"请输入账号!\" />'+  
                '</div>'+
	            '<div class=\"pass\">'+
	            '<input style=\"background:url(/images/edition/pass_bg.jpg) no-repeat; border:0; width:119px; height:24px;\" id=\"password\" type=\"password\" maxlength=\"32\" size=\"18\" name=\"password\" />'+
	            '</div>'+
	            '<div class=\"icon_l\"><img id=\"ulogin\" src=\"/images/edition/icon_login.jpg\" border=\"0\" style=\"cursor:pointer;\">'+
                '</div>';
	$("#lgstatus").html(html);	
	
	$("#username").click(function(){
								    $("#username").val(''); 
								  });

    $("#ulogin").click(function (){
			               $.ajax({
			                     type     : "GET",
				                 url      : "/zmr.php?m=zmr&c=login&a=in&username="+encodeURIComponent($("#username").val())+"&password="+$("#password").val(),
                                 dataType : "json",
				                 global   : false,
				                 success  : login_success	 
 			                     });								
								}); 
	}

function login_success(js){	
  if(js.status){
	     alert('登陆成功!');
		 $("#loginjs").html(js.script);
		 check_login();
	  }else{
		    alert('登陆失败,请确认您输入的账号和密码是否正确!');
		  }
}
-->
