$(document).ready( function() {
									 


    $('a[rel="external"]').click( function() {
        window.open( $(this).attr('href') );
        return false;
    });
    
    $('a[rel="vodExternal"]').click( function() {
		window.open( $(this).attr('href'),"VOD",'width=570,height=750');
		window.location.href = "javascript:history.go(-3)"; //
		return false;
    });
   
   $('a[rel="vodExternal2"]').click( function() {
		window.open( $(this).attr('href'),"VOD",'width=570,height=750');
		return false;
    });
    
    //homepage article rotation
    $('#s4')  
	.cycle({ 
		fx:     'fade', 
		speed:  '300', 
		timeout: 5000, 
		pager:  '#feature-nav' 
	});
	
	  //homepage Promos rotation
    $('#promocycle1')  
	.cycle({ 
		fx:     'fade', 
		speed:  '300', 
		timeout: 5000, 
		pager:  '#promopages1' 
	});
	    $('#promocycle2')  
	.cycle({ 
		fx:     'fade', 
		speed:  '300', 
		timeout: 5000, 
		pager:  '#promopages2' 
	});
	    $('#promocycle3')  
	.cycle({ 
		fx:     'fade', 
		speed:  '300', 
		timeout: 5000, 
		pager:  '#promopages3' 
	});
	    $('#promocycle4')  
	.cycle({ 
		fx:     'fade', 
		speed:  '300', 
		timeout: 5000, 
		pager:  '#promopages4' 
	});
	    $('#promocycle5')  
	.cycle({ 
		fx:     'fade', 
		speed:  '300', 
		timeout: 5000, 
		pager:  '#promopages5' 
	});

	//image rotations on stories		
	$('#s2').cycle({
		fx:     'fade',
		speed:  'normal',
		timeout: 10000,
		next:   '#next2',
		prev:   '#prev2'
	});
	
	//accordion
	$('#showcalendar').accordion();
	
	// bind to change event of select to control first and seconds accordion
		// similar to tab's plugin triggerTab(), without an extra method
		var accordions = jQuery('#showcalendar');
		
		jQuery('#switch select').change(function() {
			accordions.accordion("activate", this.selectedIndex-1 );
		});
		jQuery('#close').click(function() {
			accordions.accordion("activate", -1);
		});
		jQuery('#switch2').change(function() {
			accordions.accordion("activate", this.value);
		});
		jQuery('#enable').click(function() {
			accordions.accordion("enable");
		});
		jQuery('#disable').click(function() {
			accordions.accordion("disable");
		});
		jQuery('#remove').click(function() {
			accordions.accordion("destroy");
			wizardButtons.unbind("click");
		});

});
