﻿//用户名 
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("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"margin-left:5px;\">");
	    document.write("            <form name=\"login\" method=\"post\" action=\"http://www.ynrcsc.com/ynrcscnet/login.asp?action=login\" onsubmit=\"return submit_check(this)\">");
		document.write("  <tr>");
		document.write("	<td width=\"50\" height=\"28\"> 用户名： </td>");
		document.write("	<td width=\"115\"><label>");
		document.write("	  <input type=\"text\" name=\"username\" tabindex=\"1\" size=\"17\" />");
		document.write("	</label></td>");
		document.write("	<td rowspan=\"2\"><table width=\"100%\" height=\"65\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
		document.write("   <tr>");
		document.write("	<td rowspan=\"3\"><a href=\"/reg.asp\" target=\"_blank\">培训机构注册</a></td>");
		document.write("	</tr>");
		document.write("	</table>");
		document.write("  </tr>");
		document.write("  <tr>");
		document.write("	<td height=\"28\"> 密 &nbsp;码： </td>");
		document.write("	<td>");
		document.write("	  <label>");
		document.write("	  <input type=\"password\" name=\"password\" tabindex=\"2\" size=\"17\" />");
		document.write("	  </label></td>");
		document.write("  </tr>");
		document.write("  <tr>");
		document.write("	<td colspan=\"2\">");
		document.write("	  <label>");
		document.write("	  <input type=\"image\" src=\"http://www.ynrcsc.com/images/button_03.jpg\" name=\"Submit\" value=\"提交\" />");
		document.write("	  </label>					</td>");
		document.write("	<td><label> </label>");
		document.write("	  <a href=\"http://www.ynrcsc.com/ynrcscnet/my_pass.asp\" class=\"L_gray_12_n\"> [找回密码] </a></td>");
		document.write("  </tr>");
		document.write("</form>");
		document.write("</table>");

	}
	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 = 'http://www.ynrcsc.com/ynrcscnet/person/';
		if(UserType == 2)
		{
			strText = '企业会员';
		    strLink = 'http://www.ynrcsc.com/ynrcscnet/company/';
		}
		else if(UserType == 3)
		{
			strText = '培训机构';
		    strLink = 'http://kp.ynrcsc.com/usermin.asp';
		}
		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=\"http://www.ynrcsc.com/ynrcscnet/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; 
}