


function avtoriz_v(){
	var DF=document.getElementById("AVTORIZACIYA_FON");
	DF.style.width=document.body.scrollWidth;
	DF.style.height=document.body.scrollHeight;
	DF.style.visibility="visible";

	var AT=document.getElementById("A_T");
	var pL=(document.body.scrollWidth-260)/2;
	var pT=(document.body.clientHeight/2)-140;
	AT.style.left=pL;
	AT.style.top=pT;
	AT.style.visibility="visible";
}

function avtoriz_h(){
	var DF=document.getElementById("AVTORIZACIYA_FON");
	var AT=document.getElementById("A_T");
	AT.style.visibility="hidden";
	DF.style.visibility="hidden";
}
function access_vac(forma){
	mail=forma.elements['LOGIN'].value;
 	var re= RegExp(/^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$/i);
 	var val=re.test(mail);
	if(!val) {alert("Некорректный логин"); return false;}
	
	if(forma.elements['PASSWORD'].value.length<=3){alert("Некорректный пароль"); return false;}
	
	requestLP(forma.elements['LOGIN'].value,forma.elements['PASSWORD'].value);
	
}

function requestLP(login,password){
	xmlHTTP=new XMLHttpRequest();
	if(xmlHTTP==null){xmlHTTP=new ActiveXObject('Msxml2.XMLHTTP')};
	if(xmlHTTP==null){xmlHTTP=new ActiveXObject('Microsoft.XMLHTTP')};

	xmlHTTP.open('POST','vacancy/access.php?LOGIN='+login+'&PASSWORD='+password,'false');
	xmlHTTP.onreadystatechange=func_ref;
	xmlHTTP.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xmlHTTP.send('LOGIN='+login+'&PASSWORD='+password);
}

function func_ref(){
	if(xmlHTTP.readyState==4) {
		if(xmlHTTP.responseText=="0"){location.href="vacancy.php";}
		else if(xmlHTTP.responseText=="1"){alert("Работодатель не зарегистрирован");}
		else{location.href="index.php";}
//alert(xmlHTTP.responseText);
	}
}
	