var landing = {
	video : '<object width="400" height="240"><param name="movie" value="http://www.youtube.com/v/1sfAsmDawi0&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/1sfAsmDawi0&hl=en_US&fs=1&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="400" height="240"></embed></object>'
}


landing.init = function() {
	var jVideoButt = $('#learnMore');
	landing.videoCont = $('#genieoVideoContainer');
	jVideoButt.click(function() {
		var that = $(this);
		landing.showVideo(that); 
	});

	var jEye = $('.showTooltip');
	jEye.hover(landing.getMousePosition);
	jEye.mouseover(function() {
		var that = $(this);
		landing.showTooltip(that); 
	});
	jEye.mouseout(function() {
		var that = $(this);
		landing.hideTooltip(that); 
	});
	
}

landing.showVideo = function(that) {
	that.hide();
	landing.videoCont.html(landing.video);
	landing.videoCont.show();
}

landing.getMousePosition = function(args) {
    // Checks if the browsers is IE or another.
  	// document.all will return true or false depending if its IE
  	// If its not IE then it adds the mouse event

	if (!document.all)
		document.captureEvents(Event.MOUSEMOVE);
	
	// Gets IE browser position
	if (document.all)
	  {
		landing.mousePosition_x = event.clientX + document.body.scrollLeft;
		landing.mousePosition_y = event.clientY + document.body.scrollTop;
	  }
	
	  // Gets position for other browsers
	  else
	  { 
		  landing.mousePosition_x = args.pageX;
		  landing.mousePosition_y = args.pageY;
	  } 
}

landing.showTooltip = function(that) {
	
	var hei;
	var img = that.attr('id');
	
	if (img == "tooltip1") {
		hei = 186;
	}
	else {
		hei = 227;
	}
		

	var x = landing.mousePosition_x-207;
	var y = landing.mousePosition_y-hei;

	var divId = "show"+img;
	var str = 'top: '+y+'px; left: '+x+'px; visibility:visible; display: block';
	var jDiv = $('#'+divId);
	jDiv.attr('style', str);	
}

landing.hideTooltip = function(that) {
	var img = that.attr('id');
	var divId = "show"+img;
	var jDiv = $('#'+divId);
	jDiv.hide();	
}


jQuery(document).ready(function() {
	landing.init();
});


