//Image Enlarger
var ImageInterval = new Array();
var EnlargePercent = new Array();
var EnlargeDirection = new Array();
var ObjectTop = new Array();
var ObjectLeft = new Array();
var ObjectWidth = new Array();
var ObjectHeight = new Array();
var zIndex = 1;


function pict_over(image, dir, max) {
	document.getElementById('div' + image).style.zIndex = zIndex++;
	
	if (ImageInterval[image]==null) {
		ImageInterval[image] = "";
		EnlargePercent[image] = 1;

		var Object = document.getElementById(image);
		var divObject = document.getElementById('div' + image);
		
		ObjectTop[image] = divObject.offsetTop;
		ObjectLeft[image] = divObject.offsetLeft;
		ObjectWidth[image] = Object.offsetWidth;
		ObjectHeight[image] = Object.offsetHeight;
	}

	if (ImageInterval[image]=="" || EnlargeDirection[image] == -.04) {
		clearInterval(ImageInterval[image]);
		EnlargeDirection[image] = .02;
		ImageInterval[image] = setInterval("ImageEnlarger('" + image + "', " + dir + ", " + max + ")",10);
	}
}

function pict_out(image, dir, max) {
	clearInterval(ImageInterval[image]);
	EnlargeDirection[image] = -.04;
	ImageInterval[image] = setInterval("ImageEnlarger('" + image + "', " + dir + ", " + max + ")",10);
}

function ImageEnlarger(image, dir, max) {
	EnlargePercent[image] = EnlargePercent[image] + EnlargeDirection[image];
	
	var Object = document.getElementById(image);
	var divObject = document.getElementById('div' + image);

	Object.width = ObjectWidth[image] * EnlargePercent[image];
	divObject.style.width = Object.width;
	Object.height = ObjectHeight[image] * EnlargePercent[image];
	
	switch (dir) {
		case 1:
			break;
		case 2:
			divObject.style.left = ObjectLeft[image] +
				(ObjectWidth[image] / 2) - (Object.width / 2);
			break;
		case 3:
			divObject.style.left = ObjectLeft[image] +
				(ObjectWidth[image]) - (Object.width);
			break;
		case 4:
			divObject.style.top = ObjectTop[image] +
				ObjectHeight[image] / 2 - Object.height / 2;
			break;
		case 5:
			divObject.style.left = ObjectLeft[image] +
				(ObjectWidth[image] / 2) - (Object.width / 2);
			divObject.style.top = ObjectTop[image] +
				ObjectHeight[image] / 2 - Object.height / 2;
			break;
		case 6:
			divObject.style.left = ObjectLeft[image] +
				(ObjectWidth[image]) - (Object.width);
			divObject.style.top = ObjectTop[image] +
				ObjectHeight[image] / 2 - Object.height / 2;
			break;
	}

	if (EnlargePercent[image] >= max) clearInterval(ImageInterval[image]);
	if (EnlargePercent[image] <= 1) {
		clearInterval(ImageInterval[image]);
		ImageInterval[image] = "";
		EnlargePercent[image] = 1;
	}
}