/* Tooltip from CSS Globe written by Alen Grakalic (http://cssglobe.com) */
this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p class='itooltip'>"+ this.t +"</p>");
		$(".itooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn(300);		
    },
	function(){
		this.title = this.t;		
		$(".itooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$(".itooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

$(document).ready(function(){
	tooltip();
});

/////* */////

$(document).ready(function() {
	$("p.comments-toggle").click(function() {
		$("ol.commentlist").slideToggle(1000);
		return false;
	});
});


////* *////

/* http://www.learningjquery.com/2007/09/animated-scrolling-with-jquery-12 */
$(document).ready(function(){
  $('a.back-top').click(function() {
	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
	&& location.hostname == this.hostname) {
	  var $target = $(this.hash);
	  $target = $target.length && $target
	  || $('[name=' + this.hash.slice(1) +']');
	  if ($target.length) {
		var targetOffset = $target.offset().top;
		$('html,body')
		.animate({scrollTop: targetOffset}, 700);
	   return false;
	  }
	}
  });
});

////* *////

$(document).ready(function() {
	$("#respond p.error").hide();
	$("#respond button.commentsubmit").click(function() {
		var Name = $("input#author").val();
			if (Name == "") {
				$("#respond p.author").slideDown("fast");
				return false;
			}
		var Email = $("input#email").val();
			if (Email == "") {
				$("#respond p.email").slideDown("fast");
				return false;
			}
	});
	
	$("#respond input").focus(function() {
		$("#respond p.error").slideUp("fast");
	});
	$("#respond textarea").focus(function() {
		$("#respond p.error").slideUp("fast");
	});
		
});



$(document).ready(function() {
	$('a[href$=.jpg]').lightBox(); 
	$('a[href$=.gif]').lightBox();
	$('a[href$=.png]').lightBox();
});

