jQuery.noConflict();
jQuery(document).ready(
    function() {
		var iframeCode = "<iframe width='220' height='100' style='position:absolute; z-index:-1; top:0; left:0; border:0 none; opacity:0; filter:alpha(opacity=0);'></iframe>"
		jQuery("div.dropdown").hover(
			function () {
				jQuery(this).find(".dropdown-list").show();
				jQuery(this).find("a.navigation").addClass("hover");
				jQuery(this).find(".dropdown-list").append(iframeCode);
			}, 
			function () {
				jQuery(this).find(".dropdown-list").hide();
				jQuery(this).find("a.navigation").removeClass("hover");
				jQuery(this).find("iframe").remove();
			}
		);
		jQuery("div.dropdown ul li:even").addClass("alt");


		
		//EVENTS CALENDAR / LIST SWAP
		jQuery("#list").hide();
		jQuery("#calendar-link").click(
			function(){
					jQuery("#list").hide();	
					jQuery("#calendar").show();
					jQuery("#calendar-link-img").attr("src", "images/calendar-viewby-cal-on.gif");
					jQuery("#list-link-img").attr("src", "images/calendar-viewby-list-off.gif");
					return false;
			}
		);
		jQuery("#list-link").click(
			function(){
					jQuery("#calendar").hide();	
					jQuery("#list").show();	
					jQuery("#calendar-link-img").attr("src", "images/calendar-viewby-cal-off.gif");
					jQuery("#list-link-img").attr("src", "images/calendar-viewby-list-on.gif");
					return false;
			}
		);
		
		//TICKETS / SEATING CHARTS SWAP
		jQuery("#seating").hide();
		jQuery(".tickets-link").click(
			function(){
					jQuery("#seating").hide();	
					jQuery("#tickets").show();		
					return false;
			}
		);
		jQuery(".seating-link").click(
			function(){
					jQuery("#tickets").hide();	
					jQuery("#seating").show();
					return false;
			}
		);

		var i = 0;
        var maxCountBtn = 5;
        var currentCountBtn = jQuery("ul#feature-buttons a").length;
        var currentListHeight = jQuery("ul#feature-buttons").outerHeight(true)-jQuery(".feature-info").height();
        var parentHeight = jQuery("ul#feature-buttons").parent().height();
		
		jQuery("ul#feature-img li img:eq("+i+")").show();        
        (currentCountBtn != maxCountBtn) ? (jQuery(".feature-info").css("height",parentHeight-currentListHeight)) : (null);
        moveFeature();
        setInterval(moveFeature, 6000);
		
		function resetIndex(){
			jQuery("ul#feature-img li img").each(
				function(j){
					var maxIndex = 5;
					jQuery(this).css("zIndex",j);
					jQuery(this).hide();
					jQuery("ul#feature-img li img:eq(0)").show();    
				}
			);
		}
        
        function moveFeature(){
            var allBtn = jQuery("ul#feature-buttons a:not(:eq("+i+"))");
            var currentSelectedBtn = jQuery("ul#feature-buttons a:eq("+i+")");
            var allImg = jQuery("ul#feature-img li img:not(:eq("+i+"))");
            var currentSelectedImg = jQuery("ul#feature-img li img:eq("+i+")");
			test1();
			
			function test1(){
				jQuery(allBtn).removeClass("featurehighlightlink");
				jQuery(allBtn).next().slideUp("fast");
				jQuery(allBtn).animate({
					width: "210px",
					marginLeft: "0",
					backgroundPosition: "0"
				}, "fast", test2);
			}
            
			function test2(){
				jQuery(currentSelectedBtn).addClass("featurehighlightlink");
				jQuery(currentSelectedBtn).next().slideDown("fast");
				jQuery(currentSelectedBtn).animate({
					width: "260px",
					marginLeft: "-50px",
					backgroundPosition: "-210px 0"
				}, "fast");
			}
            
            i++;
            (i>=currentCountBtn) ? (i=0) : (resetIndex());
			
			jQuery(currentSelectedImg).fadeIn("fast");
			
        }
    }
)