function open_w(URL,info,w,h){
 var x = (window.screen.width - w)/2;
 var y = (window.screen.height - h) /2.5; 
www=window.open(URL,info,'width='+w+',height='+h+',top='+y+',left='+x+',toolbar=no,personalbar=no,location=no,directories=no,statusbar=no,menubar=no,status=no,resizable=no');
}
function full_image(URL,w,h){
www=window.open('','','width='+w+',height='+h+',top=120,left=245,toolbar=no,personalbar=no,location=no,directories=no,statusbar=no,menubar=no,status=no,resizable=no');
www.document.write('<html><head><title>Çîáðàæåííÿ</title></head><body style="margin:0px;padding:0px"><img src="fotos/',URL,'"></body></html>');
www.focus;
}

function kub_change(i){
document.getElementById("kub"+i).src = "images/kub_o.png"; 
}
function kub_rest(i){
document.getElementById("kub"+i).src = "images/kub.png"; 
}

function check_num(digit,alpha){
if(window.event.keyCode==45 || window.event.keyCode==46)
return true;
if (window.event.keyCode>43 && window.event.keyCode<58){ 
if(digit){
	if(window.event.keyCode==44){
		window.event.srcElement.value+="."
		window.event.returnValue=false;
 	}else	window.event.returnValue=true;
}else window.event.returnValue=false;

}else{
if(alpha)window.event.returnValue=true;
else window.event.returnValue=false;
     }

}

function change_search(ths) {
 if(ths.order_how.value==1){
ths.order_how.value=0
document.order_img.src="images/up.gif"
document.order_img.alt="ñîðòóâàòè ïî çðîñòàííþ"
 }else{
ths.order_how.value=1
document.order_img.src="images/down.gif"
document.order_img.alt="ñîðòóâàòè ïî ñïàäàííþ"
 }
}


function correct_form(form){
var num_p=3;
var num_b=3;
choice=form.type.selectedIndex;
if(form.type.options[choice].value=="pers"){
for(i=1;i<num_p;i++)
document.getElementById("pers_"+i).style.display = "";
for(i=1;i<num_b;i++)
document.getElementById("buro_"+i).style.display = "none";
}else{
for(i=1;i<num_p;i++)
document.getElementById("pers_"+i).style.display = "none";
for(i=1;i<num_b;i++)
document.getElementById("buro_"+i).style.display = "";}
}

function check_reg(form){
err=0;
if (!form.login.value) { alert('Ââåä³òü âàø ëîã³í!'); err=1; }
else if (!form.pass.value) { alert('Ââåä³òü âàø ïàðîëü!'); err=1; }
else if (form.pass.value!=form.pass1.value) { alert('Ïàðîë³ íå ñï³âïàäàþòü!'); err=1; }
else if (!form.email.value&&!form.phone.value) { alert('Ââåä³òü âàø E-mail àáî òåëåôîí!'); err=1; }
if(err)return false;
else return true
}

function check_add_apt(form){
err=0;
if (!form.city.value) { alert('Ââåä³òü ì³ñòî!'); err=1; }
else if (!form.addr.value) { alert('Ââåä³òü âóëèöþ!'); err=1; }
else if (!form.num_rooms.value) { alert('Ââåä³òü ê³ëüê³ñòü ê³ìíàò!'); err=1; }
else if (form.square_all.value=="0") { alert('Ââåä³òü õî÷à á çàãàëüíó ïëîùó!'); err=1; }
else if (!form.price.value) { alert('Ââåä³òü ö³íó!'); err=1; }
if(err)return false;
else{
form.s_but.value="çà÷åêàéòå...";
form.s_but.disabled=true;
return true;}
}

function check_login(form){
err=0;
if (!form.login.value) { alert('Ââåä³òü âàø ëîã³í!'); err=1; }
else if (!form.pass.value) { alert('Ââåä³òü âàø ïàðîëü!'); err=1; }
if(err)return false;
else return true
}

function change(url){
location.href=url+"?height="+screen.height;
}


function close_it(){
www.close();}
