Array.prototype.inArray = function (value)
{
    var i;
    for (i=0; i < this.length; i++) {
        if (this[i] == value) {
            return true;
        }
    }
    return false;
};

Array.prototype.inArrayStrict = function (value)
{
    var i;
    for (i=0; i < this.length; i++) {
        if (this[i] === value) {
            return true;
        }
    }
    return false;
};

    function open_win ( addr, width, height, title )
    {
        r = window.open( addr, '', "width="+width+", height="+height+", location=0, menubar=0, resizable=0, scrollbars=1, status=0, titlebar=0, toolbar=0, screenX=100, left=100, screenY=30, top=60 ");
//        return r;
    }

function imgopen(imgf,tit) {

rand_id='image'+(Math.round(Math.random()*1000));

outf="<html>"
 +"<head>"
 +"<title>"+tit+"</title>"
 +"<style>body{margin:0px}</style>"
 +"</head>"
 +"<body leftmargin=0 topmargin=0>"
 +"<img src=\""+imgf+"\">";

iopen="iwin=self.open('"+imgf+"', '"+rand_id+"', 'width='+(img1.width)+',height='+(img1.height)+',top=0,left=0,resizable=yes, toolbar=no, menubar=no, scrollbars=no, status=no ');"
 +"iwin.document.write('"+outf+"');"
 +"iwin.focus();";

img1=new Image();
img1.src=imgf;

if(img1.width!=0) eval(iopen);

else{
iwin = self.open('about:blank', 'f'+rand_id, 'width=100,height=100,top=0,left=0');
iwin.document.write("<html>"
+"<body>Загрузка...<br>"
 +"<"+"script>"
  +"function imo(img1){"+iopen
  +"self.close();"
 +"}<"+"/script>"
 +"<img src='"+imgf+"' onload='imo(this);'>");
 }
}

function openGallery(url) {
        var winGal;
        if( winGal ) {
            winGal.close();
        }
        winGal = window.open( '/' + url, 'winGal', 'location=0, toolbar=0, menubar=0, scrollbars=yes, height=600, width=530, status=0' );
}

function createCookie(name,value,days,path)
{
        if (days)
        {
                var date = new Date();
                date.setTime(date.getTime()+(days*24*60*60*1000));
                var expires = "; expires="+date.toGMTString();
        }
        else var expires = "";
        if (!path)
                path = "/";
        document.cookie = name+"="+value+expires+"; domain=mash-dvor.ru; path="+path;
}

function readCookie(name)
{
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for(var i=0;i < ca.length;i++)
        {
                var c = ca[i];
                while (c.charAt(0)==' ') c = c.substring(1,c.length);
                if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
        }
        return null;
}

function eraseCookie(name,path)
{
        createCookie(name,"",-1,path);
}

function closepopupcity() {
    createCookie('city','',1,'/');
    document.getElementById('popupcity').style.display='none';
}

function savepopupcity() {
document.forms['city_form'].elements['erase_city'].value=0;
    createCookie('city',document.forms['city_form'].elements['city'].value,1,'/');
    document.forms['city_form'].submit();
}


