/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 


this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 30;
		yOffset = 15;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'><span class='tooltip_lhs'></span><span class='tooltip_copy'>"+ this.t +"</span><span class='tooltip_rhs'></span></p>");
		$("#tooltip")
			.css("top",(e.pageY - yOffset) + "px")
			.css("left",(e.pageX + xOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - yOffset) + "px")
			.css("left",(e.pageX + xOffset) + "px");
	});			
};


   
function setMenus(targetDiv) {
	$('#nav > ul >li > a').removeClass('active');
	$(targetDiv).addClass('active');
	$('#header').show();
	}
		
		
// starting the script on page load
$(document).ready(function(){
	
	tooltip(); /* initialise tooltip */

	
	
	/* ajax feedback elements */
	$("#nav > ul > li > a").ajaxStart(function(request, settings){
		 $('#loading').show(); 
		 $('#copy').hide() ;
	 });
		 
	$("#nav > ul > li > a").ajaxComplete(function(request, settings){
		 $('#loading').hide(); 
		 $('#copy').fadeIn('fast') ;
	 });
	/* nav elements */
	
	  $('a#luxurytravel').click( 
		function() {
		setMenus(this);
		
		$('#copy').load('luxurytravel.php');
		});
	  $('a#designservices').click( 
		function() {
		setMenus(this);
		$('#copy').load('designservices.php');
		});	
  	  $('a#sitedevelopment').click( 
		function() {
		setMenus(this);
		$('#copy').load('sitedevelopment.php');
		});	
  
        $('a#ourwork').click( 
		function() {
		setMenus(this);
		$('#copy').load('recentwork.php');
		});	
			
	  $('a#mailbox').click( 
		function() {
		setMenus(this);
		$('#copy').load('mailbox.php');
		});	
		
      $('a#hosting').click( 
		function() {
		setMenus(this);
		$('#copy').load('hosting.php');
		});	
		
	 $('a#changetheworld').click( 
		function() {
		setMenus(this);
		$('#copy').load('changetheworld.php');
		});	
		
	$('a#aboutus').click( 
		function() {
		setMenus(this);
		$('#copy').load('aboutus.php');
		});
		
	$('a#contact').click( 
		function() {
		setMenus(this);
		$('#copy').load('contact.php');
		}); 
	  
	  
});