<!--#include file="_header.html" -->
<script language="javascript" type="text/javascript" src="templates/scripts/dvajax.js"></script>
<script type="text/javascript" language="javascript">
//按钮是否可用
function disbutton()
{
	var name = $('name');
	var password = $('password');
	var verify = $('verification');  
	var button = $('btnLogin');

	if(name.value!='' && ((verify != null) ? password.value!='' : true))
	{
		button.disabled = false;
	}
	else
	{
		button.disabled = true;
	}
}
function ShowMess() 
{ 
 var str_userID = document.getElementById('name').value; 
   var check_result = document.getElementById('result'); 
  if(str_userID!="")
  {
	var dvajax = new DvAjax();
	check_result.innerHTML = '正在检测会员呢称合法性...';
	dvajax.Request("get","user_chkname.aspx",'name='+str_userID+'&option=log',function (xmlhttp){
	var ret_Text = xmlhttp.responseText;
	check_result.innerHTML = ret_Text;
	},true);
   }
}
/*AJAX登录处理部分,请不要擅自修改*/
var trylogins=<%=UserHandler.GetTryLogins()%>; //超过三次就出现验证码
function loginbbs()
{
    var username = $('name').value; 
    var password=$('password').value;
    var isverify=<%=IsShowVerifyCode.ToString().ToLower()%>; //是否要求验证码
    if(isverify || parseInt(trylogins)>=3)
    {      
      var verification=$('verification').value;    
    } 
   
    var savedays=$('savedays').value;
    var refurl=$('refurl').value;    
    if(refurl=='' || refurl.indexOf('prompt.aspx')!=-1)
    {
      refurl='index.aspx';
    }
    var logintip = $('logintip');
    logintip.style.display='';
    //验证输入信息
    logintip.innerHTML='<p></p><b>登录状态：</b>正在登录，请稍候!';
    if(username.trim()=='' || password.trim()=='' || ((isverify || parseInt(trylogins)>=3)?verification.trim()=='':false))
	{
		logintip.innerHTML='<p></p><b>登录状态：</b>登录信息没有填写完整!';
		return false;
	}
	var dvajax = new DvAjax(); 	
	try
	{
	  var data='?name='+escape(username)+'&password='+escape(password)+'&posttype=1&savedays='+escape(savedays)+'&refurl='+escape(refurl);	
	   if(isverify || parseInt(trylogins)>=3)
	   {
	     data=data+'&verification='+escape(verification);
	   }		
		
		var resultobj=dvajax.Request('get','user_login.aspx'+data,'',null,true);
		
		var resultdata=resultobj.responseText;
		if(resultdata.indexOf('Success')!=-1)
		{					
		    var ReText = resultdata.split('|');
			var afterurl = ReText[1];
			//if(afterurl.indexOf('user_login.aspx')!=-1 || afterurl=='' || afterurl==null || afterurl.indexOf('user_reg.aspx')!=-1 || afterurl.indexOf('user_getback')!=-1)
			if(afterurl.indexOf('user_login.aspx')!=-1 || afterurl=='' || afterurl==null || afterurl.indexOf('user_reg.aspx')!=-1 || afterurl.indexOf('user_getback')!=-1)
			{
			  afterurl='index.aspx';
			}
			dvajax.Dispose();
			dvajax=null;
//			try{
//			    var urls = unescape(ReText[2]);
//			    while(-1 != urls.indexOf('+')){
//			      urls = urls.replace('+',' ');
//			    }
//			    window.document.body.innerHTML = urls;
//		    	alert(urls); 
//		    	window.document.write(urls);
//		    	var k=0;
//		    	while(k<10000) k++;
//			}catch (e){}
			location.href = afterurl;
			//location.href=afterurl;
		}
		else
		{					
			logintip.innerHTML='<p></p><b>登录状态：</b>登录失败,请重新登录！';	
			trylogins=parseInt(trylogins)+1;	 //失败一次，登录次数＋１	
			if(parseInt(trylogins)>=3)
			{
			  $('verifyinput').style.display='block';
			  $('verifycodetip').style.display='block';
			}
			dvajax.Dispose();
			dvajax=null;
		}
	}
	finally
	{
		if(dvajax!=null)
		{
			dvajax.Dispose();
			dvajax=null;
		}
	}
	return false;
}
/*end ajax登录处理*/
</script>
<div class="mainbox">
<div class="notice">
			<span>
				<a href=""><!--#include file="_nav.html"--></span>

