function login(fn)
{
	_a = _BASE+'';
	var fr = document.forms[0];
	if(fn==1)
	{
		var usernameparent = e('usernameparent');
		var passwordparent = e('passwordparent');
		usernameparent.style.border = '0px';
		passwordparent.style.border = '0px';
	}
	else if(fn==2)
	{
		var usernameparent = fr.username;
		var passwordparent = fr.password;
		usernameparent.style.border = 'solid 1px #999999';
		passwordparent.style.border = 'solid 1px #999999';
	}
	
	if(fr.username.value=='')
	{
		usernameparent.style.border = 'solid #FF0000 2px';
		alert('نام کاربری را وارد نمائید');
		fr.username.select();
		return;
	}
	if(fr.password.value=='')
	{
		passwordparent.style.border = 'solid #FF0000 2px';
		alert('پسورد خود را وارد نمائید');
		fr.password.select();
		return;
	}
	
	var oForm = fr;
	var oCallback = {
	success: function (oResponse) {
		GRUBt = 0;
	//--
	var i = oResponse.responseText;
	////alert(i)
	var is = i.split('______');
	if(is[0]=='0')
	{
		e('login1').style.display = 'block';
		e('login2').style.display = 'none';
		if(is[1]=='0')
		{
			usernameparent.style.border = 'solid #FF0000 2px';
			alert('این نام کاربری وجود ندارد\n\nthis username not exist');
			fr.username.select();
		}
		else if(is[1]=='1')
		{
			passwordparent.style.border = 'solid #FF0000 2px';
			alert('پسورد اشتباه میباشد\n\nwrong password');
			fr.password.select();
		}
		return;
	}
	else if(is[0]=='0')
	{
		e('login1').style.display = 'block';
		e('login2').style.display = 'none';
		usernameparent.style.border = 'solid #FF0000 2px';
		passwordparent.style.border = 'solid #FF0000 2px';
		alert('نام کاربری یا پسورد اشتباه میباشد');
		fr.username.select();
		return;
	}
	else if(is[0] > 0)
	{
		if(is[5].length > 2)
		{
			//window.location = _BASE+''+is[5];
		}
		else
		{
			window.location = _BASE+'desk/';
		}
	}
	//--
	},failure: function (oResponse) {
		GRUBt = 0;
	saveResult($SEND_RECEIVE_PROBLEM);
	e('login1').style.display = 'block';
		e('login2').style.display = 'none';}, timeout: _TillABORT};
	//saveResult("An error occurred: " + oResponse.statusText);}};
	YAHOO.util.Connect.setForm(oForm);
	e('login1').style.display = 'none';
	e('login2').style.display = 'block';
	GRUBe = 'GRub';
	GRUBt = _TillABORT/1000;
	grub();
	YAHOO.util.Connect.asyncRequest("POST", _a, oCallback); 
}
function sendpass()
{
	_a = _BASE+'';
	document.forms[1].username.style.border = 'solid 1px #999999';
	document.forms[1].email.style.border = 'solid 1px #999999';
	if(document.forms[1].username.value=='')
	{
		document.forms[1].username.style.border = 'solid #FF0000 2px';
		alert('نام کاربری را وارد نمائید');
		document.forms[1].username.select();
		return;
	}
	if(document.forms[1].email.value=='')
	{
		document.forms[1].email.style.border = 'solid #FF0000 2px';
		alert('ایمیل خود را وارد نمائید');
		document.forms[1].email.select();
		return;
	}
	
	var oForm = document.forms[1];
	var oCallback = {
	success: function (oResponse) {
	//--
	GRUBt = 0;
	var i = oResponse.responseText;
	////alert(i)
	var is = i.split('______');
	if(is[0]=='0')
	{
		e('login3').style.display = 'block';
		e('login4').style.display = 'none';
		if(is[1]=='0')
		{
			document.forms[1].username.style.border = 'solid #FF0000 2px';
			alert('این نام کاربری وجود ندارد\n\nthis username not exist');
			document.forms[1].username.select();
		}
		else if(is[1]=='1')
		{
			document.forms[1].email.style.border = 'solid #FF0000 2px';
			alert('ایمیل اشتباه میباشد\n\nwrong email');
			document.forms[1].email.select();
		}
		return;
	}
	else if(is[0]=='0')
	{
		e('login1').style.display = 'block';
		e('login2').style.display = 'none';
		document.forms[0].username.style.border = 'solid #FF0000 2px';
		document.forms[0].password.style.border = 'solid #FF0000 2px';
		alert('نام کاربری یا پسورد اشتباه میباشد');
		document.forms[1].username.select();
		return;
	}
	else if(is[0] > 0)
	{
		e('login4').innerHTML = '<div dir="rtl" align="center" style="padding-top:10px;padding-bottom:10px;line-height:23px">پسورد شما به ایمیلتان ارسال شد<br />دقت کنید که احتمال دارد پسورد شما به قسمت Spam در ایمیل شما رفته باشد</div>';
	}
	//--
	},failure: function (oResponse) {
		GRUBt = 0;
	saveResult($SEND_RECEIVE_PROBLEM);}, timeout: _TillABORT};
	YAHOO.util.Connect.setForm(oForm);
	e('login3').style.display = 'none';
	e('login4').style.display = 'block';
	GRUBe = 'GRub2';
	GRUBt = _TillABORT/1000;
	grub();
	YAHOO.util.Connect.asyncRequest("POST", _a, oCallback); 
}
function recoverpass()
{
	e('login_b').style.display = 'block';
	e('login_a').style.display = 'none';
}