/**
 * @author simon
 * V1.0.0
 */
jQuery(document).ready(function(){
  	localize();			  			//Removes all elements where the lang attribute does not match the page language.
	animateMenu();
	if (jQuery().fancybox) {		//Check that fancybox is loaded
		jQuery(".enlargeImg").parent().fancybox({
			'hideOnContentClick': true
		});
	}
});
function animateMenu() {
	jQuery('ul.Level0 li.ActiveTab ul').show('slow');
	jQuery('ul.Level0 > li:not(.ActiveTab) > a')
		.css( {backgroundPosition: "-20px 35px"} )
		.mouseover(function(){
			jQuery(this).stop().animate({backgroundPosition:"(-20px 94px)"}, {duration:500})
		})
		.mouseout(function(){
			jQuery(this).stop().animate({backgroundPosition:"(40px 35px)"}, {duration:200, complete:function(){
				jQuery(this).css({backgroundPosition: "-20px 35px"})
			}})
		});
}
function imageSwapper() {
	jQuery('table.RandomView').attr({align: "left"});
	jQuery('table.RandomView').cycle({
		timeout:4000, 
    speed:  1500, 
    slideExpr: 'td img.imageSwapper' 
	});
}
function activeNews() {
	jQuery('ul.latestFeatured li:first').addClass('activeNews');  /*Highlight the first item*/
	jQuery('ul.latestFeatured li p a').hover(
		function () {
			$this=jQuery(this).parent().parent();
			jQuery('ul.latestFeatured li.activeNews').removeClass('activeNews');
	    	$this.addClass('activeNews');
	      }
	);
}
function localize() {
	jQuery("[lang]:not(html)[lang!='" + jQuery("html[lang]").attr('lang').slice(0,2) + "']" ).remove();	
	jQuery('.mainLang,.secLang').show();
	jQuery('.lang').css('visibility','visible');
}