</div>
</div>
<div style="clear:both"></div>
<form name="frmLogin" id="frmLogin"  onsubmit="return loginbbs();">
	<input name="refurl" id="refurl" type="hidden" value="<%=Fetch.Referrer%>" />
	<div class="mainbox">		
			<div class="page_right" style="margin:0px; width:270px;height:100%; border:0px;">
				<div class="leftcolor" style=" background:#F4FCEE;line-height:25px;"><br />
					<span class="font14 username">还不是本站用户？</span>
					<span class="username">那还等什么？赶紧注册吧！</span>
					<span>
						<button type="button" onMousemove="this.className='button_on'" onMouseout="this.className='button'" ID="Button1"
							onclick="location.href='user_reg.aspx'"> 立即注册成为本站会员 </button>
					</span><br />
					<br />
				</div>
			</div>
		<ul class="tableborder heightd page_left2">
			<h3 class="titlebig">用户登录</h3>
			<div id="tips" style="width:200px;position:absolute;border:1px solid #CFBA67;padding:0px 3px;color:gray;display:none;overflow:hidden;line-height:24px; margin-left:26px; background:#FFFFE6 url(templates/<%=CurrentTemplateName%>/images/icon_warning.gif) no-repeat; text-indent:20px;z-index:2;"></div>
			<li>
				<p class="font14">用户名</p>
				<input name="name" id="name" type="text" tabindex="1" onFocus="IEvent('focus',this);tips(this,'输入您的用户名')"	onBlur="IEvent('blur',this);outtips();;ShowMess()" onMouseOver="IEvent('mouseover',this)" onMouseOut="IEvent('mouseout',this)" />
				<span id="result"></span>
			</li>
			<li>
				<p class="font14">密码</p>
				<input name="password" id="password" tabindex="2" type="password" onFocus="IEvent('focus',this);tips(this,'输入您的密码')"
					onBlur="IEvent('blur',this);outtips();" onMouseOver="IEvent('mouseover',this)"
					onMouseOut="IEvent('mouseout',this)" />
			</li>
			<br />			
			<li id="verifyinput" style="display:<%=IsShowVerifyCode?"block":"none"%>">
				<p class="font14">验证码</p>
				<input name="verification" id="verification" type="text" tabindex="3" size="10" maxlength="6"
					autocomplete="Off" onFocus="IEvent('focus',this);tips(this,'请下图上的说明输入字符串',63);" onBlur="IEvent('blur',this);outtips();"
					onMouseOver="IEvent('mouseover',this)" onMouseOut="IEvent('mouseout',this)" />
			</li>
			<li id="verifycodetip" style="height:75px;display:<%=IsShowVerifyCode?"block":"none"%>">
				<table width="auto" height="auto" border="0" cellpadding="0" cellspacing="0" id="Table1"
					style=" display:block;border:1px solid #D4E2EA; margin:0px; padding:0px;margin-top:4px;border-top:none; margin-left:158px"
					name="verification_table">
					<tr>
						<td style="margin:0px; padding:0px"><script language='javascript'>document.write("<img src='<%=Fetch.ValidateCodeFileName%>?time=", new Date(), "' alt='验证码图片, 看不清数字请点击刷新' border='0' style='cursor:hand; margin-top:-1px' onclick=\"this.src = this.src.substring(0, this.src.indexOf('time=')) + 'time=' + new Date()\"/>"); </script></td>
					</tr>
				</table>
			</li>			
			<li>
				<p class="font14">Cookie 选项</p>
				<select name="savedays" ID="savedays" tabindex="4">
				    <option value="-1">不保存，关闭浏览器就失效</option>
					<option value="1">保留一天</option>
					<option value="30">保留一月</option>
					<option value="365">保留一年</option>
				</select>
				请选择你的 Cookie 保存时间，下次访问可以自动登录。
			</li>
			<li>
				<p><input name="refurl" id="refurl" type="hidden" value="<%=Post("refurl")==string.Empty?Get("refurl"):Post("refurl")%>" /> </p>
				<a href="user_getback.aspx" style="font-size:14px;">忘记了您的密码?</a>
			</li>
			<li id="logintip" style="display:none">
			   <p></p>
			   登录状态：正在登录，请稍候!
			</li>
			<li>
				<p></p>
				<button class="button_off" ID="btnLogin" type="submit" tabindex="7"  onFocus="IEvent('focus',this)" onBlur="IEvent('blur',this)" onMouseOver="IEvent('mouseover',this)" onMouseOut="IEvent('mouseout',this)" />立即登录</button>
			</li>
			<li>
			</li>
		</ul>
	</div>
</form>
<!--#include file="_footer.html" -->