jQuery(document).ready(function() {

	jQuery("ul.horiz-gallery li").css({"float":"left"});
	//jQuery("ul.horiz-gallery li h5").css("display","none");

	jQuery("ul.horiz-gallery li").hover(function(e) {
		var position = jQuery(this).position();
		//alert(position.left);
		//alert(position.top);
		var relativeX = position.left + 35 + "px"; //e.pageX - this.offsetLeft + "px";
		var relativeY = position.top + 35 + "px"; //e.pageY - this.offsetTop + "px";
		jQuery(this).children("h5").addClass("hover").css({"top":relativeY,"left":relativeX});
	}, 
	function() {
		jQuery(this).children("h5").removeClass("hover");
	});

	//resetting avatar images (undoing the gravatar default)
	jQuery(".avatar").each(function(i) {
		if(this.src) {
			var source = this.src;
			var height = this.height;
			if(height > 50) { height = 150; }
			else if(height > 20 <= 50) { height = 50; }
			else { height = 20; }
			if((source.indexOf("gravatar") > -1 && source.indexOf("e70c4cee02d8be6bb4fd85ac3b5a45e9") > -1) || source.indexOf("identicon") > -1) {
				switch(Math.floor(Math.random()*3+1)) {
					case 0:
						this.src = childDirectory + "_inc/images/avatar_"+height+"_x.jpg";
						break;
					case 1:
						this.src = childDirectory + "_inc/images/avatar_"+height+"_r.jpg";
						break;
					case 2:
						this.src = childDirectory + "_inc/images/avatar_"+height+"_x.jpg";
						break;
					default:
						//oops//
						this.src = childDirectory + "_inc/images/avatar_"+height+"_a.jpg";
				}
			}
		}
	});
	
});