// $Id: index.js,v 1.1 2011/03/28 08:51:52 andy.f Exp $

/*List items set equal min heights*/

jQuery(document).ready(function() {

	//Feature panel
	 $('#offerFeatures > ul').tabs({ fx: { opacity: 'toggle' } }).tabs('rotate', 5000); // rotating tabs
	
jQuery("#content .offersPanel ul.offerBlockList").each(function(i) {

    var thisHeight=0;
    var tallestHeight=0;

    jQuery("li.offerBlock", this).each(function(i) {
    
		thisHeight=jQuery(this).height();
		 
                if (thisHeight > tallestHeight) {
        		tallestHeight=thisHeight;
                };   
    });

	jQuery("li.offerBlock", this).css("min-height", tallestHeight);	

    /*For ie6, use height rather than min-height*/
    if (jQuery.browser.msie && jQuery.browser.version == 6.0) {
   		jQuery("li.offerBlock", this).css("height", tallestHeight);
    };
		
});



/*TABS*/

/*Default action*/
	jQuery(".offersTab").addClass("tab_content").show(); //Add class to tab content
	jQuery("ul.tabs").addClass("activeTabs").show(); //Add class to tabs
	jQuery("ul.tabs li:first").addClass("active").show(); //Activate first tab
	jQuery(".tab_content").hide(); //Hide all content
	jQuery(".tab_content:first").show(); //Show first tab content
	

/*On mouseover event*/
	jQuery("ul.tabs li").mouseover(function() {
		jQuery("ul.tabs li").removeClass("hover"); //Remove any "hover" class
		jQuery(this).addClass("hover"); //Add "hover" class to selected tab
	});

/*On mouseout event*/
	jQuery("ul.tabs li").mouseout(function() {
		jQuery("ul.tabs li").removeClass("hover"); //Remove any "hover" class
	});	
	
/*On click event*/
	jQuery("ul.tabs li").click(function() {
		jQuery("ul.tabs li").removeClass("active"); //Remove any "active" class
		jQuery("ul.tabs li").removeClass("hover"); //Remove any "hover" class
		jQuery(this).addClass("active"); //Add "active" class to selected tab
		jQuery(".tab_content").hide(); //Hide all tab content
		var activeTab = jQuery(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		jQuery(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
	
});


