$(function(){
    $("ul.dropdown li").hover(function(){
    
        $(this).addClass("hover");
        $('ul:first',this).css('visibility', 'visible');
    
    }, function(){
    
        $(this).removeClass("hover");
        $('ul:first',this).css('visibility', 'hidden');
    
    });
    
    $("ul.dropdown li ul li:has(ul)").find("a:first").addClass("has-sub");

    $("img.button").hover(
	function() {
		this.src = this.src.replace("_off","_on");
	},
	function() {
		this.src = this.src.replace("_on","_off");
	}
    );
    $('#news-fading-image').cycle({
        fx:     'fade',
        speed:  'slow',
        timeout: 5000,
        next:   '#next', 
	prev:   '#prev', 
	pager:   '#navv',
        pagerAnchorBuilder: pagerFactory
    });
    $('#lower-sponsor-logo').cycle({
        fx:     'fade',
        speed:  'slow',
        random: 1,
        timeout: 5000    	
    });
    function pagerFactory(idx, slide) {
        var s = idx > 4 ? ' style="display:none"' : '';
        return '<li'+s+'><a href="#">'+(idx+1)+'</a></li>';
    };
$(".wtgallery_category_folder").each(function() {
  $(this).html($(this).html().replace(/[_-]/g," "));
});
	
});
