/* var stopcounter = 0;
var stopped = false;
function hookafter()
{
	arg = arguments[2];
	if(!stopcounter && !stopped)
	{
		stopcounter = arg.countdown + 1;
		arg.autostop = 0;
	}
	if(stopcounter > 0) stopcounter = stopcounter - 1;
	if(!stopcounter) $('#mainstory_banner').cycle("stop"), stopped = true;
}
*/

//jQuery(document).ready(function() {
// jQuery(function($) {
				   
	// ---------------
	// DM - 2009-02-22
	// ---------------
		
		$(document).ready(function(){
				$('#billboard_caption_container').css('opacity', .85);
		});
		
			
		$(window).load(function() {
			 $('#mainstory_banner').cycle({ 
				fx: 'fade', 
				timeout: 9000,
				speed: 1000,
				next:   '#mainstory_next', 
				prev:   '#mainstory_prev',
				pause:       1,
				//autostop:    1,
				pagerClick:  function(i, nextSlide) {
					// alert("Pager button " + i + " was clicked");
					$('#billboard_caption_container').cycle(i);
				},
				pager:  '#mainstory_pager',
				
after: function(currSlideElement, nextSlideElement, options, forwardFlag){
	// alert("options.currSlide = " + options.currSlide);
	
		// options.currSlide returns the index of the current slide
		$('#billboard_caption_container').cycle(options.currSlide);
}

			 });
			 
			 
			 
			 $('#billboard_caption_container').cycle({ 
				// fx:   'scrollRight',
				fx:   'fade',
				timeout: 900000,
				speedIn: 500,
				
				before: function(currSlideElement, nextSlideElement, options, forwardFlag){
					
					if($(nextSlideElement).children('a').attr('name') != 1){
						$('#billboard_caption_container').fadeOut(500);
					}
				},
				
after: function(currSlideElement, nextSlideElement, options, forwardFlag){
	if($(nextSlideElement).children('a').attr('name') == 1){
		$('#billboard_caption_container').fadeIn(500);
	}
},

				speedOut: 500
			 });
			 
			 /*
			 $.fn.cycle.transitions = function(opts){
			 	alert("pisht...");
			 }
			 */
			 
			 
		});
	// --------
	// END - DM
	// --------

/* function slider()
{
	$('#mainstory_banner').cycle({ 
		fx:     'fade', 
		timeout: 2000,
		next:   '#mainstory_next', 
		prev:   '#mainstory_prev',
		pause:       1,
		autostop:    1,
			pagerClick:  function(i, nextSlide) {
			alert("Pager button " + i + " was clicked");
		},
		pager:  '#mainstory_pager'
 });
} */
//window.onload = slider;