// Nice lightbox
$(document).ready(function(){
	$("a[rel^='prettyPhoto']").prettyPhoto();
});


$(document).ready(function(){

	$('#quotes').innerfade_hd({ 
		speed: 'slow',
		timeout: 8000,
		type: 'sequence'
		//containerheight: '80px' 
	}); 
	

});
$(document).ready(function(){

	$('#featured-app').innerfade({ 
		speed: 'slow',
		timeout: 8000,
		type: 'sequence',
		containerheight: '111px' 
	});
	
});

/*
 * 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
 *
 */
 

/*
	add accesskey, z-index
*/
this.tooltip = function(){	
	/* CONFIG */
		//xOffset = -23;
		//yOffset = 0;

		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
	/* END CONFIG */
	$("a[title], button[title]").hover(function(e){
		this.t = this.title;
		this.title = "";
		/*if($(this).attr("accesskey")){
			this.a = 'accesskey: <strong>'+ $(this).attr("accesskey")+'</strong>';
			$("body").append("<span class='tooltip'>"+ this.t + "<em>"+this.a +"</em></span>");
		}
		else {*/
			$("body").append("<span class='tooltip'>"+ this.t +"</span>");
		/*}*/
		var footer = $(this).parents("#footer").text();
		if (footer) {
			xOffset = 23;
			yOffset = 0;
		}
		else {
			xOffset = -23;
			yOffset = 0;
		}
		$(".tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.css("opacity","0.9")
			.css("z-index","100000")
			.fadeIn("slow");
	},
	function(){
		this.title = this.t;
		$(".tooltip").remove();
	});
	$("a[title], button[title]").mousemove(function(e){
		
		var footer = $(this).parents("#footer").text();
		if (footer) {
			xOffset = 23;
			yOffset = 0;
		}
		else {
			xOffset = -23;
			yOffset = 0;
		}
		$(".tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
};



// starting the script on page load
$(document).ready(function(){
	tooltip();
});
$(document).ready(function(){
	$("a[title] img").title = "";
});