//Moving background
$(document).ready(function(){
	$('#midground').css({backgroundPosition: '0px 0px'});
	$('#foreground').css({backgroundPosition: '0px 0px'});
	$('#background').css({backgroundPosition: '0px 0px'});

	$('#midground').animate({
		backgroundPosition:"(-10000px -2000px)"
	}, 240000, 'linear');

	$('#foreground').animate({
		backgroundPosition:"(-10000px -2000px)"
	}, 120000, 'linear');

	$('#background').animate({
		backgroundPosition:"(-10000px -2000px)"
	}, 480000, 'linear');

});

// Navigation 1
$(document).ready(function(){	
	//Fix Errors - http://www.learningjquery.com/2009/01/quick-tip-prevent-animation-queue-buildup/	
	//Remove outline from links
	$("div#nav1 ul li a").click(function(){
		$(this).blur();
	});
	
	//When mouse rolls over
	$("div#nav1 ul li").mouseover(function(){
		$(this).stop().animate({height:'90px'},{queue:false, duration:600, easing: 'easeOutBounce'})
	});
	
	//When mouse is removed
	$("div#nav1 ul li").mouseout(function(){
		$(this).stop().animate({height:'40px'},{queue:false, duration:600, easing: 'easeOutBounce'})
	});
	
});

//headline
$(document).ready(function() {
	$('#coin-slider').coinslider({width: 560, height: 400});
});

// Coda-slider
$(document).ready(function() {
	$('#coda-slider-1').codaSlider({
		dynamicArrows: false
	});
});

//artist lightbox
$(document).ready(function() {
	$('#artist a').lightBox();
});

// Headlines !!!Deleted!!!
$(document).ready(function(){
	$(".main_image .desc").show(); //Show Banner
	$(".main_image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity
});

$(document).ready(function(){
	$(".image_thumb ul li:first").addClass('active'); //Add the active class (highlights the very first list item by default)
	$(".image_thumb ul li").click(function(){
		//Set Variables
		var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
		var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL
		var imgDesc = $(this).find('.block').html();  //Get HTML of the "block" container
		var imgDescHeight = $(".main_image").find('.block').height(); //Find the height of the "block"
	
		if ($(this).is(".active")) {  //If the list item is active/selected, then...
			return false; // Don't click through - Prevents repetitive animations on active/selected list-item
		} else { //If not active then...
			//Animate the Description
			$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() { //Pull the block down (negative bottom margin of its own height)
				$(".main_image .block").html(imgDesc).animate({ opacity: 0.85,  marginBottom: "0" }, 250 ); //swap the html of the block, then pull the block container back up and set opacity
				$(".main_image img").attr({ src: imgTitle , alt: imgAlt}); //Switch the main image (URL + alt tag)
			});
		}
		//Show active list-item
		$(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all list-items
		$(this).addClass('active');  //Add class of 'active' on the selected list
		return false; 
	
	}) .hover(function(){ //Hover effects on list-item 
		$(this).addClass('hover'); //Add class "hover" on hover 
		}, function() {
		$(this).removeClass('hover'); //Remove class "hover" on hover out
	});
});

$(document).ready(function(){
	$("a.collapse").click(function(){
		$(".main_banner .block").slideToggle(); //Toggle the description (slide up and down)
		$("a.collapse").toggleClass("show"); //Toggle the class name of "show" (the hide/show tab)
	});
});

//Form validation
$(document).ready(function(){
  $("#answerForm").validate();
});
