﻿<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
function GoToURL(sender)
{
	if(sender.value)
		document.location=sender.value;
}
function SetCookie (name,value,expires) 
{
  //alert(value);
  var dt = new Date();
  var dtt = "";
  dt.setTime(dt.getTime()+expires*24*60*60*1000*365);
  dtt = dt.toGMTString();
  document.cookie = name+"="+value+";expires="+dtt+";path=/";
}
function getCookie(name) {
        var prefix = name + "=";
        var cookieStartIndex = document.cookie.indexOf(prefix);
        if (cookieStartIndex == -1)
                return null;
        var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
        if (cookieEndIndex == -1)
                cookieEndIndex = document.cookie.length;
        return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
        }
function deleteCookie(name) {
        if (getCookie(name)) 
        {
                document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT;path=/";
        }
}

//Показ всплывающего div-а
<!--
function ShowDiv(divID)
{
    var div=document.getElementById(divID);
   //alert(divID);
    if(div)
    {
     var x1 = (document.all) ? window.event.x + document.body.scrollLeft : undefined;
	var y1 = (document.all) ? window.event.y + document.body.scrollTop : undefined;
	
		div.style.left = (x1 + 20) + "px";
		div.style.top = (y1) + "px";
        div.style.display="block";
        div.style.visibility="visible";
    }
}
function HideDiv(divID)
{
    var div=document.getElementById(divID);
    if(div)
    {
   		
        div.style.display="none";
        div.style.visibility="hidden";
    }
}//-->
var ScreenWidth=1024, ScreenHeight=768;
function InitDimensions()
		{
			if(window.navigator.userAgent.toLowerCase().indexOf("msie")>-1)
				{
					Width = screen.Width-27;
					Height = screen.Height;
					//Width = document.body.clientWidth;
					//Height = document.body.clientHeight;
				}
				else
				{
					Width = window.outerWidth-27;
					Height = window.outerHeight;
					//Width = window.innerWidth;
					//Height = window.innerHeight;
				}
			
		}
function ShowEnterForm(formID,loginID)
{
    var div=document.getElementById(formID);
    if(div)
    {
        var flash=document.getElementById('flshOb')
        if(flash)
        {
            flash.style.visibility='hidden';
        }
        div.style.display="block";
        var width = (document.body.clientWidth / 2) - (div.offsetWidth / 2);
	    var height = (document.body.clientHeight / 2) - (div.offsetHeight / 2) ;
	    div.style.position="absolute";
	    div.style.left=width + 'px';
	    div.style.top=height + 'px';
	    div.style.visibility="visible";
	    BlinkAllNodes(10);
	    //Чем больше число, тем больше прозрачность.
	    if(window.navigator.userAgent.toLowerCase().indexOf("msie")>-1||
	    window.navigator.userAgent.toLowerCase().indexOf("opera")>-1)
	    {
	        elem=document.createElement("div");
            elem.id="divOverlay";
            elem.style.position="absolute";
            elem.style.filter="alpha(opacity=0)";
            elem.style.opacity=0;
            elem.style.display="block";
            elem.style.left=0;
            elem.style.top=0;
            elem.style.width=document.body.clientWidth;
            elem.style.height=document.body.clientHeight;
            elem.style.backgroundColor="white";
            elem.style.zIndex=10;
            document.body.appendChild(elem, document.body.firstChild);
            div.style.zIndex=20;
        }
	    div.style.opacity = 1;
        div.style.filter="alpha(opacity=100)";
        if(document.getElementById(loginID))
        document.getElementById(loginID).focus();
        
        
    }
   
	
}

function CloseEnterForm(formID)
{
	var div=document.getElementById(formID);
    if(div)
    {
        var flash=document.getElementById('flshOb')
        if(flash)
        {
            flash.style.visibility='visible';
        }
        div.style.display="none";
        div.style.visibility="hidden";
        BlinkAllNodes(100);
         if(window.navigator.userAgent.toLowerCase().indexOf("msie")>-1||
	    window.navigator.userAgent.toLowerCase().indexOf("opera")>-1)
	    {
	        elem=document.getElementById("divOverlay");
            document.body.removeChild(elem, document.body.firstChild);
        }
    }
}

function BlinkAllNodes(delta)
 { 
  var elems = document.getElementsByTagName("form");
  var _body=elems[0];
  var op=delta/100;
  for (var i=0; i<_body.childNodes.length; i++)
  {
  
	if (_body.childNodes[i].style) 
	{
	  _body.childNodes[i].style.opacity = op;
	  _body.childNodes[i].style.filter="alpha(opacity="+delta+")";
	}
  }
}

function GetFavorite()
	{
	window.open('/favorite.ashx?path='+location.href+'&title='+document.title,'','','');
	}
	
	function CheckCityID(divID, ddlCity)
	{
	    var div=document.getElementById(divID);
	    var ddl=document.getElementById(ddlCity);
	    if(div&&ddl)
	    {	        
	        if(parseInt(ddl.value)==-1)
	        {
	            div.style.display="block";
	        }
	        else
	        div.style.display="none";
	    }
	}
	
    function RedirectToSearch(path)
    {
        var tb_search = document.getElementById("tb_search");
        path = path + '?search=' + tb_search.value;
        //alert(path);
        window.location = path;
        
    }
    
    function OnEnterKeyDown(path)
    {
        if (event.keyCode == 13)
        {

            var tb_search = document.getElementById("tb_search");
            path = path + '?search=' + tb_search.value;
            //alert(path);
            window.location = path;
        
            //var elem = event.srcElement;
            //if (elem != null)
            //{
            //    event.returnValue = false;
            //    event.cancelBubble = true;
            //    event.keyCode = 0;
            //    sender.click();
            //}
        }
        else
        {
            return;
        }
    }
