$(document).ready(function(){
	    $('#topnav ul li a').hover(function () {
	    	 $(this).parent().find("ul.subtop").slideDown('fast').show();
	    	 $('#topnav ul li ul').hover(function(){$(this).parent().children(':first').addClass("active");	},function(){$(this).parent().children(':first').removeClass("active"); });
	       $(this).parent().hover(function(){},function(){$(this).parent().find("ul.subtop").slideUp('fast'); });
	    });
	    
    if ( ($.browser.msie) ){
			    $('#topnav ul li ul').each(function(index) {
			    		
			    		$(this).css('margin-left',-$(this).parent().width());	
			  	});
    }
    
    $('#rightnav .box1 ul li').each(function(index) {
    	if($(this).height()!='33'){
    		$(this).addClass('big_txt');	
    	}
  	});
	
	$("a[rel=img_group]").fancybox({
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over" style="color: #ffffff;">'+ title + '</span>';
		}
	});
	
    $('.gallery_rot').cycle({
    context: false,
    tabs: false,
    timeout: 5000,      // time before next slide appears (in ms)
    slideSpeed: 4000,   // time it takes to slide in each slide (in ms)
    tabSpeed: 300,      // time it takes to slide in each slide (in ms) when clicking through tabs
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
  
	
    $('.video_rot').cycle({
    context: false,
    tabs: false,
    timeout: 5000,      // time before next slide appears (in ms)
    slideSpeed: 4000,   // time it takes to slide in each slide (in ms)
    tabSpeed: 300,      // time it takes to slide in each slide (in ms) when clicking through tabs
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	
    $('#main_news').cycle({
    context: false,
    tabs: false,
    timeout: 5000,      // time before next slide appears (in ms)
    slideSpeed: 4000,   // time it takes to slide in each slide (in ms)
    tabSpeed: 300,      // time it takes to slide in each slide (in ms) when clicking through tabs
		fx: 'fade',
		pager:   '#buttons',
		pagerAnchorBuilder: pagerFactory
	});
	    function pagerFactory(idx, slide) {
        var s = idx > 2 ? ' style="display:none"' : '';
        return '<a href="#?page" title="1"'+s+' class="" rel="buttonsat" id="buttactive"></a>';
    };
			
				$("#cal_prev").click(function() {
					    $.ajax({
					  			url: 'fw/ajax/calendar_m.php',
					  			data: "typi=1",
					        success: function (response) {
					        	$('#monthsat').html(response);
							$.ajax({
					  			url: 'fw/ajax/calendar.php',
					  			data: "typi=1",
					        success: function (response) {
					        	$('.month_days').html(response);
					        }
					    });
					        }
					    });

				});
				$("#cal_next").click(function() {
					    $.ajax({
					  			url: 'fw/ajax/calendar_m.php',
					  			data: "typi=2",
					        success: function (response) {
					        	$('#monthsat').html(response);
						  $.ajax({
					  			url: 'fw/ajax/calendar.php',
					  			data: "typi=2",
					        success: function (response) {
					        	$('.month_days').html(response);
					        }
					    });
					        }
					    });
					    
				});
    
});	
