<?xml version="1.0"?>
<logintemplate>
 <direction name="Vertical">
  <![CDATA[
   <div id="loginForm">
	        <div id="haslogin"></div>
			<div id="nologin">
	         <table align="center" width="98%" border="0" cellspacing="0" cellpadding="0">
				  <tr>
					<td height="25">用户名：
					<input name="TxtUserName" type="text" class="textbox" value="用户名/UID" id="TxtUserName" size="15" maxlength="20"/></td>
				  </tr>
				  <tr>
					<td height="25">密　码：
					<input name="TxtPassWord" type="password" class="textbox" value="******" id="TxtPassWord" size="16" maxlength="20"/></td>
				  </tr>
				  <tr{$ShowVerify}>
					<td height="25">验证码：
					<input name="TxtVerifyCode" maxlength="6" type="password" class="textbox" id="TxtVerifyCode" size="6">
					<img src="{$GetUserUrl}Plus/ValidateCode.aspx" border="0" style="cursor:hand" onclick="this.src='{$GetUserUrl}Plus/ValidateCode.aspx?t='+Math.random();" />
					</td>
				  </tr>
				  
				  <tr>
					<td height="25"><div align="center"><img src="{$GetUserUrl}user/images/losspass.gif" align="absmiddle"> <a href="{$GetUserUrl}user/GetPassword.aspx" target="_parent">忘记密码</a> <img src="{$GetUserUrl}user/images/mas.gif" align="absmiddle"> <a href="{$GetUserUrl}user/userreg.aspx" target="_parent">新会员注册</a>    </div></td>
				  </tr>
				  
				  <tr>
					<td height="25"><div align="center">
					  <input type="button" name="button1" class="inputButton" value="登录" onClick="CheckLogin()"/>
	                  <label>
					  <input name="ExpiresDate" type="checkbox" id="ExpiresDate" value="checkbox">永久登录</label>
					  </div></td>
				  </tr>
				</table>
		 </div>
    </div>
	 ]]>

 </direction>
 <direction name="Horizontal">
  <![CDATA[
  <div id="loginForm">
    <div id="haslogin"></div>
	 <div id="nologin">
		 <span style="float:left"><a href="/user/login.aspx" class="loginbtn" onFocus="this.blur()">登录</a>|<a href="/user/userreg.aspx" class="regbtn" onFocus="this.blur()">注册</a></span>
	 	<!--
			   用户名:<input name="TxtUserName" type="text" class="username" id="TxtUserName" size="10" maxlength="20" value="用户名/UID"/> 密码:<input name="TxtPassWord" type="password" class="password" id="TxtPassWord" size="10" maxlength="20" value="******"/>
			   <span{$ShowVerify}>验证码:<input name="TxtVerifyCode" maxlength="6" type="password" class="textbox" id="TxtVerifyCode" size="3" />
								<img src="{$GetUserUrl}Plus/ValidateCode.aspx" border="0" style="cursor:hand" onclick="this.src='{$GetUserUrl}Plus/ValidateCode.aspx?t='+Math.random();" /></span>
								<span style="display:none"><input name="ExpiresDate" type="checkbox" id="ExpiresDate" value="checkbox"></span>
			   <input type="submit" name="button1" class="loginbtn" value="登录" onClick="CheckLogin()"/>
			  <a href="{$GetUserUrl}user/userreg.aspx" target="_parent">注册</a> <a href="{$GetUserUrl}user/getpassword.aspx">忘记密码？</a>{$ShowApiLogin}-->
	  </div>
   </div>
     ]]>
 </direction>
 
 <loginjs>
	<![CDATA[
	<script>
	jQuery(document).ready(function(){
	  CheckIsLogin();
    });

	function CheckIsLogin()
	{ 
	    // jQuery("#nologin").hide();
		// jQuery("#haslogin").show();
		//jQuery("#haslogin").html("登录信息加载中...");
		
			 jQuery.ajax({
			  type:"POST",
			  datatype: "xml",
			  url:"{$GetInstallDir}plus/ajaxs.ashx",
			  data:"a=checkislogin",
			  success:IsLogin
			 });
	}
	function IsLogin(xml)
	{   
		 var islogin=jQuery(xml).find("login islogin").text();
		 if (islogin=='false'){
		  jQuery("#TxtUserName").focus(function(){
		    if (jQuery("#TxtUserName").val()=='用户名/UID') jQuery("#TxtUserName").val('');
		  });
		  jQuery("#TxtUserName").blur(function(){
		    if (jQuery("#TxtUserName").val()=='') jQuery("#TxtUserName").val('用户名/UID');
		  });
		  jQuery("#TxtPassWord").focus(function(){
		   if (jQuery("#TxtPassWord").val()=='******') jQuery("#TxtPassWord").val('');
		  });
		  jQuery("#TxtPassWord").blur(function(){
		   if (jQuery("#TxtPassWord").val()=='') jQuery("#TxtPassWord").val('******');
		  });
		  
		 jQuery("#nologin").show();
		 jQuery("#haslogin").hide();
		 }else{
	      jQuery("#nologin").hide();
		  jQuery("#haslogin").show();
		  var str="";
		  var logindirection="{$LoginDirection}";
		  str+="<div class='ulogin'><DIV onmouseover=\"document.getElementById('userbox').style.display = 'block';\" onmouseout=\"document.getElementById('abc').style.display = 'none';\"><b><span>欢迎您, </span>"+jQuery(xml).find("login username").text()+" </b><DIV id=\"userbox\" onmouseover=\"his.style.display = 'block';\" onmouseout=\"this.style.display = 'none'\" style='display:none'><dl><dt><a href='{$GetUserUrl}user' target='_blank'>会员</a></dt><dt style='border-bottom:0px'><a href='{$GetUserUrl}user/UserLoginOut.aspx' onclick=\"return(confirm('确定要退出吗？'))\">退出</a></dt></dl></DIV></DIV>";
		  if (logindirection=="Vertical"){
		  str+="<br/>";
		  str+=jQuery(xml).find("login point").text()+"<br/>";
		  str+=jQuery(xml).find("login message").text()+"<br/>";
		  str+="登录次数:"+jQuery(xml).find("login logintimes").text()+"次<br/>";
		  str+="【<a href='{$GetUserUrl}user/index.aspx'>会员中心</a>】【<a href='{$GetUserUrl}user/UserLoginOut.aspx'>退出登录</a>】";
		  str+="</div>"
		  }else{
		   str+=""
		  }
		  jQuery("#haslogin").html(str);
		 }
	}
	function CheckLogin()
	{
	     if (jQuery("#TxtUserName").val()==''||jQuery("#TxtUserName").val()=='用户名/UID')
		 {
		  jQuery.dialog.alert("请输入会员登录名称!",function(){
		  jQuery("#TxtUserName").focus();
		  });
		  return false;
		 }
	     if (jQuery("#TxtPassWord").val()==''||jQuery("#TxtPassWord").val()=='******')
		 {
		  jQuery.dialog.alert("请输入会员登录密码!",function(){
		  jQuery("#TxtPassWord").focus();
		  });
		  return false;
		 }
		 if (jQuery("#TxtPassWord").val().length<6)
		 {
		  jQuery.dialog.alert("登录密码长度不能少于6位!",function(){
		  jQuery("#TxtPassWord").focus();
		  });
		  return false;
		 }
		 if ({$CheckVerifyCode}){
			 if (jQuery("#TxtVerifyCode").val()=='')
			 {
			  jQuery.dialog.alert("请输入验证码!",function(){
			  jQuery("#TxtVerifyCode").focus();
			  });
			  return false;
			 }
		 }
		 var ExpiresDate=0;
		 if (jQuery("#ExpiresDate").attr("checked")==true)  ExpiresDate=1;
		 jQuery.ajax({
		  type:"POST",
		  processData: false,
		  url:"{$GetInstallDir}plus/ajaxs.ashx",
		  data:"a=checklogin&username="+jQuery("#TxtUserName").val()+"&password="+jQuery("#TxtPassWord").val()+"&ExpiresDate="+ExpiresDate+"&verifycode="+jQuery("#TxtVerifyCode").val(),
		  success:function(xml)
		  { 
			if (jQuery(xml).find("login success").text()=="True")
			{
			  CheckIsLogin()
			}else{
			 jQuery.dialog.alert(jQuery(xml).find("login message").text());
			}
		  }
		 });
	  }
	</script>
 ]]>
  </loginjs>
</logintemplate>