var mailImg=new Image();
mailImg.src='/img/template/mail.gif';

function userAuth()
{
	$('#authInformer').html('Проверка данных...');
	var postData='authLogin='+encodeURIComponent(document.getElementById('authLogin').value)+'&';
	postData+='authPassword='+encodeURIComponent(document.getElementById('authPassword').value);
	AJAXQuery('userLogin','POST','/system/scripts/relay.php?relayID=UserCenter&auth=1&siteID=1&inputType=ajax&s='+sessionID,'eval:userAuthProcess',postData,'Content-Type*$*application/x-www-form-urlencoded');
	return false;
}
function userAuthProcess(result)
{
	if(result!=='')
	{
		window.eval(result);
		if(authResult)
		{
			if(authResult.result) window.location.reload();
			else $('#authInformer').html('<span style="color:red">'+authResult.resultMesage+'</span>');
		}
	}
}

function recoveryPassword()
{
	var inputEmail=document.getElementById('authEmail').value;
	if (inputEmail!=='' && inputEmail!==0 && inputEmail!==null)
	{
		$('#authInformer').html('Загрузка данных...');
		AJAXQuery('recoveryPassword','POST','/system/scripts/relay.php?relayID=UserCenter&recoveryPassword=1&siteID=1','eval:recoveryPasswordProcess','email='+encodeURIComponent(inputEmail),'Content-Type*$*application/x-www-form-urlencoded');
	}
	return false;
}
function recoveryPasswordProcess(result) { $('#authInformer').html(result); }

function exit() { window.location.href='/system/scripts/relay.php?relayID=UserCenter&exit=1&siteID=1&url='+encodeURIComponent(window.location.href); }

var checkNewMailInterval=null;
WBJSLoader.add('checkNewMailInterval=setInterval("checkNewMail()",5000);$("#internalMailStatus").html(" <i>загрузка...</i>")');

function checkNewMail() { AJAXQuery('checkNewMail','GET','/system/services/strokov.php?checkNewMail=1&s='+sessionID,'eval:checkNewMailProcess'); }
function checkNewMailProcess(result)
{
	clearInterval(checkNewMailInterval);
	if(result!=='') window.eval(result);
	if(resultObj)
	{
		if(resultObj.newMessageCnt>0) $('#internalMailStatus').html('<img src="/img/template/mail.gif" width="10" height="8" alt="" /><b class="redA">'+resultObj.newMessageCnt+' новых</b>');
		else $('#internalMailStatus').html('');
		if(resultObj.repeat) checkNewMailInterval=setInterval("checkNewMail()",120000);
	}
}
