function box_showhide(container, class_shown, class_hidden) {
    if($(container)) {
        if($(container + '_container').style.display == 'none') {
            //$(container + '_container').style.display = 'block';
            Effect.SlideDown(container + '_container', { duration: 0.5 });
            $(container).className = class_shown;
            setCookie('cookie_' + container, 1);       
            if(txt = $$('#' + container + ' .txt')){
                txt[0].innerHTML = 'Скрыть';
            }
        } else {
            //$(container + '_container').style.display = 'none';            
            Effect.SlideUp(container + '_container',  { duration: 0.5 });
            $(container).className = class_hidden;
            setCookie('cookie_' + container, 0);
            if(txt = $$('#' + container + ' .txt')){
                txt[0].innerHTML = ' Показать';
            }
        }
        //$(container).focus();
    }
}


function init_box_showhide(container, class_shown, class_hidden) {

    current = getCookie('cookie_' + container);

    if (current) {

        //if(txt = $$('#' + container + ' .txt')){
            //Event.observe(txt[0], 'mouseover', function(event) { this.className = 'hover';});
            //Event.observe(txt[0], 'mouseout', function(event) { this.className = 'normal';});
        //}
        

//        alert(current);

        if(current == 1) {
            $(container).className = class_shown;
            $(container + '_container').style.display = 'block';
            if(txt = $$('#' + container + ' .txt')){
                if(txt[0]){
                    txt[0].innerHTML = 'Скрыть';
                }
            }
        } else if(current == 0) {
            $(container).className = class_hidden;
            $(container + '_container').style.display = 'none';
            if(txt = $$('#' + container + ' .txt')){
                if(txt[0]){
                    txt[0].innerHTML = ' Показать';
                }
            }
        }
    }
}

function  setCookie(name, value, expires, path, domain, secure) {
    var today = new Date();
    var expires = new Date();
    expires.setTime(today.getTime() + 3600000*24*30);

    var curCookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
    document.cookie = curCookie;
}

function getCookie(name) {
    var start = document.cookie.indexOf( name + "=" );
    var len = start + name.length + 1;
    if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {return null;}
    if ( start == -1 ) return null;
    var end = document.cookie.indexOf( ";", len );
    if ( end == -1 ) end = document.cookie.length;
    return unescape( document.cookie.substring( len, end ) );
}


function deleteCookie(name, path, domain) {
    if (getCookie(name)) {
        document.cookie = name + "=" +
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +"; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}



function setClassFromTo(classFrom, classTO) {

    var items = $$('div.' + classFrom);
	for (var x = 0; x < items.length; x++){
        items[x].className = classTO;
    }

}


