$(document).ready(function() {
	$('#js_replace').hide();
	if( $( 'body.basicJS' ).size() == 0 ) {

		// Clear text when user focuses on search box
			$('#search input#keyword').click(function(){
				$('#search input#keyword').attr('value', ''); 
			});

		// Sponsor sliders 
			$('#pf-links .slider:not(:first)').hide();

			$('#pf-links').cycle({
			    fx:    'scrollLeft', 
                timeout:  0,
			   	next:   '#next1', 
		    	prev:   '#previous1'
			});
	
			$('#cp-links .slider:not(:first)').hide();
			$('#cp-links').cycle({
			    fx:    'scrollLeft', 
                speed:    600, 
                timeout:  4000,
			   	next:   '#next2', 
		    	prev:   '#previous2'
			});
	
			$('#others-links .slider:not(:first)').hide();
			$('#others-links').cycle({
			    fx:    'scrollLeft', 
                timeout:  0,
                next:   '#next3', 
		    	prev:   '#previous3'
			});
	
		// News Ticker
			$('.ticker').cycle({
				fx: 'fade',
				next: '.ticker-next',
				prev: '.ticker-previous'
			});
	
			$('.ticker-pause').toggle(function() {
				$('.ticker').cycle('pause');
				return false;
			}, function() {
				$('.ticker').cycle('resume', true);
				return false;
			});

		//Story Links 
			
			$('.story').click(function(){
				if(!$(this).hasClass('video_carousel'))
				{
					window.location.href = $(this).contents().find("a:first").attr('href');
				}
			});
	
			$('.story').mouseover(function(){
				$(this).toggleClass('alt');
			});
	
			$('.story').mouseout(function(){
				$(this).toggleClass('alt');
			});
/*	
			$('.video_carousel').click(function(){
				$("a#video_carousel_launcher").click();
				return false;
			});


			$('.close_tab, div#flash_background').click(function(){
				$(".flash-replaced embed").show();
				$('div#flash_object, div#flash_background').hide();
			});
*/
		// Partner Pop Ups
			$('.partner-info').hide();
			$('#partners li').mouseover(function(e){
				var box = $(this);
				var offset = box.offset();
				var boxtop=offset.top-(190)+"px";
				var boxleft=offset.left-(30)+"px";
				$('.partner-info',this).css({left:boxleft,top:boxtop}).show();
			});
	
			$('#partners li').mouseout(function(){
				$('.partner-info',this).hide();
			});
	
		// Go further roll overs for IE 6

		$('.box').hover(function(){
		       $(this).addClass('over');
		}, function() {
		       $(this).removeClass('over');
		});

		$('.alt').click(function(){
		       window.location.href = $(this).children('p.other-site').html();
		});


		// Homepage sIFR
			$('.taglines h3, h1.getsetFont').flash(
		        { 
		            src: '/assets/v2/flash/text-replacement/2012-font.swf', 
		            flashvars: { 
		                css: [
		                    '* { color: #0099ff; }'
		                ].join(' ')
		            }
		        },
		        { version: 7 },
		        function(htmlOptions) {
		            htmlOptions.flashvars.txt = this.innerHTML;
		            this.innerHTML = '<div>'+this.innerHTML+'</div>';
		            var $alt = $(this.firstChild);
		            htmlOptions.height = $alt.height();
		            htmlOptions.width = $alt.width();
		            $alt.addClass('alt');
		            $(this)
		                .addClass('flash-replaced')
		                .prepend($.fn.flash.transform(htmlOptions));						
		        }
		    );

	}

});

