function createPictureWindow(Path,Width,Height,Title)
{
	var p = Math.ceil(Math.random()*10000);
	var q = Math.ceil(Math.random()*p);
	windowName = p+'X'+(Width*p)+(Height*q);
	WinFeatures = "top="+(screen.height-Height)/2+",left="+(screen.width-Width)/2+",width="+Width+",height="+Height+",Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=no";
	w = window.open("",windowName,WinFeatures);
	w.document.open();
	w.document.write('<head><title></title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>');
	w.document.write("<body bgcolor='#FFFFFF' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><img src='"+Path+"' height='"+Height+"' width='"+Width+"' alt='&quot;"+Title+"&quot;'></body>"); 
	w.document.close();
}

function createPrintWindow(Title)
{
	_content=document.getElementById('content').innerHTML;
	_location = this.location;
	var p = Math.ceil(Math.random()*10000);
	var q = Math.ceil(Math.random()*p);
	windowName = p+'X'+p+q;
	WinFeatures = "top=100,left=100,width=780,height=600,Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=yes";
	w = window.open("",windowName,WinFeatures);
	w.document.open();
	w.document.write('<html><head><title>'+Title+'</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><link rel="stylesheet" type="text/css" href="_system.style.css" title="style" /><script type="text/javascript" language="JavaScript" src="_system.dhtml.js"></script></head>');
	w.document.write('<body onload="window.print()" class="popup"><p><small>Адрес статьи: '+_location+'</small></p><h3>'+Title+'</h3>'+_content+'</body></html>'); 
	w.document.close();
}

function createMailToFriendWindow(Title)
{
	_location = this.location;
	var p = Math.ceil(Math.random()*10000);
	var q = Math.ceil(Math.random()*p);
	windowName = p+'X'+p+q;
	WinFeatures = "top=100,left=100,width=300,height=250,Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=auto";
	w = window.open("",windowName,WinFeatures);
	w.document.open();
	w.document.write('<html><head><title>'+Title+'</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><link rel="stylesheet" type="text/css" href="_system.style.css" title="style" /><script type="text/javascript" language="JavaScript" src="_system.dhtml.js"></script></head>');
	w.document.write('<body class="popup"><h3>'+Title+'</h3><p>Отправьте ссылку на эту страницу другу:</p><form name="mailtofriendForm">e-Mail друга:<br/><input name="field[fmail]" class="text" type="Text" style="width:250px; margin:0 0 5px 0;" /><br/>Ваше имя:<br/><input name="field[name]" class="text" type="Text" style="width:250px; margin:0 0 5px 0;" /><br/>Ваш e-Mail:<br/><input name="field[email]" class="text" type="Text" style="width:250px; margin:0 0 5px 0;" /><br/><input class="button" type="Submit" value="ОТПРАВИТЬ"><input type="hidden" name="url" value="'+_location+'"></form></body></html>');
	w.document.close();
}

function MakeImageArray(n)	{
	this.length=n; for (var i=0; i<=n; i++) this[i] = new Image(); return this
	}

button_home = new MakeImageArray(2);
button_home[0].src = "/pics/button_home.gif";
button_home[1].src = "/pics/button_home_a.gif";

button_mail = new MakeImageArray(2);
button_mail[0].src = "/pics/button_mail.gif";
button_mail[1].src = "/pics/button_mail_a.gif";

button_map = new MakeImageArray(2);
button_map[0].src = "/pics/button_map.gif";
button_map[1].src = "/pics/button_map_a.gif";

button_details = new MakeImageArray(2);
button_details[0].src = "/pics/button_details.gif";
button_details[1].src = "/pics/button_details_a.gif";

button_archive = new MakeImageArray(2);
button_archive[0].src = "/pics/button_archive.gif";
button_archive[1].src = "/pics/button_archive_a.gif";

button_alloffers = new MakeImageArray(2);
button_alloffers[0].src = "/pics/button_alloffers.gif";
button_alloffers[1].src = "/pics/button_alloffers_a.gif";

button_request = new MakeImageArray(2);
button_request[0].src = "/pics/button_request.gif";
button_request[1].src = "/pics/button_request_a.gif";

button_back = new MakeImageArray(2);
button_back[0].src = "/pics/button_back.gif";
button_back[1].src = "/pics/button_back_a.gif";

button_search = new MakeImageArray(2);
button_search[0].src = "/pics/button_search.gif";
button_search[1].src = "/pics/button_search_a.gif";

button_cancel = new MakeImageArray(2);
button_cancel[0].src = "/pics/button_cancel_ru.gif";
button_cancel[1].src = "/pics/button_cancela_ru.gif";

