function ShowWin(url,x,y,name,isscrollbars) {
var cx, cy;
x=(x > screen.width * 0.7 ? screen.width * 0.7 : x);
y=(y > screen.height * 0.7 ? screen.height * 0.7 : y);
cx=screen.width/2-(x / 2);
cy=screen.height/2-(y/2);
isscrollbars=(isscrollbars=="no")?"no":"yes";
window.open(url,name,"toolbar=no,status=no,directories=no,menubar=no,resizable=yes,width="+x+",height="+y+",scrollbars="+isscrollbars+",top="+cy+",left="+cx);
}
function ShowWinS(url, x, y, scrl) {
x=(x > screen.width * 0.7 ? screen.width * 0.7 : x);
y=(y > screen.height * 0.7 ? screen.height * 0.7 : y);
if(x == 0 || y == 0) return;
var cx, cy, name;
cx=screen.width/2 - (x/2);
cy=screen.height/2-(y/2);
name = getNameByDate();
window.open(url,name,"toolbar=no,status=no,directories=no,menubar=no,resizable=yes,width="+x+",height="+y+",scrollbars="+scrl+",top="+cy+",left="+cx);
}
function getNameByDate() {
          var s = "";
          var d = new Date();
	  s += d.getFullYear();
	  s += (d.getMonth() + 1);
	  s += d.getDate();
	  s += "_" + d.getHours();
	  s += d.getMinutes();
	  s += d.getSeconds();
          return s;
}
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var is_opera = ((clientPC.indexOf("mozilla") != -1) && (clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") != -1));
var is_ffox = ((clientPC.indexOf("mozilla") != -1) && (clientPC.indexOf("firefox") != -1));
var is_ie = ((clientPC.indexOf("mozilla") != -1) && (clientPC.indexOf("msie") != -1) && !is_opera && !is_ffox);
var is_moz = ((clientPC.indexOf("mozilla") != -1) && !is_ie && !is_opera && !is_ffox);
if(is_moz || is_ffox) {
	document.write('<style> h2.htext {height:18px} </style>');
}
function MyResize() {
var cont_with = 760;
var max_with = 900;
var w = document.body.clientWidth > max_with ? max_with - cont_with : (document.body.clientWidth > cont_with ? document.body.clientWidth - cont_with : 1);
var tbm = document.getElementById("llimit");
if(tbm != '' && tbm != null) {
  tbm.width = w;
  tbm.style.width = w;
  SetCookie("llimit", w);
}
var w2 = document.body.clientWidth < max_with ? 1 : document.body.clientWidth - max_with;
var tbm = document.getElementById("rlimit");
if(tbm != '' && tbm != null) {
  tbm.width = w2;
  tbm.style.width = w2;
  SetCookie("rlimit", w2);
}
//window.status = document.body.clientWidth + ", " + w + ", " + w2;
}
function MyOnLoad() {
 document.body.clientWidth;
/* var obj = document.getElementById("sp_search_form");
 var objr = document.getElementById("spr_search_form");
 if(false && obj && objr) {
// 	alert(objr.innerHTML);
 	obj.innerHTML = objr.innerHTML;
 	objr.innerHTML = "";
 }*/
 MyResize();
 var obj = document.getElementById("sape");
 if(obj) {
 	var s = obj.innerHTML;
 	var re = /\w+/g;
 	var pos = s.search(re); 
 	if(pos == -1) obj.style.display = 'none';
 }
}
function SetCookie(sName, sValue) 
{
 var expiredays = 1;
 var todayDate = new Date();
 todayDate.setTime(todayDate.getTime() + expiredays * 24 * 60 *60 *1000);
 document.cookie = sName + "=" + escape(sValue) + "; expires=" + todayDate.toGMTString()+"; path=/";
}
function changeCont(url) {
 if(url) {
 	location.href = url;
 	return;
	ShowWaitWindow();
	last_url = url;
	if(!httpRequest(url+"?mode=httprequest")) {}
	//location.href = url;
	timer = setTimeout("CloseWaitWindow();", 1000);
 }
}
function ShowWaitWindow()
{
	CloseWaitWindow();

	var div = document.body.appendChild(document.createElement("DIV"));
	div.id = "wait_window_div";
	div.innerHTML = "Загрузка...";
	div.className = "waitwindow";
	div.style.left = document.body.scrollLeft + (document.body.clientWidth - div.offsetWidth) - 10 + "px";
	div.style.top = document.body.scrollTop + 10 + "px";

	if(is_ie)
	{
		var frame = document.createElement("IFRAME");
		frame.src = "javascript:void(0)";
		frame.id = "wait_window_frame";
		frame.className = "waitwindow";
		frame.style.width = div.offsetWidth + "px";
		frame.style.height = div.offsetHeight + "px";
		frame.style.left = div.style.left;
		frame.style.top = div.style.top;
		document.body.appendChild(frame);
	}
}
function CloseWaitWindow()
{
	var frame = document.getElementById("wait_window_frame");
	if(frame)
		frame.parentNode.removeChild(frame);
	var div = document.getElementById("wait_window_div");
	if(div)
		div.parentNode.removeChild(div);
}
function procAfterRequery(){
    if (HttpReq.readyState == 4) {//loaded
        if (HttpReq.status == 200) {// 200 - HTTP status: OK
        	var obj = document.getElementById('td_cont');
        	if(obj) {
        		document.getElementById('td_prev').innerHTML = "";
        		obj.innerHTML = HttpReq.responseText;
        		var re = new RegExp("<h2[^>]*?h2cont[^>]*?>(.*?)</h2>","ig");
				var a = obj.innerHTML.match(re);
				var s = a[0].replace(re, "$1");
				document.title = s;
				document.getElementById('h2cont').innerHTML = s;
				return true;
        	}
        }// 200: OK status
         else
        {//not 200: error
            alert("Sorry! Cannot load data from server. Network error:\n" + req.statusText);
        }
    }// state = 4 - loaded
}
var last_url = "";

// размер шрифтов
var yandex_ad_fontSize = 0.9;
// внешний вид объявлений директа
var yandex_direct_fontColor = "000000";
var yandex_direct_BorderColor = "FBE5C0";
var yandex_direct_BorderColor = "FFF9F0";
var yandex_direct_BorderColor = "FFFFFF";
var yandex_direct_BgColor = "FFF9F0";
var yandex_direct_BgColor = "FFFFFF";
var yandex_direct_headerBgColor = "6CBF0D";
var yandex_direct_titleColor = "0000CC";
var yandex_direct_titleColor = "336699";
var yandex_direct_siteurlColor = "006600";
var yandex_direct_linkColor = "336699";
var yandex_direct_Style = "flat";


