﻿//用户名 
var UserNameKey = 'hnrcUserName';
var NickNameKey = 'hnrcNickName';
var UserTypeKey = 'hnrcUserType';

function submit_check(t0)
{
	if(t0.username.value == ''){
		alert('请输入用户名');
		t0.username.focus();
		return false;
	}
	if(t0.password.value == ''){
		alert('请输入密码');
		t0.password.focus();
		return false;
	}
}
function showLogin()
{
	var UserName = GetCookieVal(UserNameKey);
	//alert(UserName);
	if(UserName =='' || UserName == null)
	{
		document.write("            <form name=\"login\" method=\"post\" action=\"/zpasp/login.asp?action=login\" onsubmit=\"return submit_check(this)\">");
		document.write("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"margin-top:2px; margin-left:16px;\">");
		document.write("  <tr>");
		document.write("	<td width=\"50\" height=\"28\"> 用户名： </td>");
		document.write("	<td width=\"160\"><label>");
		document.write("	  <input class=\"input2\" type=\"text\" name=\"username\" tabindex=\"1\" />");
		document.write("	</label></td>");
		document.write("	<td><a href=\"/zpasp/person/reg.asp\" target=\"_blank\"><img src=\"httP://pic.ynrs.com/in_reg1.jpg\" /></a></td>");
		document.write("  </tr>");
		document.write("  <tr>");
		document.write("	<td height=\"28\"> 密 &nbsp;码： </td>");
		document.write("	<td>");
		document.write("	  <label>");
		document.write("	  <input type=\"password\" class=\"input2\" name=\"password\" tabindex=\"2\" />");
		document.write("	  </label></td>");
		document.write("	<td><a href=\"/zpasp/company/reg.asp\" target=\"_blank\"><img src=\"httP://pic.ynrs.com/in_reg2.jpg\" /></a></td>");
		document.write("  </tr>");
		document.write("  <tr>");
		document.write("	<td></td>");
		document.write("	<td>");
		document.write("	  <label>");
		document.write("	  <input type=\"image\" src=\"/images/button_03.jpg\" name=\"Submit\" value=\"提交\" />");
		document.write("	  </label>					</td>");
		document.write("	<td><label> </label>");
		document.write("	  <a href=\"zpasp/my_pass.asp\" class=\"L_gray_12_n\"> [找回密码] </a></td>");
		document.write("  </tr>");
		document.write("</table>");
		document.write("              </form>");
	}
	else
	{
		var NickName = GetCookieVal(NickNameKey);
		//alert(NickName);
		NickName = DecodeCookie(NickName);
		//alert(NickName);
		if (NickName!=''){
			NickName = '您好：<font color=\"red\">'+ NickName +'</font>';
		}else{
			NickName = '您好,';
		}
		var UserType = GetCookieVal(UserTypeKey);
		var strText = '个人会员';
		var strLink = '/zpasp/person/';
		if(UserType == 2)
		{
			strText = '企业会员';
		    strLink = '/zpasp/company/';
		}
		document.write("              <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"margin-top:18px; margin-left:16px;\">");
		document.write("                  <tr>");
		document.write("                    <td height=\"28\">"+ NickName +" &nbsp;欢迎访问昆明招聘网！</td>");
		document.write("                    </tr>");
		document.write("                  <tr>");
		document.write("                    <td height=\"28\"><a href=\""+ strLink +"\" target=\"_blank\">立即进入"+ strText +"的管理平台</a></td>");
		document.write("                    </tr>");
		document.write("                  <tr>");
		document.write("                    <td align=\"left\"><a href=\"/zpasp/login.asp?action=logout&reurl=/index.html\" class=\"L_gray_12\">[安全退出]</a></td>");
		document.write("                    </tr>");
		document.write("              </table>");

	}
}

function GetCookieVal(sName)
{
	var aCookie = document.cookie.split("; ");
	for (var i=0; i < aCookie.length; i++)
	{
	   var aCrumb = aCookie[i].split("=");
	   if (sName == aCrumb[0]) 
	   {
		if (aCrumb.length > 1 )
		 return unescape(aCrumb[1]);
		else
		 return "";
	   }
	}
	return null;
}

function DecodeCookie(str) 
{ 
　var strArr; 
　var strRtn=""; 
　strArr=str.split("*"); 
　for (var i=strArr.length-1;i>=0;i--) 
　strRtn+=String.fromCharCode(eval(strArr[i])); 
　return strRtn; 
}