$(document).ready(function () {


    $("#menu > li > span > a").mouseover(function () {
        if ($(this).parent().parent().find("ul").parent().is(":hidden")) {
            $("#menu div.submenu").hide();
            $(this).parent().parent().find("ul").parent().fadeIn(300);
        }
    });

    function sbGen() {
        $("#blot span").css("display", "block").hide();
        var sb = $("#blot");
        sb.hover(
                function () {
                    sb.addClass("abs");
                    sb.css("left", ($("#wrapper").width() + 60 - sb.width()) + "px");
                    sb.stop();
                    sb.animate({ height: "223px" }, {
                        duration: 300, complete: function () { sb.find("span").fadeIn(100); }
                    });
                },
                function () {
                    sb.stop();
                    sb.find("span").hide();
                    sb.animate({ height: "180px" }, { duration: 300, complete: function () {
                        sb.find("span").hide();
                        sb.css("left", "");
                        sb.removeClass("abs");
                    }
                    });
                });
    }
    sbGen();
	
	
	$("a[rel=gallery]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts)
		{
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
	
	
	$("#content.faq p").hide();
	$("#content.faq h3").click(function(){$(this).next("p").slideToggle(300);});

	$("a[href$=doc], a[href$=docx]").not("div.rules a").addClass("doc-file");



});			
