$(document).ready(function(){				
	
	// CAROUSEL
	$(function(){
		$("#carousel").carousel({
			loop: false,
			pagination: true,
			autoSlide: true,
			autoSlideInterval:8000,
			effect: "slide",
			animSpeed: 4000
		});
	});
	
	//SLIDE THE INFO AREA triggerCharity triggerUser
	  $("#toggleChalky").click(function () {
		$("#chalky").slideToggle({duration:'slow',easing:'easeOutBounce'});
		$(this).toggleClass("toggleIcon");
		return false;
		//$("#").toggleClass("active")
	  });
	  
	   $("#close").click(function () {
		$("#chalky").slideToggle('slow');
		return false;
	  });
	
	// ADD higlight to chalky butn
	$("#toggleChalkyAgain").click(function(){
		$('#toggleChalky').addClass('yellow');
		setTimeout(function() {
  					$('#toggleChalky').addClass().animate({"opacity": "0.5"}, "slow")
					
				}, 600);
		setTimeout(function() {
  					
					$('#toggleChalky').removeClass('yellow');	
				}, 900);
	});
	 
	//homepage logos innerfade
	$('#who-carousel ul').innerfade({
		speed: 1000,
		timeout: 3000,
		type: 'random_start',
		containerheight: '150px'
	});
	$('#mini-carousel').innerfade({
		speed: 1000,
		timeout: 9000,
		type: 'random_start',
		containerheight: '150px'
	});
	
	
	
	/*
	
	
	$('#triggerCharity').click(function(){
		
		$('#user').fadeOut(300).toggleClass('display');
		$('#charity').fadeIn(600).toggleClass('display');	
		// update message?
		$('#message').text("Charity");
	});
	
	$('#triggerUser').click(function(){
		$('#charity').fadeOut(300).toggleClass('display');
		$('#user').fadeIn(600).toggleClass('display');	
		// update message?
		$('#message').text("User");
	});
	
	// checkbox
	//$('input:radio').checkbox(); 
	
	// AJAX
	$('#post').click(function(){
		$.post("ajax.php", $("#vote").serialize(),function(result){
			
			//alert(result);
			
			if(result == " success"){	
				
				$('#message').fadeIn(500).toggleClass('display').delay(3000).fadeOut(300);
				$('#message').text("Thanks for voting");
				setTimeout(function() {
  					window.location.href = "index.php";
				}, 4000);
			}else{
				$('#message').fadeIn(500).toggleClass('display').delay(3000).fadeOut(300);
				$('#message').text(result);
			}
			
		});
	});
	
	//SLIDE THE INFO AREA triggerCharity triggerUser
	  $("#open").click(function () {
		$("#infoArea").slideToggle('slow');
		$(this).toggleClass("toggleIcon");
		return false;
		//$("#").toggleClass("active")
	  });
	  
	   $("#close").click(function () {
		$("#infoArea").slideToggle('slow');
		return false;
	  });
	
	// TOGGLE THE WIDTH OF THE CONTENT AREA
	 $("#width").click(function () {
		$("#right").toggleClass('addWidth',500);
		//$("#right").stop().animate({ width: '780px' }, 500);
		$(this).toggleClass("widthIcon");
		//return false;
		//$("#").toggleClass("active")
		
	  });
	
	*/
	
	// FADE THE IMAGES OUT ON ROLLOVER FOR THE THUMBNAILS
	

	$("#thumbs ul li a").hover(
	function() {
		$(this).find("img").stop().animate({"opacity": "0.3"}, "slow");
	},
	function() {
		$(this).find("img").stop().animate({"opacity": "1"}, "slow");
	});
	
});
