/**
 * project: mailfrills.com
 * filename: intro_banner_scripts.js
 *
 * @author jeffrey tan (jeffrey_design@yahoo.com)
 * @version 1.0 on sep 2008
 * @copyright jeffrey tan. all rights reserved.
 */

jQuery(window).bind("load", function(){
		
		jQuery("div#intro-slider").codaSlider();		
		
		var theInt = null;
		var $crosslink, $navthumb;
		var curclicked = 0;
		
		theInterval = function(cur){
			
				clearInterval(theInt);
			
				if(typeof cur != 'undefined')
						curclicked = cur;
			
				$crosslink.removeClass("active-thumb");
				$navthumb.eq(curclicked).parent().addClass("active-thumb");
				$(".stripNav ul li a").eq(curclicked).trigger('click');
			
				theInt = setInterval(function(){
						$crosslink.removeClass("active-thumb");
						$navthumb.eq(curclicked).parent().addClass("active-thumb");
						$(".stripNav ul li a").eq(curclicked).trigger('click');
						curclicked++;
						if(4 == curclicked )
							curclicked = 0;
				
				}, 9000);
		};
		
		$navthumb = $(".nav-thumb");
		$crosslink = $(".cross-link");
		
		$navthumb.click(function() {
				var $this = $(this);
				theInterval($this.parent().attr('href').slice(1) - 1);
				return false;
		});
		theInterval();
});
