function leftmenu_init() {
	$(".menu").children("div").hide();
	$(".menu").children("a.active").next(".level1").show();
	$(".menu").children("a").click(function() {
		if ($(this).next(".level1:visible").length) {
			$(this).next(".level1").hide();
		} else if ($(this).next(".level1").length) {
			$(this).next(".level1").show();
		} else {
			location.href = $(this).attr("href");
		}
		return false;
	});
}
/*
function head_init() {
	$(".wid .level1").hide();
//	$(".menu").children("a.active").next(".level1").show();
	$(".wid .level1").prev().mouseover(function() {
			$(this).next(".level1").delay(1500).show();
	});
	$(".wid .level1").prev().mouseout(function(){
	  $(this).next(".level1").hide(1500);
	});
	$(".wid .level1").mouseover(function() {
			$(this).show();
	});
	$(".wid .level1").mouseout(function(){
	  $(this).hide(1500);
	});
}

function window_load() {
	var window_onload = window.onload;
	window.onload = function() {
		if (typeof(window_onload) == "function") window_onload();
		leftmenu_init();
		head_init()
	}
}
window_load();*/

function myHideMenu() {
    var $t = $(".wid td");
    $t.children("a").removeClass("hover");
    $t.children("div.level1").hide();
}

function myInitMenu() { 
    $(".wid td").mouseover(function() {
        if (window.myMenuTimeout) {
            clearTimeout(window.myMenuTimeout);
            window.myMenuTimeout = null;
        }
        myHideMenu();
        $(this).children("a").addClass("hover");
        $(this).children("div.level1").show();
    }).mouseout(function() {
        if (window.myMenuTimeout) {
            clearTimeout(window.myMenuTimeout);
            window.myMenuTimeout = null;
        }
        window.myMenuTimeout = setTimeout(myHideMenu, 300);
    });
}

function myInitFancy() {
	if (typeof($) === "undefined") return;
	if (typeof($.fancybox) === "undefined") return;
	if (typeof(window._myInitFancy) !== "undefined") return;
	window._myInitFancy = true;
	$(function() {
		$(".wid a>img").not(".panel img").each(function() {
			$(this).parent().fancybox({
				onStart: flash_hide,
				onClosed: flash_show
			});
		});
	});
}

function myInit() {
    if (typeof($) === "undefined") return setTimeout(arguments.callee, 100);
    $(function() {
        myInitMenu();
	leftmenu_init();
	myInitFancy();
    });
}

myInit();

