$(document).ready(function(){
	var timeout = null;

	$("#close_open").click(function(){ 
        if ($("#razv_obl").is(":hidden")) {
    	    $("#razv_obl").show();
	        $("#close_open").text("Свернуть");
        } else {
        	$("#razv_obl").hide();
		    $("#close_open").text("Развернуть");
        }
    //$("#razv_obl").toggle();
    });


    $(".group_header").click(function(e){
        var t = $(this);
        if(t.hasClass("closed"))
        {
            t.removeClass("closed");
            t.parent().next().show();
        }
        else
        {
            t.addClass("closed");
            t.parent().next().hide();
        }
        e.preventDefault();
    });

	$("div.tophot_pre ul.tophot li").mousemove(function(){
		if(timeout) clearTimeout(timeout);
		timeout = null;

		var id = "tophot0";
		var newId = this.id
		var curr = $("div.tophot_pre ul.tophot li.here");
		if(curr.length > 0) id = curr[0].id;
		if(id == newId) return;

		var ff = function(){
			$(curr).removeClass("here");
			$("#" + newId).addClass("here");
			$(".main-hot span.#imgfor" + id).fadeOut(75, function(){
				$("span.#imgfor" + newId).fadeIn(75, function(){
						timeout = null;
					});
			});
		};
		timeout = setTimeout(ff, 200);
	});

	$("div.tophot_pre ul.tophot li").mouseout(function(){
		if(timeout) clearTimeout(timeout);
		timeout = null;

		var newId = "tophot0";
		var curr = $("div.tophot_pre ul.tophot li.here");
		if(curr.length == 0) return;
		var id = curr[0].id;


		var ff = function(){
			$(curr).removeClass("here");
			$("#" + newId).addClass("here");
			$(".main-hot span.#imgfor" + id).fadeOut(75, function(){
				$("span.#imgfor" + newId).fadeIn(75, function(){
						timeout = null;
					});
			});
		};
		timeout = setTimeout(ff, 200);
	});
});



function bgChange1(el) {
	el.style.background = 'url(/images/back_menu3.jpg) right bottom no-repeat';
}

function bgBack1(el) {
	el.style.background = 'url(/images/back_menu2.jpg) left bottom repeat-x';
}

function bgChange(el) {
	el.style.background = 'url(/images/back_menu3.jpg) right bottom no-repeat';
	el.childNodes[0].style.background = 'url(/images/back_menu5.jpg) left bottom no-repeat';
}

function bgBack(el) {
	el.style.background = 'url(/images/back_menu1.jpg) left bottom no-repeat';
}

function imgChangeBlock(el) {
	document.getElementById('imgfortophot0').style.display = 'none';
	}

function imgChangeBlock2(el) {
	$("div.tophot_pre ul.tophot li").removeClass("here");
	}


function openOrderWindow(f)
{
    window.open(f.action + "?referer=" + escape(window.location), "oplot_order_form", "menubar=no, resizable=no, scrollbars=no, toolbar=no, width=700, height=720", true).focus();
    return false;
}