$.easing.custom = function (x, t, b, c, d) 
{ 
	var s = 1.70158;  
	if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 
	return c/2*((t-=2)*t*(((s*=(1.000))+1)*t + s) + 2) + b; 
}

this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// 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'>"+ this.t +"</p>");
		$("#tooltip")
			.delay(300)
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("slow");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

		
$(document).ready(function(){
	tooltip();
	
	//To switch directions up/down and left/right just place a "-" in front of the top/left attribute

	//Vertical Sliding
	$('.boxgrid.slidedown').hover(function(){
		$(".cover", this).stop().animate({top:'-260px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:900});
	});
	//Horizontal Sliding
	$('.boxgrid.slideright').hover(function(){
		$(".cover", this).stop().animate({left:'325px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
	});
	//Diagnal Sliding
	$('.boxgrid.thecombo').hover(function(){
		$(".cover", this).stop().animate({top:'260px', left:'325px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:300});
	});
	//Partial Sliding (Only show some of background)
	$('.boxgrid.peek').hover(function(){
		$(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
	});
	//Full Caption Sliding (Hidden to Visible)
	$('.boxgrid.captionfull').hover(function(){
		$(".cover", this).stop().animate({top:'-260px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:900});
	});
	//Caption Sliding (Partially Hidden to Visible)
	$('.boxgrid.caption').hover(function(){
		$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'260px'},{queue:false,duration:160});
	});
	
	
	// activate tabs
	$("#accordion").tabs("#accordion div", {
		tabs: 'img', 
		effect: 'horizontal',
			event:'mouseover'
	
	});
	
	
	
	if ( typeof(QueryLoader) != "undefined" )
	{
		QueryLoader.selectorPreload = "body";
		QueryLoader.init();
	}
	
	if ( typeof($().piroBox) != "undefined" )
	{
		$().piroBox({
			my_speed: 300, //animation speed
			bg_alpha: 1.0, //background opacity
			slideShow : true, // true == slideshow on, false == slideshow off
			slideSpeed : 5, //slideshow
			close_all : '.piro_close' // add class .piro_overlay(with comma)if you want overlay click close piroBox
		});
	}
	
	//$("#flowpanes").scrollable( {easing: 'custom', speed:800, size: 3} ).mousewheel(400).navigator();
	$("#flowpanes").scrollable({easing: 'custom', speed:800, circular:false});
});
