

function centerLanding() {
	if ($("#landing-main-bg").length > 0) {
		$("#landing-main-bg").center({
			vertical: false // only horizontal
		});
		
		$("#landing-content-wrapper").center({
		  vertical: false // only horizontal
		});
	}
}


function landingSwap(){
	$(".highlights").hover(
      function () {
      	var rel = $(this).attr("rel");
        $("#"+rel).fadeIn("fast");
      }, 
      function () {
      	var rel = $(this).attr("rel");      
        $("#"+rel).fadeOut("fast");
      }
    );
}

function tooltip(){

	$(".list-link").hover(
		function () {
    	 	var rel = $(this).attr("rel");
		
    	   // Get the link's placement
    	   var pos = $(this).offset(); 
    	   var h = $("div#tooltip-"+rel).height();
    	   var eWidth = $(this).outerWidth();
    	   
    	   var mWidth = '250';   
    	   var left = (pos.left + eWidth) - 50;
    	   var top = (pos.top - h) - 5;
    	   
    	   // Fix to make sure it's not going off the viewable area
    	   if (left > 900) {
    	   	left = (pos.left + eWidth) - 250;
    	   }
    	   
    	   //alert(h);
    	   
    	   if (pos.top < 250 && h > 170) {
    	   	var top = (pos.top) + 20;
    	   }
    	   
    	   $("div#tooltip-"+rel).css( { 
    	           position: 'absolute',
    	           zIndex: 5000,
    	           left: pos.left + "px", 
    	           top: top + "px"
    	   } );
		
    	   $("div#tooltip-"+rel).show();
	},
	function () {
      		var rel = $(this).attr("rel");
        	$("div#tooltip-"+rel).hide();	 
		}
	);
}



$(document).ready(function(){
	centerLanding();
	landingSwap();
	tooltip();
});

