	var documentBound=document.getElementsByTagName((document.compatMode && document.compatMode == "CSS1Compat") ? "HTML" : "BODY")[0];
	function addOption(parent, text, val) {
		var opt = document.createElement("option");
		opt.innerHTML = text;
		opt.value = val;
		parent.appendChild(opt);
	}

	function fillMetros(id, element) {
		var html = "";
		if (id <= '' | id == ' ') html = "<font color='#cc0000'>Выберите линию</font>";
		else html = "<a href='javascript:;' onClick=\"openWin('/content/catalog/metro_list.html?line="+id+"');\">Выберите станцию(и)</a>";
		elem(element).innerHTML = html;
	}
	function formSubmit(frmName) {
		var formObj = eval("document.forms."+frmName+"");
		formObj.submit();
	}
	function checkPrices(frmName) {
		var obj = eval("document.forms."+frmName+".min_price");
		if (isNaN(obj.value)) obj.value='';
		var obj = eval("document.forms."+frmName+".max_price");
		if (isNaN(obj.value)) obj.value='';
	}
	function checkPricesH(frmName) {
		var obj = eval("document.forms."+frmName+".h_min_price");
		if (isNaN(obj.value)) obj.value='';
		var obj = eval("document.forms."+frmName+".h_max_price");
		if (isNaN(obj.value)) obj.value='';
	}
	function openWin(file) {
		var width = 750;
		var height = 400;
		var x = parseInt(screen.width / 2.0) - (width / 2.0);
		var y = parseInt(screen.height / 2.0) - (height / 2.0);
		var win = window.open(file, "popup", "top=" + y + ",left=" + x + ",scrollbars=yes,width=" + width + ",height=" + height + ",resizable=no");
		win.focus();
	}
	function openMetro() {
		var width = 820;
		var height = 570;
		var x = parseInt(screen.width / 2.0) - (width / 2.0);
		var y = parseInt(screen.height / 2.0) - (height / 2.0);
		var win = window.open('/map/index.htm', "popup", "top=" + y + ",left=" + x + ",scrollbars=no,width=" + width + ",height=" + height + ",resizable=no");
		win.focus();
	}

	function openNewWin(file, mywidth, myheight, winname)
	{
		var width = mywidth;
		var height = myheight;
	  var x = parseInt(screen.width / 2.0) - (width / 2.0);
		var y = parseInt(screen.height / 2.0) - (height / 2.0);
		var win = window.open(file, winname, "top=" + y + ",left=" + x + ",scrollbars=no,width=" + width + ",height=" + height + ",resizable=no");
		win.focus();
	}

	function openNew(file) {
		var width = 600;
		var height = 750;
		var x = parseInt(screen.width / 2.0) - (width / 2.0);
		var y = parseInt(screen.height / 2.0) - (height / 2.0);
		var win = window.open(file, "popup", "top=" + y + ",left=" + x + ",scrollbars=yes,width=" + width + ",height=" + height + ",resizable=no");
		win.focus();
	}
	function setVal(form, element, val) {
		var elm = eval("document.forms."+form+".elements."+element);
		elm.value = val;
	}
	function unSetVal(form, element) {
		var elm = eval("document.forms."+form+".elements."+element);
		elm.value = '';
	}
	function postFind() {
		var action = document.forms.selectors;
		var frm = document.forms.head_find;
		var act = "/catalog/"+action.elements.h_get.value+"/"+action.elements.h_type.value+"/param/min_price="+action.elements.h_min_price.value+"&max_price="+action.elements.h_max_price.value;
		window.location = act;
	}
	function postParams() {
		var act = "/catalog/"+elem('get').value+"/"+elem('type').value+"/param/";

		var sort = document.getElementById('sort');
		act = act + "sort="+sort.value;

		if ((elem('p'))&&(elem('p').value > "")) act = act + "&p="+elem('p').value;
		if ((elem('okrug'))&&(elem('okrug').value > "")) act = act + "&okrug="+elem('okrug').value;
		if ((elem('min_price'))&&(elem('min_price').value > "")) act = act + "&min_price="+elem('min_price').value;
		if ((elem('max_price'))&&(elem('max_price').value > "")) act = act + "&max_price="+elem('max_price').value;
		if ((elem('oper'))&&(elem('oper').value > "")) act = act + "&oper="+elem('oper').value;
		if ((elem('station'))&&(elem('station').value > "")) act = act + "&station="+elem('station').value;
		if ((elem('rooms'))&&(elem('rooms').value > "")) act = act + "&rooms="+elem('rooms').value;
		window.location = act;
	}
	function elem(element) {
		var a = document.getElementById(element);
		return a;
	}
