// JavaScript Document

$(document).ready(function(){ 		
	
	// slideshow
	$(".slidex").css("display","none");	 // Hide for Slideshow to work nicely
	$("#hmpgNavi").tabs("#panes > div.slide", {effect: 'fade', fadeInSpeed: 600, fadeOutSpeed: 600, rotate: true}).slideshow({autoplay: true, autopause: true, interval: 8000, clickable:false});	

	
    // Preload Images
	$.preloadCssImages();

});


	//Ticker
	$('#ticker').cycle({
		fx: 'fade',
		timeout: 5000,
		cleartype: true, 
		cleartypeNoBg: true
		
});

	//Logos
	 $('#cusLogos').cycle({ 
        fx:      'fade', 
        timeout:  3000,
		cleartype: true, 
		cleartypeNoBg: true,
		before:   onBefore 
    }); 
 
    // set totalSlideCount var; 
    // we'll be adding slides beach3.jpg - beach8.jpg to the slideshow 
    var totalSlideCount = 9; 
     
    function onBefore(curr, next, opts) { 
        // on the first pass, addSlide is undefined (plugin hasn't yet created the fn); 
        // when we're finshed adding slides we'll null it out again 
        if (!opts.addSlide) 
            return; 
 
        // on Before arguments: 
        //  curr == DOM element for the slide that is currently being displayed 
        //  next == DOM element for the slide that is about to be displayed 
        //  opts == slideshow options 
             
        var currentImageNum = parseInt(next.src.match(/logo(\d)/)[1]); 
             
        if (currentImageNum == totalSlideCount) { 
            // final slide in our slide slideshow is about to be displayed 
            // so there are no more to fetch 
            opts.addSlide = null; 
            return; 
        } 
         
        // add our next slide 
        opts.addSlide('<img src="/images/logos/logo'+(currentImageNum+1)+'.png" width="225" height="160" />'); 
    }; 
