/**
 * @author Christopher Wallace
 */

jQuery(window).load(function(){

  // Lazy Load images below the fold
  jQuery(".content img.thumbnail").lazyload();

  // The magic sliding panels
	jQuery('.entry-content a span.slide-title').css({
		opacity : '0.0'
	}).parent('a').append('<span class="cover-up"></span>');
	jQuery('.entry-content a').mouseover(function(e){
      jQuery(this).find('img.thumbnail').stop().animate({
	  	marginTop : '-75px'
	  }, 100).parent('a').find('span.slide-title').stop().fadeTo("slow",1.0);
	});
	jQuery('.entry-content a').mouseout(function(e){
      jQuery(this).find('img.thumbnail').stop().animate({
	  	marginTop : '0'
	  }, 100).parent('a').find('span.slide-title').stop().fadeTo("slow",0.0);
	});
  
  // Comment Author URL hover effect
  jQuery('.comment-author a.url').mouseover(function(e){
  	var url = jQuery(this).attr('href');
	jQuery(this).parent('span').append('<span class="hover-url">'+url+'</span>');
  })
  jQuery('.comment-author a.url').mouseout(function(e){
	jQuery(this).parent('span').find('.hover-url').remove();
  })
  
  jQuery('#footer .widgetcontainer:nth-child(3n+1)').addClass('reset');
  jQuery('.ie6 #footer .widgetcontainer:nth-child(3n+1),.ie7 #footer .widgetcontainer:nth-child(3n+1)').css({
    clear : 'left'
  });


});

jQuery(document).ready(function(){
 	// Fade in
	jQuery('.singular .entry-content img').hide(); jQuery('.singular .entry-content img').fadeIn(1700);});
    
function closeEyes() {
 	var vm =  jQuery('#viewmaster a');
  	// Blink duration between .1 second and 1 seconds
 	var bd = Math.floor(Math.random() * 200) + 150;

 	vm.removeClass('eyes_opened');
 	vm.addClass('eyes_closed');
 	setTimeout('openEyes()', bd);
    }

function openEyes() {
 	var vm =  jQuery('#viewmaster a');
    // Blink time between 1 second and 3 seconds
 	var bt = Math.floor(Math.random() * 10000) + 3000;

 	vm.removeClass('eyes_closed');
 	vm.addClass('eyes_opened');
 	setTimeout('closeEyes()', bt);
    }

jQuery(document).ready(function() {
	setTimeout('closeEyes()', 2000);
	jQuery('#viewmaster a').hover(
	    function () {
	        jQuery('#viewmaster a').addClass('eyes_wink');
	    },
	    function () {
	        jQuery('#viewmaster a').removeClass('eyes_wink');
	    }
	 );
});
	
 