$(window).load(function () {
	/* Cufon */
	Cufon.replace('#nav a');
	Cufon.replace('span.su');
	Cufon.replace('.btn');
	Cufon.replace('.video-title');
	Cufon.replace('.author');
	Cufon.replace('#lbCaption');
	
	/* Media tabs */
	var tabContainers = $('#tabs > div.tab');
	tabContainers.hide().filter(':first').show();
	$('#tabs #media-options a').click(function () {
		tabContainers.fadeOut();
		tabContainers.filter(this.hash).fadeIn();
		$('#tabs #media-options a').removeClass('selected');
		$(this).addClass('selected');
		return false;
	}).filter(':first').click();
	
	/* Gallery thumbnails fade */
	var activeOpacity = 1.0, inactiveOpacity = 0.5, fadeTime = 500, thumbs = "ul.gallery li"; 
  $(thumbs).fadeTo(1, inactiveOpacity);
  $(thumbs).hover(function(){$(this).fadeTo(fadeTime, activeOpacity); }, function(){ $(this).fadeTo(fadeTime, inactiveOpacity); });
	
	/* JS for submit */
	$('a.btn').click(function() { $(this).parents('form').submit(); });
	
	/* SMooth scroll */
	$('a.top').click(function() {	$('html, body').animate({scrollTop: $("#index").offset().top}, 500); return false; });
	
	/* Contact form validation */
	$("#contact-form").validate();

});
