// JavaScript Document
/* by Julio Acuņa */

$(document).ready(function(){
 
  $(".tabs li.over").each(function() {
	  var off = "off",
	      over = "over";
	    $(this).mouseover(function() {
			$(this).removeClass(over).addClass(off);
		       });
		$(this).mouseout(function() {
			$(this).removeClass(off).addClass(over);
		       });
      });
  
  var alto = $("#torre").height() + $("#gloss").height();
  $(".cols").height(alto);
  
  //$("ul#sliderContent").jqGalScroll({height:280,width:690,ease:'easeInOutCubic',speed:1000});
  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;
	}
  };
  
 	function initCallback(carousel) {
		
		$('.jqGSPagination ul li a.item').bind('click', function() {
		var anchors = $('.jqGSPagination ul li a');
		 for(var i=0; i < anchors.length; i++){
		  $(anchors[i]).removeClass('selected');
		 }
		 carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
		 $(this).addClass('selected');
		 return false;
		 });
		
		 }
		
		 function setActiveItem(item,ee,itemscroll,oo){
		 var anchors = $('.jqGSPagination ul li a');
		 for(var i=0; i < anchors.length; i++){
		 if($(anchors[i]).text() == (item.last)){
		  $(anchors[i]).addClass('selected');
		 }else {
		  $(anchors[i]).removeClass('selected');
		 }
		 }
		 }
		
	 
  jQuery('#sliderContent').jcarousel({
 	    initCallback: initCallback,
        auto: 10,
        scroll: 1,
		wrap: 'last',
		itemLoadCallback: {
         onAfterAnimation: setActiveItem
        }, 
		easing: 'BounceEaseOut',
        animation: 1000,
		buttonNextHTML: null,
		buttonPrevHTML: null
    });

		  
});
