//2004-9-7胡勇刚修改:OpeRegWin函数中页面地址修改到新的注册页面
var Action='';
var queryStr='';
var ClearTimerID = 0;

//登录处理函数
function login(frm)
{
	if (!login_Validation()) return false;		
	//window.open('','cjolPersonLoginAndRegister','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=790,height=545');
	var urlStr =  '/JobSeeker/Include/LoginCheck.asp?Language='+LANGUAGE+'&'+queryStr+'&ran='+Math.random();
	frm.action = urlStr;

	ClearTimerID = window.setTimeout("ResetAll();", 5000);
	return true;
}

function cancelClearTimer()
{
	if(ClearTimerID)window.clearTimeout(ClearTimerID);
}

//登录校验处理函数
function login_Validation()
{
   if (!RuleTest(UserID_Rule,document.all.UserID.value,document.all.UserID))
		return false;
   if (!RuleTest(BlankPassword_Rule,document.all.Password.value!='',document.all.Password))
		return false;
	return true;
}

function ResetAll()
{
	document.all.UserID.value='';
	document.all.Password.value='';	
}
//取回密码
function getPassword(strLanguage)
{
	if (strLanguage!='EN')
	{
		OpenIFrameDialog('/main/jobseeker/RetakePassword.htm','','dialogHeight: 250px; dialogWidth: 360px; edge: Raised; center:Yes;resizable: No; status: No;help:no');
	}
	else
	{
		OpenIFrameDialog('/main/jobseeker/en/forgetpassword.htm','','dialogHeight: 250px; dialogWidth: 360px; edge: Raised; center:Yes;resizable: No; status: No;help:no');
	}
}

//注册
//2005-7-18 Gage修改:在URL后加上Source参数,统计简历来源用
function openRegWin(strLanguage)
{

	if (strLanguage!='EN')
	{
		var regwin = window.open('/JobSeeker/CN/Register/RegisterFrame.htm?Source='+escape(location.href),'cjolPersonLoginAndRegister','toolbar=no,center=yes,clocation=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=700,height=480','中国人才热线 - 找回密码','');
	}
	else
	{
		var regwin = window.open('/JobSeeker/EN/Register/RegisterFrame.htm?Source='+escape(location.href),'cjolPersonLoginAndRegister','toolbar=no,center=yes,clocation=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=700,height=480');	
	}
	try
	{
		checkPopWin(regwin,"PopUpWindow_Reg");
	}
	catch(e){;}
}

/**
 * 登录时不能成功弹出窗口时提示
 * 2004-6-15, Gage
 */
function PopUpWindow(successful)
{
	if(successful) return;
	HTMLAlert("登录的窗口被其它软件拦截了,您可能不能正常登录!<br><br><a target='_blank' href='/v7test/sc/'><b>点这里检查问题</b></a>.","注意",0,250,200,true);
}
function PopUpWindow_Reg(successful)
{
	if(successful) return;
	var url = "/JobSeeker/CN/registernew/default.htm";
	HTMLAlert("注册的窗口被其它软件拦截了,<a target='_blank' href='" + url + "'><b>请点击这里进入注册页面</b></a>.","注意",0,250,200,true);
}

if (typeof(dialogArgs) != "function")
{
	dialogArgs = function()
	{
		this.url='';
		this.args='';
		this.title='';
	}
}
if(typeof(OpenIFrameDialog) != "function")
{
	OpenIFrameDialog = function(sUrl,sArgs,sParams,sCNTitle,sENTitle)
	{
		var argsObject=new dialogArgs();
		var str=window.location.href;
		var url='';
		if (sUrl.indexOf('/')==0){
			url=sUrl;
		}else
		{
			if (str.indexOf('?')>0)
			{
				str=str.substr(0,str.indexOf('?')+1)
			}
			str=str.substr(0,str.lastIndexOf('/')+1);
			url=str+sUrl;
		}
		argsObject.url=url;
		argsObject.args=sArgs;
		argsObject.title=(LANGUAGE=='CN')?sCNTitle:sENTitle;
		return window.showModalDialog('/Include/IFrame/Frame.htm?URL='+escape(argsObject.url),argsObject,sParams);
	}
}
