// JavaScript Document

$(document).ready(function(){
	$("div#header ul.sf-menu").superfish();
	
	$('a#cr').hover(function(){
		$('div#cr_h').fadeIn(500);
		$('div#cr').fadeOut(500);
	},function(){
		$('div#cr').fadeIn(500);
		$('div#cr_h').fadeOut(500)
	});
	
	
	if ($("div#slider").length > 0) {
		var total = $('#slider img').length;
		var rand = Math.floor(Math.random()*total);
		$('#slider').nivoSlider({
			startSlide:rand,
			effect: 'fade',
			animSpeed: 500,
			pauseTime: 3000,
			directionNav: true,
			directionNavHide: true,
			controlNav: true
		});
	}
	
	
	$("div.category_item").hover(function(){
		$(this).children(' div.category_item_poster').fadeTo(300, 1.0);
	},function(){
   		$(this).children(' div.category_item_poster').fadeTo(300, 0.6);
	});
	
	$("div.block_content a").hover(function(){
		$(this).children(' img').fadeTo(500, 0.6);
	},function(){
   		$(this).children(' img').fadeTo(500, 1.0);
	});

	
	$('ul.right_menu > li > a.menuactive.parent + ul').show('normal');
	$('ul.right_menu > li.expander').hover(function() {
		$(this).toggleClass('collapsed').toggleClass('expanded');
		$(this).find('> ul').toggle('normal');
	});
	
	$("a.banner").hover(function(){
		$(this).fadeTo(500, 0.5);
	},function(){
   		$(this).fadeTo(500, 1.0);
	});


	$("div.NewsSummaryLink a").hover(function(){
		$(this).parent().parent().parent().fadeTo(300, 0.5);
	},function(){
   		$(this).parent().parent().parent().fadeTo(300, 1.0);
	});
	
	$("div.NewsSummaryField a").hover(function(){
		$(this).parent().parent().parent().fadeTo(300, 0.5);
	},function(){
   		$(this).parent().parent().parent().fadeTo(300, 1.0);
	});

	if ($("div.gallery").length > 0) {
		$("div.gallery div.img a.group").hover(function(){
			$(this).fadeTo(300, 0.5);
		},function(){
			$(this).fadeTo(300, 1.0);
		});
	}

});
