// JavaScript Document


///////////////////////////// MENU ///////////////////////////////////////


$(function() {
    $('.active').hover(
        function () {
            var $this = $(this);
            $('i',$this).stop(true,true).animate({
                    'top':'-11px'
                }, 400);
        },
        function () {
            var $this = $(this);
            $('i',$this).stop(true,true).animate({
                    'top':'100px'
                }, 400);
        }
    );
});

//////////////// Info tabs Prev / Next buttons ///////////////////////

$(function() {
	var $tabs = $('#tabs').tabs();
	$(".ui-tabs-panel").each(function(i){
		var totalSize = $(".ui-tabs-panel").size() - 1;
		if (i != totalSize) {
	      next = i + 2;
   		  $(this).append("<a href='#' class='next-tab' rel='" + next + "'><span>MORE</span></a>");
	  	}
		else {
			prev = i  -1;
   		  $(this).append("<a href='#' class='next-tab' rel='" + prev + "'><span>MORE</span></a>");
		}
		 
	});
	$('.next-tab').click(function() {
           $tabs.tabs('select', $(this).attr("rel"));
           return false;
       });
	});
	

///////////////////////////////// HOMEPAGE TABS ///////////////////////////////////////

$(function() {
	var $tabs = $('#tabsHome').tabs();
	$(".tabs-panel").each(function(i){
		var totalSize = $(".tabs-panel").size() - 1;
		if (i != totalSize) {
	      next = i + 2;
   		  $(this).append("<a href='#' class='next-tabHome' rel='" + next + "'></a>");
	  	}
		else {
			prev = i  -2;
   		  $(this).append("<a href='#' class='next-tabHome' rel='" + prev + "'></a>");
		}
		 
	});
	$('.next-tabHome').click(function() {
           $tabs.tabs('select', $(this).attr("rel"));
           return false;
       });
	});


/////////////////////////////// GALLERY BUTTONS /////////////////////////////////////////////

//$(function() { 
	//	$('#radio li').hover(
		//	function() {
		//		$( ".radio",this).addClass("state-hover",100);
		//	},
		//	function() {
	//			$( ".radio",this ).stop(true,true).removeClass("state-hover",100);
	//		}
//		);
//	});


$(function() { 
		$('.radio').click(
			function() {
				$( this ).addClass('ui-state-active', 600);
			}
		);
	});

///////////////////////  Changes #Mbacks background color according to menu item class /////////////////////////////////////
$(function() { 
		$('.white').click(
			function() {
				$( "#Mback" ).animate({backgroundColor: "#FFF"}, 1000);
			}
		);
	});

$(function() { 
		$('.black').click(
			function() {
				$( "#Mback" ).animate({backgroundColor: "#000"}, 1000);
			}
		);
	});

