// Credits: Robert Penners easing equations (http://www.robertpenner.com/easing/).
jQuery.easing['BounceEaseOut'] = function(p, t, b, c, d) {
	if ((t/=d) < (1/2.75)) {
		return c*(7.5625*t*t) + b;
	} else if (t < (2/2.75)) {
		return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
	} else if (t < (2.5/2.75)) {
		return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
	} else {
		return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
	}
};

jQuery(document).ready(function() {
    
	// carousel trigger	
	jQuery('#mycarousel').jcarousel({
        easing: 'BounceEaseOut',
        animation: 400
    });

	// carousel hover
	$("#mycarousel LI").hover(function(){
	  $(this).addClass("hover");
	},function(){
	  $(this).removeClass("hover");
	});
	
	// carousel hover 2
	$("#mycarousel LI A IMG").hover(function(){
	  var title = $(this).attr("alt");
  	  var description = $(this).attr("title");
	  $("#descTitle").html(title);
	  $("#descDescription").html(description);
	},function(){
	  $("#descTitle").empty();
	  $("#descDescription").empty();
	});
	
	// results hover
	$(".contentResults LI").hover(function(){
	  $(this).addClass("hover");
	},function(){
	  $(this).removeClass("hover");
	});
	
	// searchbox hover
	$(".uiSearch INPUT").hover(function(){
	  $(this).addClass("hover");
	},function(){
	  $(this).removeClass("hover");
	});
	
	// searchbox focus
	var necum = "hledej vole..."
	var nula = ""
	
	$(".uiSearch INPUT").val(necum);
	$(".uiSearch INPUT").focus( function() {
		$(this).addClass("focus");
		$(this).val(nula);
	});
	$(".uiSearch INPUT").blur( function() {
	  $(this).removeClass("focus");
	  $(this).val(necum);
	});
	
	// menu imgs
	$(".containerMenu .uiMenu IMG").each(function(i){
	  this.src = "/wp-content/themes/ninjamonkeys/media/imgs/menu" + i + ".png";
	});
	$(".containerContact .uiMenu IMG").each(function(i){
	  this.src = "/wp-content/themes/ninjamonkeys/media/imgs/contmenu" + i + ".png";
	});
	$(".uiMenu IMG").attr("height","50");
	$(".uiMenu IMG").attr("alt","vendetta");	
	
	// menu hover
	$(".uiMenu IMG").hover(function(){
	  $(this).addClass("hover");
	},function(){
	  $(this).removeClass("hover");
	});
	
	// menu separators
	$(".containerMenu .uiMenu LI").before("<li class='mSep'></li>");
	
	// scroll pane
	$("#pane1").jScrollPane();
	
	// innerfade
	$("UL#portfolio").innerfade({
		speed: 2000,
		timeout: 15000,
		type: 'sequence',
		containerheight: '286px'
	});
	
	// add dot in H1
	$(".containerContent H1").append(".");

	// lightbox trigger
	$(function() {
        $("A.thickbox").lightBox();
    });
	
});
