// JavaScript Document

$(document).ready(function(){

	
	//SHORTCUT MENU
	//--------------------------------------------------------------------------------------
	//init
	$(".shortcut-menu ul li a.active").css({
		  marginTop : '0px',
		  marginBottom : '0px',
		  paddingTop : '10px',
		  paddingBottom : '10px'
	});
	//mouseover
	$(".shortcut-menu ul li a").mouseover (
		function () {
			if ( $(this).is(".active") )
				$(this).css({
					marginTop : '0px',
					  marginBottom : '0px',
					  paddingTop : '10px',
					  paddingBottom : '10px'
				});
			else
				$(this).animate({
					  marginTop : '0px',
					  marginBottom : '0px',
					  paddingTop : '10px',
					  paddingBottom : '10px'
				  }, 200);
		}
	);
	//mouseout
	$(".shortcut-menu ul li a").mouseout (
		function () {
			if ( $(this).is(".active") )
				$(this).css({
					marginTop : '0px',
					  marginBottom : '0px',
					  paddingTop : '10px',
					  paddingBottom : '10px'
				});
			else
				$(this).animate({
					  marginTop : '10px',
					  marginBottom : '10px',
					  paddingTop : '0',
					  paddingBottom : '0'
				  }, 200);
		}
	);
	
	// NEWS BACKGROUNDPOSTION
	//--------------------------------------------------------------------------------------
	//init
	$('#news li .targetLinks').css({backgroundPosition: '660px 50%'});
	//mouseover
	$('#news li .targetLinks') .mouseover(function(){ 
		$(this) .animate({
			backgroundPosition: '620px 50%'
		}, 200); 
	});
	//mouseout
	$('#news li .targetLinks') .mouseout(function(){ 
		$(this) .animate({
			backgroundPosition: '660px 50%'
		}, 300); 
	});
	
	// Gallery
	//--------------------------------------------------------------------------------------
	//init
	$(".gallery li a span").css({"opacity" : "0.01"});
	//mouseover
	$(".gallery li a span").mouseover (
		function () {
			$(this).animate({
				 "opacity": ".5"
			}, 200);
		}
	);
	//mouseout
	$(".gallery li a span").mouseout (
		function () {
			$(this).animate({
				 "opacity": ".01"
			}, 600);
		}
	);
	
	
	
	//MAIN MENU
	//init
	$("#main-menu li a span").css({  backgroundPosition: '-50px 50%' });
	$("#main-menu li a.active span").css({ backgroundPosition: '10px 50%',  paddingRight : '10px', paddingLeft : '30px' });
	$("#main-menu li.active a span").css({ backgroundPosition: '10px 50%',  paddingRight : '10px', paddingLeft : '30px' });

	//Hover 
	$("#main-menu li a").hover(			
		function () { 
			if ( ! $(this).parent().hasClass('active') ) {
				$(this).parent().isHover = true;
				$(this).children("span").animate({ backgroundPosition: ' 10px 50%', paddingRight : '10px', paddingLeft : '30px' }, 200);
				$("#main-menu li.active a span").css({ backgroundPosition: '10px 50%',  paddingRight : '10px', paddingLeft : '30px' });
			}
		},
		function () { 
			if ( ! $(this).parent().hasClass('active') ) {
				$(this).parent().isHover = false;
				$(this).children("span").animate({ backgroundPosition: '-50px 50%', paddingRight : '0', paddingLeft : '20px' }, 200);
				$("#main-menu li.active a span").css({ backgroundPosition: '10px 50%',  paddingRight : '10px', paddingLeft : '30px' });
			}
		}
		
	);
	
	$("#main-menu li a span").hover(
		function () { 
			if ( ! $(this).parent().isHover && ! $(this).hasClass('active') ) {
				$(this).isHover = true;
				$(this).children("span").animate({ backgroundPosition: ' 10px 50%', paddingRight : '10px', paddingLeft : '30px' }, 200);
				$("#main-menu li.active a span").css({ backgroundPosition: '10px 50%',  paddingRight : '10px', paddingLeft : '30px' });
			}
		},
		function () { 
			if ( ! $(this).parent().isHover && ! $(this).hasClass('active')) {
				$(this).isHover = false;
				$(this).children("span").animate({ backgroundPosition: '-50px 50%', paddingRight : '0', paddingLeft : '20px' }, 200);
				$("#main-menu li.active a span").css({ backgroundPosition: '10px 50%',  paddingRight : '10px', paddingLeft : '30px' });
			}
		}
	);
	
	
});
