	
$(document).ready(function(){
	$("#ctas .cta:last").addClass("last");//add no margin class to last CTA on homepage
	$("h3.faq:first").addClass("first");//add no margin class to last CTA on homepage

	$("img.reflect").reflect({height: 0.1, opacity: 0.25} );	
	
	
	$("#feature").easySlider({numeric: true});
	$("#rentalFeature").easySlider({numeric: true});
	$("#detailFeature").easySlider({numeric: true});
	$("#rentalBanner").easySlider({numeric: true});
	

	$("a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'}); //Lightbox
	$('#eventsScroller').jScrollPane({scrollbarWidth:9, scrollbarMargin:5, showArrows:true});//Scrollbar on homepage

	//***************************************************
	//EVENT LISTINGS
	//***************************************************ß
	//Make full cells of event listing clickable
	$('.entry').each(function () {												   
		var href = $(this).find('li.detail a').attr('href');
		$(this).attr('href', href);
	});
	$('.entry').click(function(evt){
		window.location = $(this).attr("href");
	});
	
	
	/** Twitter */
	$('ul#twitter_update_list li a:last').addClass("hidden");
	
	//***************************************************
	//CTA'S
	//***************************************************
	$('.cta').each(function () {						
		//alert(src);
		$(this).find('span').stop().animate({opacity: 0, top: '4', left:'4', height:'50%', width:'80%'}, 0);
			$(this).hover(function () {		
				$(this).find('span').stop().animate(
					{opacity: 1, top: '4', left: '4', height:'100%', width:'100%'}, 
					{queue:false, duration:500, easing: 'easeOutQuart'}
					);
			}, function () {
				$(this).find('span').stop().animate(
					{opacity: 0, top: '4', left: '4', height:'50%', width:'80%'}, 
					{queue:false, duration:500, easing: 'easeOutQuart'}
					);
			});
			if($.browser.msie && parseInt($.browser.version) == 7){
				$(this).find('span').click(function(){
					window.location = $(this).parent().attr("href");									 
				});
			}
	});
	
	//***************************************************
	//SELECT BOXs
	//***************************************************
	$('#plc_lt_zoneContent_pageplaceholder_pageplaceholder_lt_zoneMain_EventFilterQryRptr_month').selectbox({
		inputClass: 'selectbox',
		containerClass: 'selectbox-wrapper'
	});
	$('#plc_lt_zoneContent_pageplaceholder_pageplaceholder_lt_zoneMain_EventFilterQryRptr_year').selectbox({
		inputClass: 'selectbox',
		containerClass: 'selectbox-wrapper'
	});	
	
	$('#plc_lt_zoneContent_pageplaceholder_pageplaceholder_lt_zoneMain_BizForm_viewBiz_ctl00_dob_ddlDay').selectbox({
		inputClass: 'selectbox',
		containerClass: 'selectbox-wrapper'
	});
	$('#plc_lt_zoneContent_pageplaceholder_pageplaceholder_lt_zoneMain_BizForm_viewBiz_ctl00_dob_ddlMonth').selectbox({
		inputClass: 'selectbox',
		containerClass: 'selectbox-wrapper'
	});	
	
	$('#plc_lt_zoneContent_pageplaceholder_pageplaceholder_lt_zoneMain_BizForm_viewBiz_ctl00_dob_ddlYear').selectbox({
		inputClass: 'selectbox',
		containerClass: 'selectbox-wrapper'
	});	
	
	
	//***************************************************
	//MAIN NAV
	//***************************************************
	
	//Dynamically add 'mnav' class to a tags, this is for IE rollovers
	$('#mnav ul li a').each(function () {	
		$(this).attr('class', 'mnav');
	});	
	
	$(function(){
        $('li#MainNav_LI_0_2_1 a').click(function(){
            window.open(this.href);
            return false;
        });
		$('ul#twitter_update_list li a').click(function(){
			window.open(this.href);
			return false;
		});

    });
	
	//Main Nav load animations
	var obj = $('#mnav ul li');
	var arr = $.makeArray(obj);
	var i = 0;
	function fadeNav(i){
		if(i <arr.length){
			var e = $(arr[i]);
			e.fadeIn(150, function() {
				i++
				fadeNav(i);
			});
		}
	}
	fadeNav(i);	
	
	//Check for IE browser, disable jquery if so
	if(jQuery.browser.msie){
		//alert("IE");
	}else{	
		//alert("elsE");
		//Main Nav Transitions
		$('#mnav ul li:not(.selected)').find('a').removeClass('mnav').append('<span class="hover" />').each(function () {	
			var $span = $('> span.hover', this).css('opacity', 0);													
			$span.stop().animate({top: '1'});																																														
			$(this).hover(function () {		
				// on hover
				//$span.stop().fadeTo(300, 1);
				$span.stop().animate({opacity: 1, top: '-1'}, 150);
			}, function () {
				// off hover
				$span.stop().animate({opacity: 0, top: '1'}, 150);
			});
		});
	}
	
	// TICKETMASTER HOVER
//	$('#ticketmaster').css('opacity', 0);
//	var ticketmasterPos = $('#mnav').offset();
//	var navWidth = $('#MainNav_LI_0_1_1').width()/2;
//	var ticketmasterWidth = $('#ticketmaster').width()/2;
//	var ticketmasterLeft = ticketmasterPos.left;
//	$('#ticketmaster').css("top", -38);	
//	$('#ticketmaster').css("left", 35);
//	$('#MainNav_LI_0_1_1').mouseover(function(evt){			        
//	  	$('#ticketmaster').stop().animate({opacity: 1, top: - 34}, 200);	
//      });
//	
//	$('#MainNav_LI_0_1_1').mouseout(function(evt){
//		var exitY = ticketmasterPos -50;
//	  	$('#ticketmaster').stop().animate({opacity: 0, top: - 38}, 200);				  
//	});
	
		
	/*
	function fadeIn(e){
		$(e).stop(true, true).fadeTo(250, 1);
	}
	function fadeOut(e){
		$(e).stop(true, true).fadeTo(250, 0.7);
	}
	*/
	
	
	//***************************************************
	//PHOTO GALLERIES
	//***************************************************
/*

	 $("#rentalFeature ul li img").each(function(){$(this).hide();});
     $("#rentalFeature ul li img").eq(0).css("display", "block");
     
	        
	        $("div#rentalFeatureContainer ol#controls li a").each(function(i) {
                  $(this).bind('click', {index:i}, function(e){
                     currentImg = e.data.index;  
                     updateImage(currentImg);
                  });
            });   
            
            function updateImage(e){
                $("#rentalFeature li img").fadeOut("slow");
              
                $("#rentalFeature li img").eq(e).fadeIn("slow");
                $("#rentalFeature li img").lazyload({         
                     placeholder : "/SonyCentre/images/imgGalleryPlaceholder.png",
                     effect: "fadeIn"
                });
                
                 currentControl = (parseInt(e) + 1);

                $("div#rentalFeatureContainer ol#controls li").removeClass("current");                
                $("div#rentalFeatureContainer ol#controls li#controls"+currentControl).addClass("current");
            }
*/

      //***************************************************
      // Contest
      //***************************************************
      $("#contestContent .ImageButton").hover(
	      function() {
	          $(this).attr("src", $(this).attr("src").replace("_off", "_on"));
	      },
	      function() {
	          $(this).attr("src", $(this).attr("src").replace("_on", "_off"));
	      }
	  );

	  /*$("#contestContent .FormButton").hover(
	      function() {
	          $(this).attr("src", $(this).attr("src").replace("_off", "_on"));
	      },
	      function() {
	          $(this).attr("src", $(this).attr("src").replace("_on", "_off"));
	      }
	  );*/

	      $('#contestContent .contestSelectbox').selectbox({
	          inputClass: 'selectbox',
	          containerClass: 'selectbox-wrapper'
	      });	
				
				
});
