Cufon.replace(".cufon a, .cufon, .overlay p, .overlay h1, .overlay-index h1, .overlay-index p, #content h2, #content h3, #content h4, #content .panel p, #content h5", {hover: true});

$(function(){
    //, .gallery-one .hover
	$(".img-overlay .hover, .gallery-one .hover").hide();
    $(".video-overlay .hover").hide();

    $(".video-overlay").mouseenter(function(){
        $(this).css({cursor:"pointer"});
        if($tmp=$(this).find(".hover"))
            $tmp.stop(true, true).fadeIn("fast");
    }).mouseleave(function(){
        if($tmp)
            $tmp.stop(true, true).fadeOut("fast");
    })
    
    //, .gallery-one
    
	$(".img-overlay, .gallery-one ").mouseenter(function(){
		$(this).css({cursor:"pointer"});
		if($tmp=$(this).find(".hover"))
			$tmp.stop(true, true).fadeIn("fast");
	}).mouseleave(function(){
		if($tmp)
			$tmp.stop(true, true).fadeOut("fast");
	})
    
    $(".img-overlay").click(function(){
		window.location.href=$(this).next().find("a").attr("href");
	})
    
    $("#bsearch").click(function(e){
        e.preventDefault();
        e.stopPropagation()
        if ($("#isearch").val()!="") $("#search").submit();
        else $(".search-field").css("display","block");
    })
    
    $("#isearch").click(function(e){
        e.stopPropagation()
    })
    
    
    $(document.body).click(function(e){
        $(".search-field").css("display","none");
    })
    
    
    jQuery.ifixpng('/img/s.gif');
	jQuery('img, .bgPng').ifixpng();
	jQuery('td, .bgPng').ifixpng();
	jQuery('div, .bgPng').ifixpng();
	jQuery('a, .bgPng').ifixpng();
	jQuery('li, .bgPng').ifixpng();
    
    
	$menuon=false;
    $("#menu li").mouseenter(function(){
    	$subid=$(this).attr("id");
    	$showmenu=false;
    	//cufon.refresh("#menu li");
    	$(".submenu_over li").each(function(i, e){
    		if($(e).is("."+$subid)){
    			$showmenu=true;
    			$(e).show();
    		}else
    			$(e).hide();
    	});

    	if($showmenu==true)
	    	$(".submenu_over").stop(true, true).slideDown("fast");
	    else
	    	$(".submenu_over").stop(true, true).slideUp("fast");

	    $menuon=true;
    })

    //$(".submenu_over").mouseleave(function(){
    //	$(".submenu_over").stop(true, true).slideUp("fast");
    //})
	//$(".submenu_over").data("sdv", $(".submenu_over").offset().top+$(".submenu_over").height());
    $("body").mousemove(function(e){
	    if($menuon==true){
	    	if(e.pageY>70)
	    	{
	    		$(".submenu_over").stop(true, true).slideUp("fast");
    			$menuon=false;
    		}
    	}
    })
});

