
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 Photo_Div_Close() {
	document.getElementById('div_fon').style.display = "none";
	document.getElementById('div_img').style.display = "none";
	document.getElementById('variant').src = "/img/b.gif";
}

function Photo_Div_Open() {
	document.getElementById('div_fon').style.display = 'block';
	document.getElementById('div_img').style.display = 'block';
	document.getElementById('variant').src = url;
}

function view_otvet(id){
		str = document.getElementById('im'+id).src;
		flag = str.length;
		if(flag == 42){
		document.getElementById('otvet'+id).style.display = 'block';
		document.getElementById('im'+id).src = 'http://www.binbank.ru/media/images/vo.gif';
		document.getElementById('im'+id).alt = 'спрятать комментарии';
		document.getElementById('a'+id).style.color = '#222';
		document.getElementById('a'+id).style.font = 'bold x-small Tahoma';
		document.getElementById('a'+id).title = 'спрятать комментарии';
		} else {
		document.getElementById('otvet'+id).style.display = 'none';
		document.getElementById('im'+id).src = 'http://www.binbank.ru/media/images/vo0.gif';
		document.getElementById('im'+id).alt = 'файл / комментарии';
		document.getElementById('a'+id).style.color = '#999';
		document.getElementById('a'+id).style.font = 'normal x-small Tahoma';
		document.getElementById('a'+id).title = 'файл / комментарии';
		}
	}