 $.validator.addMethod("valueNotEquals", function(value, element, arg){
  return arg != value;
 }, "Please enter a valid entry");




$(document).ready(function() {



function validateform (){	
$("#comment_form").validate({
		rules: {
			name: {
				 valueNotEquals: "John Smith" 
			},
			email: {
				 valueNotEquals: "your-name@email.com" 
			}
			
			
		}
	});
	
	
	
var default_values = new Array();
$("input").focus(function() {
    if (!default_values[this.id]) {
      default_values[this.id] = this.value;
    }
    if (this.value == default_values[this.id]) {
      this.value = '';
    }
    $(this).blur(function() {
      if (this.value == '') {
         this.value = default_values[this.id];
      }
    });
});
		
}

validateform();


$(".label").hide();

















function codaBub2(){
		
	$(".comment-author").hover(function() {
		$(this).find("div").stop()
		.animate({top: "-120px", opacity:1}, "fast")
		.css("display","block")

	}, function() {
		$(this).find("div").stop()
		.animate({top: "-100px", opacity: 0}, "fast")
	});
	Cufon.replace('.comments h2, .comment-date, #comment_form label, #episode-h2');
	

};
					   						   
function imageslo(){			   
						   
var $images = $(".content img");
	if ($images.length) {
		var imageCount = $images.length;
		var imageLoadedCount = 0;
				
	   $images.each(function() {
			$(this).load(function() {
				imageLoadedCount += 1;
			});
		});

	var intervalId = setInterval(function() {
		if (imageCount == imageLoadedCount) {
			clearInterval(intervalId);
			$(".content").slideDown();
			$(".load").html('');
			imageCount=0;
			codaBub2();
			expander();
			validateform();
		 };
	}, 200);
}		
};

function expander(){

 $('.comment-ind .spiel').expander({
    slicePoint:       115,  // default is 100
    expandText:         '[... Read full comment]', // default is 'read more...'
    collapseTimer:    0, // re-collapses after 5 seconds; default is 0, so no re-collapsing
    expandEffect:     'fadeIn',
    userCollapseText: '[^ Collapse]'  // default is '[collapse expanded text]'
  });
};



					
						   
						  			   
$(".load-a").live('click',function(event) {
		var removeHashChar = this.hash;
		removeHashChar = removeHashChar.replace('#', '.');
		var urlNoHash  = urlNoHash = this.href;
		urlNoHash = urlNoHash.replace(this.hash, '');
		var loadurl2 = urlNoHash +" "+removeHashChar;
		$(".load").remove();
		$(".content").remove();
		$(".close").remove();
		
		if (removeHashChar==".episode-content"){
			$(".content-holder div").removeClass("divopen");
			$(".load-a").show();
			$(this).parent().addClass("divopen");
			$('.divopen .load-a').hide();
			$(this).show();
			
		} else {
			$(".load-a").fadeIn();
		}

		
		
		$(this).parent().parent().append('<div class="load"></div><div class="content"></div>');
		$(this).parent().append('<a href="/tester" class="close">Close</a>');	
		$(".load").html('<img src="/images/ani-gif-1.gif" />');
		$(".content").load(loadurl2, null, function(){
					imageslo();		
		});
		
		event.preventDefault();
		
		
		$(this).hide();
			$(".close").click(function(event) {
				$(".load-a").fadeIn();
				$(".load").remove();
				$(".content").slideUp();
				$(".more div").removeClass("divopen");
				event.preventDefault();
				$(this).remove();
			}); 

});




  if (('#inner-page .comment-author').length) {
  		codaBub2();
  		expander();
  }
  
  
  
  
  function rss(){
  
 	var name = "#rss";
	var menuYloc = null;
	$('#rss').css({'top':'450px'});
	
	menuYloc = parseInt($(name).css("top").substring(0,$(name).css("top").indexOf("px")))
	$(window).scroll(function () { 
		offset = menuYloc+$(document).scrollTop()+"px";
		$(name).hide().animate({top:offset},{duration:500,queue:false}).fadeIn(2000);
	});
	
	}
	
	


/*	
	
	function checkWindow(){
			
	 var w = $(window).width();
	
		if 	(w > 1200){
				rss();
		}	
			
	}
	
	
	


var resizeTimer = null;
$(window).bind('resize', function() {
    if (resizeTimer) clearTimeout(resizeTimer);
    resizeTimer = setTimeout(checkWindow, 100);
});

*/


rss();



$('.tweet').each(function(){
	var $this = jQuery(this);
	$this.attr('href', $this.attr('href').replace(/Enjoying_short_video_tutorial:/g, 'Liking Usable Efficiency Video Episodes: '));
});
    
 





$('.external').click(function(){
			window.open(this.href);
			return false;
	});
	




	
});			   
