jQuery(document).ready(function() {

	//SCROLLING
	jQuery('a[href*=#]').click(function() {
			 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
			 && location.hostname == this.hostname) {
			   var $target = jQuery(this.hash);
			   $target = $target.length && $target
			   || jQuery('[name=' + this.hash.slice(1) +']');
			   if ($target.length) {
			  var targetOffset = $target.offset().top;
			  jQuery('html,body')
			  .animate({scrollTop: targetOffset}, 2000);
				return false;
			   }
			 }
	 });


 	//FADE IN
	//jQuery("#whiteness").fadeOut(1500);


	//LAZYLOAD
	jQuery(".thumbcontainer img").lazyload({         
		effect : "fadeIn",
		placeholder : "images/thumbs/holder.png"		
	 });


	//VIDEO FILTERS	
	jQuery("li.shorts").click(function () {
      jQuery("img.shorts").stop().fadeTo("fast", 1);
	  jQuery("img.music").stop().fadeTo("slow", 0.2);
	  jQuery("img.other").stop().fadeTo("slow", 0.2);
	  jQuery("li.shorts").css("text-decoration","underline");
	  jQuery("li.music").css("text-decoration","none");
	  jQuery("li.other").css("text-decoration","none");
	  jQuery("li.all").css("text-decoration","none");
	});
	jQuery("li.music").click(function () {
      jQuery("img.shorts").stop().fadeTo("slow", 0.2);
	  jQuery("img.music").stop().fadeTo("fast", 1);
	  jQuery("img.other").stop().fadeTo("slow", 0.2);
	  jQuery("li.shorts").css("text-decoration","none");
	  jQuery("li.music").css("text-decoration","underline");
	  jQuery("li.other").css("text-decoration","none");
	  jQuery("li.all").css("text-decoration","none");
	});
	jQuery("li.other").click(function () {
      jQuery("img.shorts").stop().fadeTo("slow", 0.2);
	  jQuery("img.music").stop().fadeTo("slow", 0.2);
	  jQuery("img.other").stop().fadeTo("fast", 1);
	  jQuery("li.shorts").css("text-decoration","none");
	  jQuery("li.music").css("text-decoration","none");
	  jQuery("li.other").css("text-decoration","underline");
	  jQuery("li.all").css("text-decoration","none");
	});	
	jQuery("li.all").click(function () {
      jQuery("img.shorts").stop().fadeTo("slow", 1);
	  jQuery("img.music").stop().fadeTo("slow", 1);
	  jQuery("img.other").stop().fadeTo("slow", 1);
	  jQuery("li.shorts").css("text-decoration","none");
	  jQuery("li.music").css("text-decoration","none");
	  jQuery("li.other").css("text-decoration","none");
	  jQuery("li.all").css("text-decoration","underline");	  
    });	
	jQuery("li.all").each(function () {
	  jQuery("li.all").css("text-decoration","underline");	  
    });	


	//NAV HOVERS
	jQuery("#menu li").each(function () {
      jQuery(this).stop().fadeTo("fast", 1);
    });	
   	jQuery("#menu li").mouseover(function () {
      jQuery(this).stop().fadeTo("fast", 0.7);
    });
	jQuery("#menu li").mouseout(function () {
      jQuery(this).stop().fadeTo(2000, 1);
    });
	jQuery("#print img").click(function () {
      jQuery(this).stop().fadeTo("fast", 0.2);
    });	
	jQuery(".arrows").each(function () {
      jQuery(this).stop().fadeTo("fast", 0.3);
    });	
   	jQuery(".arrows").mouseover(function () {
      jQuery(this).stop().fadeTo("fast", 0.8);
    });
	jQuery(".arrows").mouseout(function () {
      jQuery(this).stop().fadeTo("slow", 0.3);
    });
	
	
	//THUMB CAPTIONS
	jQuery('.thumbcontainer img').jcaption();



	//CONTACT FORM	
	jQuery('#name').autofill({
		value: 'Name',
		defaultTextColor: '#51332D',
		activeTextColor: '#000'
	});
	jQuery('#email').autofill({
		value: 'E-mail',
		defaultTextColor: '#51332D',
		activeTextColor: '#000'
	});
	jQuery('#phone').autofill({
		value: 'Phone Number',
		defaultTextColor: '#51332D',
		activeTextColor: '#000'
	});
	jQuery('#message').autofill({
		value: 'Your Message',
		defaultTextColor: '#51332D',
		activeTextColor: '#000'
	});	
	jQuery('#code').autofill({
		value: 'Please type the words in the image above.',
		defaultTextColor: '#51332D',
		activeTextColor: '#000'
	});		
	
	jQuery('#contactform').submit(function(){
 
		var action = jQuery(this).attr('action');
 
		jQuery('#submit')
			.attr('disabled','disabled');
 
		jQuery.post(action, { 
			name: jQuery('#name').val(),
			email: jQuery('#email').val(),
			phone: jQuery('#phone').val(),
			message: jQuery('#message').val(),
			code: jQuery('#code').val()
		},
			function(data){
				jQuery('#contactform #submit').attr('disabled','');
				jQuery('.response').remove();
				jQuery('#contactform').after('<span class="response">'+data+'</span>');
				jQuery('.response').slideDown();
				jQuery('#contactform img.loader').fadeOut(500,function(){jQuery(this).remove()});
				if(data=='Success!') jQuery('#contactform').slideUp();
			}
		);
 
		return false;
 
	});	
	
	
	
	
	
//END	
});
