var animating=new Array();
topLeft=0;
widthHeight=new Array();

function pseudoAnimate(t,s,f,d) {
	thisName=t.attr("id");
	animating[thisName]=true;
	widthHeight[thisName]=s+d;
	if (d>0) {
		topLeft=0;
	} else {
		topLeft=40;
	}
	t.animate({width:widthHeight[thisName],left:topLeft},100,function() {
		animating[$(this).attr("id")]=false;
	});
}

// JavaScript Document
function doMouseOver(e,t) {
	if (animating[t.attr("id")]==true) return;
	pseudoAnimate(t,112,180,80);
}

function doMouseOut(e,t) {
     e = e || window.event;
     var target = e.srcElement || e.target;

     if (target.id != t.attr("id")) return;

     var related = e.relatedTarget || e.toElement;
     while ((related.id != t.attr("id")) && (related.nodeName != 'BODY')) {
        related = related.parentNode;
	}
  
    if (related.id == t.attr("id")) return;

	pseudoAnimate(t,180,112,-80);
}

$(document).ready(function() {
	$(".imageHolder div").mouseover(function(event) {
		doMouseOver(event,$(this));
	})
	$(".imageHolder div").mouseout(function(event) {
		doMouseOut(event,$(this));
	});
	$(".imageHolder div p").mouseout(function(event) {
		doMouseOut(event,$(this));
	});

	$(".imageHolder").click(function() {
		tmp=$(this).attr("id");
		tmp=tmp.toLowerCase();
		tmp=tmp.substr(0,tmp.length-3);
		tmp="showgallery.php?item="+tmp;
		document.location=tmp;
	});
});

