function popupImg( src )

{

                var html = { title:'Base Project', style:'', body:'' };              

                html.style = 'BODY {padding:0; margin:0;}';

                html.body = '<A HREF="/" onClick="opener.focus(); self.close(); return false;">' + 

                               '<IMG SRC="'+ src +'" BORDER="0" TITLE="Закрыть" ID="resizeBy"/>' + 

                               '</A>';                                 

                popupPro( html, null );

}

 

function popupPro( html, args ) 

{              

    args = (args && args.length == 7) ? args : ['no','no','no','no','no','no','no'];       

                try          { if ( popup ) popup.close(); } catch ( e ) {}

                var win;               

                popup = window.open( '','popup','top=0,left=0,toobar='+args[0]+',location='+args[1]+',directories='+args[2]+',status='+args[3]+',resizable='+args[4]+',scrollbars='+args[5]+',copyhistory='+args[6]+',width=1,height=1' );                                            

                doc = popup.document;

                var str ='<HTML><HEAD><TITLE>' + html.title + '</TITLE>' +    

                '<STYLE>'+html.style+'</STYLE><SCRIPT>function resize() {var resizeByObj = document.getElementById( "resizeBy" ); if ( resizeByObj ) { resizeTo( resizeByObj.width, resizeByObj.height ); var top = parseInt( (window.screen.height  - ( window.screen.height - window.screen.availHeight ) - resizeByObj.height) / 2); var left = parseInt( (window.screen.width - ( window.screen.width - window.screen.availWidth ) - resizeByObj.width) / 2); moveTo( left, top );}         window.focus();}</SCRIPT></HEAD>' +

                '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">' + 

    '<BODY onLoad="resize(); self.focus();">' + html.body + '</BODY></HTML>';

                doc.write(str);

                doc.close();        

                self.win = popup;

}

 

var Http =

{

    cookies: document.cookie.split('; '),

 

    getCookies: function()

    {

        var result = new Array();

        for( i in this.cookies )

        {

            var cookie = this.cookies[i].split('=');

            result[i] = new Http.Cookie( cookie[0], ( cookie[1] ) ? cookie[1] : '' );

        }

        return result;

    },

 

    getCookieByName: function( name )

    {

        for( i in this.cookies )

        {                      

            var cookie = this.cookies[i].split('=');                                         

            if( cookie[0].toUpperCase() === name.toUpperCase() )

            {

                return new Http.Cookie( cookie[0], ( cookie[1] ) ? cookie[1] : '' );

            }

        }

 

        return null;

    }

};

 

Http.Cookie = function( name, value, maxAge, path, domain, secure )

{

    if ( name )

    {

        this.setName( name );

    }

    if ( value )

    {

        this.setValue( value );

    }

    if ( maxAge instanceof Date )

    {

        this.setMaxAge( maxAge );

    }

    if ( path )

    {

        this.setPath( path );

    }

    if ( domain )

    {

        this.setDomain( domain );

    }

 

    if ( secure instanceof Boolean )

    {

        this.setSecure( secure );

    }

};

Http.Cookie.prototype =

{

    name: '',

    value: '',

    maxAge: null,

    path: '/',

    domain: location.hostname,

    secure: false,

 

    getDomain: function()

    {

        return this.domain;

    },

 

    getMaxAge: function()

    {

        return this.maxAge;

    },

 

    getName: function()

    {

        return this.name;

    },

 

    getPath: function()

    {

        return this.path;

    },

 

    getSecure: function()

    {

        return this.secure;

    },

 

    getValue: function()

    {

        return unescape( this.value );

    },

 

    setMaxAge: function( maxAge )

    {

        this.maxAge = new Date( maxAge );

    },

 

    setDomain: function( domain )

    {

        this.domain = domain;

    },

 

    setName: function( name )

    {

        this.name = name;

    },

 

    setPath: function( path )

    {

        this.path = path;

    },

 

    setSecure: function( secure )

    {

        this.secure = secure;

    },

 

    setValue: function( value )

    {

        this.value = escape( value );

    },

 

    destroy: function()

    {

        document.cookie = this.name + "=" +

                          ( ( this.path ) ? '; path=' + this.path : '' ) +

                          ( ( this.domain ) ? '; domain=' + this.domain : '' ) +

                          '; expires=' + ( new Date(1970, 00, 01) ).toGMTString();

    },

 

    save: function()

    {

        document.cookie = this.name + "=" +

                          ( ( this.value ) ? this.value : '' ) +

                          ( ( this.expires ) ? '; expires=' + this.expires.toGMTString() : '' ) +

                          ( ( this.path ) ? '; path=' + this.path : '' ) +

                          ( ( this.domain ) ? '; domain=' + this.domain : '' ) +

                          ( ( this.secure ) ? '; secure' : '' );

 

        return true;

    }

};

 

