$(document).ready(function() {                  	


	//SHOW THE LOADER AND HIDE BACKGROUND IMAGE UNTIL IT IS LOADED
	$('#tf_bg').addClass('tf_bg');
	

	// CUFON REPLACEMENT
	Cufon.replace('#navbar li a, h1.name, #main h1, #main h2', { fontFamily: 'PT Sans Narrow' }); 
	
	Cufon.replace('a.button', {
	fontFamily: 'PT Sans',
	textShadow: '1px 1px #434343'
	});



	//DROPDOWN SCRIPT
	$('#navbar ul').css({display: "none"}); 
	$('#navbar li').hover(function(){
		var fchild = $(this).find('ul:first');
		fchild.css({visibility: "visible", display: "none"}).fadeIn('fast');
		var fchildHeight = fchild.height();
		fchildHeight = (fchildHeight  * -1) + 65;
		//alert(fchildHeight);
		fchild.css({top:fchildHeight});
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		});	
	
		
		
					

		// IE navbar last child fix		
		$('#navbar li ul li:last-child').css('border-bottom', 'none');	

	

		            
    //HIDING MENU         
    
  var navHeight = $('#menu_wrap').height();
   var hideHeight = navHeight - 168; 
    
    
    //click on hide menu button (arrow points up)                            
    $('#hide_menu a.menu_visible').live('click',function(){	
		
	    	//add class hidden
	        $('#hide_menu a.menu_visible')
		        .removeClass('menu_visible')
		        .addClass('menu_hidden')
		        .attr('title', 'Show the navigation');
		   
		    // hide the tooltip     
	        $('.menu_tooltip').css('opacity', '0');
	          
	        //move navigation up, after replace the text                  
		    $('#menu_wrap').animate({bottom: '-='+ hideHeight + 'px'}, "slow", function() {      	
		        $('.menu_tooltip .tooltip_hide').hide();	   
		    	$('.menu_tooltip .tooltip_show').show();	
		                
	 });
	                       	
            return false;
            
     	});
	          
     	       	
	//SHOWING MENU	
		//click on show menu button (arrow points down)                      	
		 $('#hide_menu a.menu_hidden').live('click', function(){	
		    
		     //add class visible	
		     $('#hide_menu a.menu_hidden')
			     .removeClass('menu_hidden')
			     .addClass('menu_visible');
		
			// hide the tooltip      
		      $('.menu_tooltip').css('opacity', '0');    
		        $('#menu_wrap').animate({ bottom: '+='+ hideHeight + 'px'}, 'slow');  
		        $('.menu_tooltip .tooltip_show').hide();
		        $('.menu_tooltip .tooltip_hide').show();	   
		    		
		            
		            return false;    
		 });


}); //document.ready function ends here








	


