$(document).ready(function()
{ 
	//  Initialize tooltips
	$('.icons_list a').aToolTip({  
				fixed: true  
		});
	// animating tooltips
	$('.icons_list li').hover(
		function(){$(this).find('img').stop().animate({marginTop:"-3px"}, 'fast')},
		function(){$(this).find('img').stop().animate({marginTop:"0px"}), 'fast'}
	);
	//--------
	
	$('#content > li, #menu li').hide();
	$('#fader_link').css({display:'inline-block'});
	
	$('header:not(.splash)').centering(1);
	$('#fader_link').click(function()
			{
				if($('header').hasClass('splash')){
					$(this).hide(300), $('#menu li').show(600, 'easeInOutBack');
				}
				else{
					$(this).hide(300), $('#menu li').show(600, 'easeInOutBack', function(){
						$('header:not(.splash)').centering(1)
					});
				}
				return false
			});
	
	// animate menu hover
	$('#menu li:not(.active) a').hover(
		function(){$(this).stop().animate({backgroundColor:"#b6b6bb"}, 600)},
		function(){$(this).stop().animate({backgroundColor:"#ffffff"}, 600)}
	);
	//---------
	
	// animate links hover in footer and content
	$('footer a, #content a').hover(
		function(){$(this).stop().animate({color:"#efefef"}, 200)},
		function(){$(this).stop().animate({color:"#ffffff"}, 200)}
	);
	
	
	// animate image border hover
	$('.img_border').hover(
		function(){$(this).stop().animate({borderColor:"#e07703"}, 600)},
		function(){$(this).stop().animate({borderColor:"#1f2327"}, 600)}
	);
	//---------

	$('#menu').delegate('a','click',function(){
											 
		var th=this		
		if(~th.parentNode.className.indexOf('active'))
		return false
		
		if ($('header').hasClass('splash')){
			var id=th.href.slice(th.href.indexOf('#'))
			$(th).parent().addClass('active').siblings().removeClass('active')
			$(id).fadeIn(300).siblings().hide();
		}
		else {
			$('header').animate({top:'0px'}, 'medium', function(){
				$(this).addClass('splash')
		 
				var id=th.href.slice(th.href.indexOf('#'))
				$(th).parent().addClass('active').siblings().removeClass('active')
				$(id).fadeIn(300).siblings().hide();
			});			
		}
		return false
	});
	$('a[rel=nav]').live('click',function(){
		var th=this
		if ($('header').hasClass('splash')){
			var id=this.href.slice(this.href.indexOf('#'))
			$('#menu li a').each(function(){
				if(~this.href.indexOf(id))
					$(this).parent().addClass('active')
				else
					$(this).parent().removeClass('active')
			})
			$(id).fadeIn(300).siblings().hide()
			return false
		}
		
		else{
			$('#fader_link').hide(300), $('#menu li').show(600, 'easeInOutBack');
			$('header').animate({top:'0px'}, 'medium', function(){
				$(this).addClass('splash')
				var id=th.href.slice(th.href.indexOf('#'))
				$('#menu li a').each(function(){
					if(~this.href.indexOf(id))
						$(this).parent().addClass('active')
					else
						$(this).parent().removeClass('active')
				})
				$(id).fadeIn(300).siblings().hide()
				return false
			});
		}
	})


  

});