function changeSearchType( elem )

{

                if( parseInt( elem.value ) == 1 )

                {

                               elem.form.action = '/'+ lang +'/yandex.wbp';

                               elem.form.elements[0].name = 'text';

                }

                else

                {

                               elem.form.action = '/'+ lang +'/search.wbp';

                               elem.form.elements[0].name = 'search.query';

                }

}

function checkType( form )

{

                if( form.choose[1].checked )

                {

                               form.action = '/'+ lang +'/yandex.wbp';

                               form.elements[0].name = 'text';

                }

                new FormCheckPro(form);

}

 

/* catalog */

 

var expDays = 30;

var exp = new Date(); 

exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

 

 

 

function SetCookie (name, value) {  

                var argv = SetCookie.arguments;  

                var argc = SetCookie.arguments.length;  

                var expires = (argc > 2) ? argv[2] : null;  

                var path = (argc > 3) ? argv[3] : null;  

                var domain = (argc > 4) ? argv[4] : null;  

                var secure = (argc > 5) ? argv[5] : false;  

                document.cookie = name + "=" + escape (value) +

                ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 

                ((path == null) ? "" : ("; path=" + path)) +  

                ((domain == null) ? "" : ("; domain=" + domain)) +    

                ((secure == true) ? "; secure" : "");

}

function getCookie(name)

{

    var cookie = ' ' + document.cookie;

    var search = ' ' + name + '=';

    var setStr = null;

    var offset = 0;

    var end = 0;

    if (cookie.length > 0)

    {

        offset = cookie.indexOf(search);

        if (offset != -1)

        {

            offset += search.length;

            end = cookie.indexOf(';', offset);

            if (end == -1)

            {

                end = cookie.length;

            }

            setStr = unescape(cookie.substring(offset, end));

        }

    }

    return(setStr);

}

 

var  x_request  =  createXMLHttpRequest(); 

 

function  createXMLHttpRequest()  {  

    var  xhr;  

    if(window.XMLHttpRequest)  { 

        try  {  

            xhr  =  new  XMLHttpRequest();  

        }  catch(e)  {  

            xhr  =  false;  

        }  

    }  else  if(window.ActiveXObject)  { 

        try  {  

            xhr  =  new  ActiveXObject("Microsoft.XMLHTTP");  

        }  catch(e)  {  

            xhr  =  false;  

        }  

    }  

    return  xhr;  

} 

 

function  sendRequest(file, str)  {  

    var  rnd982g  =  Math.random();  

        x_request.open('GET',  file+'?root-id='+str+'&rnd982g='+rnd982g);  

        x_request.onreadystatechange  =  handleResponse;  

        x_request.send(null);  

   return  false;  

} 

 

function  handleResponse()  {  

    if(x_request.readyState  ==  4)  {  

        var  response  =  x_request.responseText;  

        document.getElementById("results").innerHTML  =  response;  

    }  

} 

 

/* datalist */

function listCtrl (id)

{

elem = document.getElementById(id);

if(elem.style.display == 'none')

{elem.style.display = 'block';}

else

{elem.style.display = 'none';}

}

 

function mClose ()

{

document.getElementById('pWind').style.visibility = 'hidden';

}

 

function mMap (x,y,name)

{

elem = document.getElementById('pWind');

elem.style.visibility = 'visible';

contBox = document.getElementById(name).childNodes;

mMetro = contBox[1].getElementsByTagName('SPAN')[0].innerHTML;

mAdr = contBox[0].getElementsByTagName('SPAN')[0].innerHTML;

mScheme = contBox[2].getElementsByTagName('SPAN')[0].innerHTML;

mName = name;

 

elem.innerHTML = '<table CLASS="button"><tr><td><img src="/media/img/m.gif"><font color="#f48220" size="3.0em"><b>&nbsp;'+mMetro+'</b><BR/></font></td></tr></table><IMG SRC="/media/img/b.gif" WIDTH="1" HEIGHT="7"/><BR/><A HREF="#'+mMetro+'" ONCLICK="listCtrl(mName);"><B><font color="#0f5031" size="2.9em">«'+mName+'»</B></font></A><IMG SRC="/media/img/b.gif" WIDTH="1" HEIGHT="7"/><BR/><BR/>'+mAdr+'<BR/><IMG SRC="/media/img/b.gif" WIDTH="1" HEIGHT="7"/><BR/><table style="width: 300px; height: 17px"><tr><td style="padding-left: 70px; BACKGROUND: url(/media/img/fon.gif) no-repeat;" class="shema"><font color="#000000" size="2em"><b>'+mScheme;
																						  
 

elem.style.top = y-8 +'px';

elem.style.left = x-8 +'px';

}

 

function visMap (obj)

{

obj.style.visibility = 'visible';

}
