function getIDFromCookie() {
	var userId = getCookie("saveId");
	if ( userId != null && userId != ""  ) {
		document.loginform.userId.value = userId; 
		document.loginform.saveId.checked = true;
	}
} 

/*function initForm(){
	var userId = getCookie("saveId");
	if( userId != null )
		document.loginform.passWd.focus();
	else
		document.loginform.userId.focus();
}*/


function loginCheckForm(){
	var form = document.loginform;
	if( form.userId.value == '请输入用户名' || form.userId.value == '')
	{
		m_alert('请输入用名');
		form.userId.focus();
		return;
	}
	if( form.passWd.value == '')
	{
		m_alert('请输入密码');
		form.passWd.focus();
		return;
	}
	
	//if saveId checked?
	var domain = "linketu.com";
	if ( form.saveId.checked ){
		var userId = form.userId.value;
		setCookie("saveId", userId, true, domain, "/");
		setCookie("savePwd", MD5(form.passWd.value), true, domain, "/");
	} else {
		setCookie("saveId", "", true, domain, "/");
		setCookie("savePwd", MD5(form.passWd.value), true, domain, "/");
	}
	// convert passwd by md5
	form.passWd.value = MD5(form.passWd.value);	
	var id,pwd;
	id = form.userId.value;
	pwd = form.passWd.value;
	form.submit();
}

function fpwd_show(msg)
{
	
	var html='<div style=" width:490px;height:160px;background-color:#465567;">';
	html+='<div style="padding-left:5px;padding-right:5px;font-size:12px;">';
	html+='<div style="float:left;padding-left:11px;line-height:30px;color:#ffffff;font-weight: bold;">找回密码</div>';
	html+='<div style="float:right;padding-top:10px;padding-right:10px;padding-bottom:9px;"><img  onclick="fpwd_close()" style="cursor:pointer"src="'+imgUrl+'/common/images/pop/close.gif"></div>';
	html+='<div style="float:left;width:480px;height:125px;background-color:#ffffff;color:#666666;">';
	html+='<div style="float:left;width:470px;padding:10px;line-height:18px;">';
	html+='还记得在注册邻客图时输入的邮箱地址码？<br>';
	html+='请正确输入邮箱地址，我们会往您的邮箱里发送密码找回链接。</div>';
	html+='<div style="float:left;width:470px;padding-left:10px;padding-right:10px;">';
	html+='<div style="float:left; width:455px;  border:1px solid #D3D3D3; padding-top:10px;">';
	html+='<div style="float:left;font-size:12px;color:#999999;width:40px;height:23px;line-height:23px;';
	html+='padding-left:10px;">邮箱</div>';
	html+='<div style="float:left;font-size:12px;color:#999999;padding-bottom:10px;width:330px;height:23px;line-height:23px;">';
	html+='<input name="femail" id="femail" type="text" style="width:320px;height:19px;border:1px solid #D3D3D3;background-color:#FFFFFF;" /></div>';
	html+='<div style="float:left;width:62px;height:21px;margin-right:5px;border:1px solid D3D3D3;">';
	html+='<div onclick="findpass()" style="cursor:pointer;text-align:center;font-size:12px;color:#666666;width:60px;height:16px;padding-top:3px;background:url('+imgUrl+'/common/images/pop/bet_bg.gif) repeat;border:1px solid #ffffff;">确定';
	html+='</div></div>';
	if($.trim(msg) == '')
		html+='<div id="emailcheck" style="margin-left:50px;_margin-left:25px;line-height:18px;width:300px;float:left;color:red;display:none"></div>';
	if($.trim(msg) != '')
		html+='<div id="emailcheck" style="margin-left:50px;_margin-left:25px;line-height:18px;width:300px;float:left;color:red;">'+msg+'</div>';
	html+='</div></div></div></div></div>';
	var w = $(document).width();
	var left = 0;
	left = (w - 490) / 2;
	$("#findpwd").html(html).css({position:'absolute',
		left: left,
		top: $(document).scrollTop() + 250
	}).show();
	
}
function findpass()
{
	var email=$.trim($("#femail").val());
	if($.trim(email) == '')
	{
		$("#emailcheck").show();
		$('#emailcheck').html("请输入邮箱地址");	
		return;
	}
	
	var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if(!filter.test(email))
	{
		$("#emailcheck").show();
		$('#emailcheck').html("邮箱格式错误");	
		return;
	}
	
	var url=wwwUrl+"/findpass.zul?m=checkid&femail="+email;
	$("#findpwd").load(url);
}
function fpwd_close()
{
	$("#findpwd").html("").hide();
}

