// JavaScript Document

$(document).ready(function(){
	

	$('.quickstart .hover').css("opacity", "0");
	$(".quickstart a").hover(
	function() {
	$(this).find(".hover").stop().animate({"opacity": "1"},{queue:false, duration:250});
	$(this).find(".normal").stop().animate({"opacity": "0"},{queue:false, duration:500});
	},
	function() {
	$(this).find(".hover").stop().animate({"opacity": "0"},{queue:false, duration:500});
	$(this).find(".normal").stop().animate({"opacity": "1"},{queue:false, duration:250});
	});
 			   

		// Dropmenu								   
		$('#navigation ul ul').css({display: 'none'});
		$('#navigation ul ul ul').css({display: 'none'});

		$(function(){
			$("#navigation ul ul").css({display: "none"});
			$('#navigation ul li').hover(function(){
				$(this).find("ul:first").fadeIn(100);
			},
			function(){
				$(this).find("ul:first").fadeOut(125);
			});
		});

	// Animation logos
	$(".dragon_logo").css("top","-500px");
	$(".dragon_logo").delay(700).animate({ top:"40px" }).show();
	
	$(".kicker_logo").css("top","-500px");
	$(".kicker_logo").delay(700).animate({ top:"40px" },{
				  	queue: true,
				   	duration: 1000,
				   	easing: 'easeOutElastic'
	}).show();
	
	$(".lavallee_logo").css("opacity","0");
	$(".lavallee_logo").delay(500).animate({ opacity:"1" },{
				  	queue: true,
				   	duration: 2000
	}).show();


	$("#sidebar li").find("a").wrapInner("<span></span>");
	$("#sidebar li a").hover(function(){
		$(this).find("span").stop().animate({ paddingLeft:"10px" },{ easing: "easeInCubic", duration: 125});
	},function(){
		$(this).find("span").stop().animate({ paddingLeft:"0px" },{ easing: "easeOutBounce"});
	});


});

// Image loaded one by one
$(function () {
	$('#main img').hide();//hide all the images on the page
});

var i = 0;//initialize
var int=0;//Internet Explorer Fix
$(document).ready(function() {//The load event will only fire if the entire page or document is fully loaded
	var int = setInterval("doThis(i)",150);//500 is the fade in speed in milliseconds
});

function doThis() {
		var images = $('img').length;//count the number of images on the page
		if (i >= images) {// Loop the images
			clearInterval(int);//When it reaches the last image the loop ends
		}
		$('#main img:hidden').eq(0).fadeIn(350);//fades in the hidden images one by one	
		i++;//add 1 to the count
}

$(document).ready(function() {	
			$('#slides').cycle({ 
				fx:     'fade', 
				speed:   500, 
				timeout: 5000,  
				pause:   1,   
				next:   '#slideshowNext', 
				prev:   '#slideshowPrev',
				pager: '#slideshowNav',
				pagerAnchorBuilder: function(idx, slide) {
						return '<a href="#"><span>' + (idx+1) + '</span></a>';
					}		
			});
		});
