$(document).ready(function() {

//FOR IE7 - Add mouseout function, browser doesnt pickup onmouseleave
  if (jQuery.browser.msie && parseInt(jQuery.browser.version) == '7'){
	  $('#nav-main a').mouseout(function(){
        $(this).removeClass("dd-on");
		$(this).css('z-index', '999');
		$('ul:first',this).css('visibility', 'hidden');
		if ($('body').hasClass('about')){
				$('#nav-main-02 ul.nav-sub').css('visibility', 'visible');
				//$('#nav-main-02 ul ul').css('visibility', 'hidden');
			}
		else if($('body').hasClass('shows-tickets')){
				$('#nav-main-03 ul.nav-sub').css('visibility', 'visible');
				//$('#nav-main-03 ul ul').css('visibility', 'hidden');
			}
		else if($('body').hasClass('plan-your-visit')){
				$('#nav-main-04 ul.nav-sub').css('visibility', 'visible');
				//$('#nav-main-04 ul ul').css('visibility', 'hidden');
			}			
		else if($('body').hasClass('education')){
				$('#nav-main-05 ul.nav-sub').css('visibility', 'visible');
				//$('#nav-main-05 ul ul').css('visibility', 'hidden');
			}
		else if($('body').hasClass('support')){
				$('#nav-main-06 ul.nav-sub').css('visibility', 'visible');
				//$('#nav-main-06 ul ul').css('visibility', 'hidden');
			}
		else if($('body').hasClass('new-play')){
				$('#nav-main-07 ul.nav-sub').css('visibility', 'visible');
				//$('#nav-main-07 ul ul').css('visibility', 'hidden');
			}
		else if($('body').hasClass('news-press')){
				$('#nav-main-08 ul.nav-sub').css('visibility', 'visible');
				//$('#nav-main-08 ul ul').css('visibility', 'hidden');
			}
		});
	}
	
	
  //Set the #event-info	slider
	
  //$('#event-info').load("/event-info/oklahoma.txt");

  var month= ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
  var myDate = new Date();
    $("#event-date span").text(" ");//month[myDate.getMonth()]+ ' ' + myDate.getDate() + ', ' + myDate.getFullYear());
	
    //$("#datepicker").datepicker();
	/*$(".right-column #datepicker").datepicker({ 
			dayNamesMin: ['S', 'M', 'T', 'W', 'T', 'F', 'S'] , 
			showOtherMonths: true,
			dateFormat: 'M d, yy',
			//gotoCurrent: true,
			//defaultDate: '66 22,10',
			maxDate: 'Dec 31, 2010',
			onSelect: function(dateText, inst) { 
				//getCalEvents(dateText);
			    $('#event-date span').text(dateText);
				if(dateText =='Oct 23, 2010'){$('#event-info').load("/event-info/homecoming.txt");  $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px');}
				else if(dateText =='Oct 25, 2010'){$('#event-info').load("/event-info/gala.txt"); $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px'); }
				else if(dateText =='Nov 1, 2010'){$('#event-info').load("/event-info/no-events.txt"); $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px'); }
				else if(dateText =='Nov 8, 2010'){$('#event-info').load("/event-info/no-events.txt"); $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px'); }
				else if(dateText =='Nov 15, 2010'){$('#event-info').load("/event-info/no-events.txt");  $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px');}
				else if(dateText =='Nov 22, 2010'){$('#event-info').load("/event-info/no-events.txt");  $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px');}
				else if(dateText =='Nov 25, 2010'){$('#event-info').load("/event-info/no-events.txt"); $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px'); }
				else if(dateText =='Nov 29, 2010'){$('#event-info').load("/event-info/no-events.txt"); $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px'); }
				else if(dateText =='Dec 6, 2010'){$('#event-info').load("/event-info/no-events.txt"); $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px'); }
				else if(dateText =='Dec 13, 2010'){$('#event-info').load("/event-info/no-events.txt"); $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px'); }
				else if(dateText =='Dec 20, 2010'){$('#event-info').load("/event-info/no-events.txt");  $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px');}
				else if(dateText =='Dec 25, 2010'){$('#event-info').load("/event-info/no-events.txt"); $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px'); }
				else if(dateText =='Dec 27, 2010'){$('#event-info').load("/event-info/no-events.txt"); $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px');}
				
				//OKLAHOMA + EVERY TONGUE CONFESS
				else if(dateText =='Nov 9, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Nov 10, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Nov 11, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Nov 12, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Nov 13, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Nov 14, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
			    else if(dateText =='Nov 16, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Nov 17, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Nov 18, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Nov 19, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Nov 20, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Nov 21, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Nov 23, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Nov 24, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Nov 26, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Nov 27, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Nov 28, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Nov 30, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
			    else if(dateText =='Dec 1, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 2, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 3, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 4, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 5, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 7, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
			    else if(dateText =='Dec 8, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 9, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 10, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 11, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 12, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 14, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
			    else if(dateText =='Dec 15, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 16, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 17, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 18, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 19, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 21, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
			    else if(dateText =='Dec 22, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 23, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 24, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				else if(dateText =='Dec 26, 2010'){$('#oklahoma-every-tongue-info').css('left','0px'); $('#event-info').css('left','-99999px');}
				
				//EVERY TONGUE CONFESS
				else if(dateText =='Dec 28, 2010'){$('#event-info').load("/event-info/every-tongue-confess.txt"); $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px'); }
				else if(dateText =='Dec 29, 2010'){$('#event-info').load("/event-info/every-tongue-confess.txt"); $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px');}
				else if(dateText =='Dec 30, 2010'){$('#event-info').load("/event-info/every-tongue-confess.txt"); $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px'); }
				//else if(dateText =='Dec 31, 2010'){$('#every-tongue-let-me-down-info').css('left','0px'); $('#event-info').css('left','-99999px'); $('#oklahoma-every-tongue-info').css('left','-99999px');}
				else {$('#event-info').load("/event-info/oklahoma.txt"); $('#event-info').css('left','0px'); $('#oklahoma-every-tongue-info').css('left','-99999px');}
			}
	});
	*/
  });

	   showMarqueControls = function(){
		   $('.left-column #start-stop').fadeIn('slow');
		   };
   
      initEvents = function (){
		  
		   $('.right-column .anythingSlider').anythingSlider({
                easing: "swing",        // Anything other than "linear" or "swing" requires the easing plugin
                autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
                delay: 3000,                    // How long between slide transitions in AutoPlay mode
                startStopped: true,            // If autoPlay is on, this can force it to start stopped
                animationTime: 320,             // How long the slide transition takes
                hashTags: false,                 // Should links change the hashtag in the URL?
                buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
        		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
        		//startText: "Play",             // Start text
		        //stopText: "Stop",               // Stop text
		        navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
            });
		  };
	
        function formatText(index, panel) {
		  return index + "";
	    }
   
    
        $(function () {
        
            $('#production-slider').anythingSlider({
                easing: "swing",        // Anything other than "linear" or "swing" requires the easing plugin
                autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
                delay: 5000,                    // How long between slide transitions in AutoPlay mode
                startStopped: true,            // If autoPlay is on, this can force it to start stopped
                animationTime: 500,             // How long the slide transition takes
                hashTags: false,                 // Should links change the hashtag in the URL?
                buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
        		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
        		startText: "Play",             // Start text
		        stopText: "Stop",               // Stop text
		        navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
            });
		
            $('.left-column .anythingSlider').anythingSlider({
                easing: "swing",        // Anything other than "linear" or "swing" requires the easing plugin
                autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
                delay: 5000,                    // How long between slide transitions in AutoPlay mode
                startStopped: false,            // If autoPlay is on, this can force it to start stopped
                animationTime: 700,             // How long the slide transition takes
                hashTags: false,                 // Should links change the hashtag in the URL?
                buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
        		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
        		startText: "Play",             // Start text
		        stopText: "Stop",               // Stop text
		        navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
            });
            
            $('.right-column .anythingSlider').anythingSlider({
                easing: "swing",        // Anything other than "linear" or "swing" requires the easing plugin
                autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
                delay: 3000,                    // How long between slide transitions in AutoPlay mode
                startStopped: true,            // If autoPlay is on, this can force it to start stopped
                animationTime: 320,             // How long the slide transition takes
                hashTags: false,                 // Should links change the hashtag in the URL?
                buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
        		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
        		//startText: "Play",             // Start text
		        //stopText: "Stop",               // Stop text
		        navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
            });
			
            $('#view-production-media .anythingSlider').anythingSlider({
                easing: "swing",        // Anything other than "linear" or "swing" requires the easing plugin
                autoPlay: false,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
                delay: 3000,                    // How long between slide transitions in AutoPlay mode
                startStopped: true,            // If autoPlay is on, this can force it to start stopped
                animationTime: 320,             // How long the slide transition takes
                hashTags: false,                 // Should links change the hashtag in the URL?
                buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
        		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
        		//startText: "Play",             // Start text
		        //stopText: "Stop",               // Stop text
		        navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
            });
			
		 //VIEW CALENDAR TOGGLE
         $('#btn-view-calendar').click(function() {
		 	if($(this).hasClass('calendar-active')){
			$('#view-media').css('left','-99999px');
			  $('#view-calendar').css("left","-9999px");
			  $('#btn-view-calendar').removeClass('calendar-active');
			  $('#calendar-bg').remove();
			}
			else{
			  $('#content').append("<div id='calendar-bg'></div>");
			  $('#view-calendar').css("left","739px");
			  $('#view-calendar').animate({"left": "719px"}, "fast");
			  $('#btn-view-calendar').addClass('calendar-active');
			  
			  }
			});
		/*VIEW MEDIA LAUNCH*/
		$('.events-btns a.media').click(function() {
									 
			$('#view-media').css('left','20px');
			$('#view-media').animate({"left": "0px"}, "fast");
			//var eventbtns =  $(this).parent();
			var productionTitle = $(this).attr("id");	
			//alert(productionTitle);
			var productionPath = "/shows-tickets/the-season/productions/" + productionTitle + "/show-media/";
			$('#view-media #production-media').attr('src',productionPath );
		});	
		
		//VIEW MEDIA CLOSE
		$('#view-media .close').click(function() {
			$('#view-media #production-media').attr('src'," " );
			$('#view-media').css('left','-99999px');
		});
		

		//CHANGE MEDIA 
		$('#view-production-media .anythingSlider li a').click(function() {
			if ($(this).hasClass('video')){
				var videoUrl=$(this).children('img').attr('alt');
				//alert(videoUrl);
				$('.media-player').html("<object width='305' height='183'><param name='movie' value='http://www.youtube.com/v/" + videoUrl + "'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/" + videoUrl + "' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='305' height='183'></embed></object>")
			}
			else{
				var imageSrc=$(this).children('img').attr('src');
				$('.media-player').html("<img src='" + imageSrc + "' alt='' />");
			}
		});	
		
		/*PRODUCTION ARTWORK ENLARGE*/
		$('.enlarge').click(function() {
			var imgTitle = $(this).attr("title").toLowerCase();
			imgTitle = imgTitle.replace(/[^a-zA-Z 0-9]+/g,'');
			imgTitle = imgTitle.replace(/ /g, '-');
			imgPath = "/shows-tickets/the-season/productions/" + imgTitle + "/images/" + imgTitle + "-enlarge.jpg";
			$('.content-productions').append("<div id='enlarge-bg'></div>");
			$('#enlarge-bg').append("<div id='enlarge'><img src='"+ imgPath +"'/></div>");
			$('#enlarge').fadeIn(600);
			$('#enlarge').append("<a href='javascript:closeEnlarge();' id='close-enlarge'></a>");
		});	
		
		closeEnlarge = function() {
			$(this).remove();
			$('#enlarge').fadeOut(200);
			$('#enlarge').remove();
			$('#enlarge-bg').fadeOut(300);
			$('#enlarge-bg').remove();
		};

	});