button_close = new MakeImageArray(2);
button_close[0].src = "/pics/button_close.gif";
button_close[1].src = "/pics/button_close_a.gif";

button_size = new MakeImageArray(2);
button_size[0].src = "/pics/button_size.gif";
button_size[1].src = "/pics/button_size_a.gif";

function setPic(source){
	document.images['big_pic'].src = source;
}

function checkSubscribeForm(form) {
	f1 = document.forms[form].elements['field[name]'].value;
	f2 = document.forms[form].elements['field[email]'].value;
	
	if ((f1 == "") || (f1 == "Ваше имя")) {
		alert("Введите, пожалуйста, Ваше имя");
		return false;
	}
 	else if ((f2 == "") || (f2 == "Ваш e-Mail") || (f2.indexOf('@')<0) || (f2.indexOf('.')<0)) {
		alert("Введите, пожалуйста, корректный e-Mail");
		return false;
	}
	else return true;
}

function checkMailToFriendForm(form) {
	f1 = document.forms[form].elements['field[name]'].value;
	f2 = document.forms[form].elements['field[email]'].value;
	f3 = document.forms[form].elements['field[fmail]'].value;
	
	if ((f3 == "") || (f3.indexOf('@')<0) || (f3.indexOf('.')<0)) {
		alert("Введите, пожалуйста, корректный e-Mail Вашего друга");
		return false;
	}
	else if (f1 == "") {
		alert("Введите, пожалуйста, Ваше имя");
		return false;
	}
 	else if ((f2 == "") || (f2.indexOf('@')<0) || (f2.indexOf('.')<0)) {
		alert("Введите, пожалуйста, Ваш корректный e-Mail");
		return false;
	}
	else return true;
}

function checkFeedbackForm(form) {
	f1 = document.forms[form].elements['field[name]'].value;
	f2 = document.forms[form].elements['field[email]'].value;
	f3 = document.forms[form].elements['field[phone]'].value;
	f4 = document.forms[form].elements['field[text]'].value;
	
	if (f1 == "" || f1 == 'Ваше имя') {
		alert("Введите, пожалуйста, Ваше имя");
		return false;
	}
 	else if (((f2 == "") || (f2.indexOf('@')<0) || (f2.indexOf('.')<0) || f2=="Ваш e-Mail") && (f3 == "" || f3 == "Телефон")) {
		alert("Введите, пожалуйста, корректный e-Mail или номер телефона");
		return false;
	}
	else if (f4 == "") {
		alert("Введите, пожалуйста, Ваше сообщение");
		return false;
	}
	else return true;
}

function checkPropertySearchForm(form) {
	f1 = document.forms[form].elements['field[name]'].value;
	f2 = document.forms[form].elements['field[type]'].value;
	if (f1 == "" && f2 == "") {
		alert("Введите, пожалуйста, название или тип собственности");
		return false;
	}
	else return true;
}

function createDynamicWindow(Path,Width,Height,Title)
{
	var p = Math.ceil(Math.random()*10000);
	var q = Math.ceil(Math.random()*p);
	windowName = p+'X'+(Width*p)+(Height*q);
	WinFeatures = "top="+(screen.height-Height)/2+",left="+(screen.width-Width)/2+",width="+Width+",height="+Height+",Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=no";
	w = window.open("",windowName,WinFeatures);
	w.document.open();
	w.document.write('<head><title>&quot;'+Title+'&quot;</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>');
	w.document.write("<body bgcolor='#FFFFFF' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><img src='"+Path+"' height='"+Height+"' width='"+Width+"' alt='&quot;"+Title+"&quot;'></body>"); 
	w.document.close();
}

function createPopup(num){
	var p = Math.ceil(Math.random()*10000);
	var q = Math.ceil(Math.random()*p);
	windowName = p+'X'+p+p*q;
	WinFeatures = "top=100,left=100,width=1,height=1,status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=yes";
	w = window.open(num,windowName,WinFeatures);
}

savedClass = new Array();
function replaceClass(obj){
	if(obj) {
		savedClass['obj'] = obj; savedClass['className'] = document.getElementById(obj).className;
		document.getElementById(obj).className = 'topmenu_item_over';
		}
	else document.getElementById(savedClass['obj']).className = savedClass['className'];
}


function createDescriptionWindow(_file,_width,_height)
{
	wTop = (screen.height-_height)/3;
	wLeft = (screen.width-_width)/2;
	WinFeatures = "top="+wTop+",left="+wLeft+",width="+_width+",height="+_height+",maximize=no,minimize=no,Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=yes,resize=no";
	_newDescription = window.open(_file,"frontendDescriptionWindow",WinFeatures);
}

