/*
Heavy width modifications by Jesse Proudman
jesse@blueboxgrp.com
http://www.blueboxdev.com
05/17/2005

Original Script by RoBorg
RoBorg@geniusbug.com
http://javascript.geniusbug.com
Please do not remove or edit this message
*/


slideSpeed = 33;

totalHeight = 800;		totalWidth = 800;


function initMenus(classNm) {
	if(!document.getElementsByTagName) return;
	
	bLayer = classNm + 'Big';
	sLayer = classNm + 'Small';
	
	slider = new Array();
	var divs = document.getElementsByTagName('div');

	for(var x=0; x < divs.length; x++) {
		divs[x].originalHeight = divs[x].offsetHeight;		divs[x].originalWidth = divs[x].offsetWidth;
		divs[x].speed = -1;
		
		if(divs[x].className == 'zoom1Big') divs[x].onclick = function() { toggle_closed(this, 'zoom1Big'); }
		if(divs[x].className == 'zoom2Big') divs[x].onclick = function() { toggle_closed(this, 'zoom2Big'); }
		if(divs[x].className == 'zoom1Small') divs[x].onclick = function() { toggle_open(this, 'zoom1Big'); }
		if(divs[x].className == 'zoom2Small') divs[x].onclick = function() { toggle_open(this, 'zoom2Big'); }
	}

	for (var x=0; x<divs.length; x++) {
		if (divs[x].className != bLayer) continue;
		divs[x].style.height = '1px';		divs[x].style.width = '1px';	divs[x].style.display = 'none';
	}	
}

function toggle_closed(obj, wLayer) {
	while(obj.lastSibling && (obj.className == wLayer)) obj = obj.lastSibling;
	obj.speed = -1 * obj.speed;
	if(obj.slideTimer) return;
	var x = slider.length;
	slider[x] = obj;
	slide_closed(x);
}



function slide_closed(x) {
	var obj = slider[x];
	var height = obj.offsetHeight + obj.speed * slideSpeed;
	var width = obj.offsetWidth + obj.speed * slideSpeed;
	var targetHeight = totalWidth;		var targetWidth = totalHeight;

	if(height <= 1 && width <= 1) {
		obj.style.height = '1px';	obj.style.width = '1px';
		obj.style.display = 'none'; obj.slideTimer = false;
		return;
	}
	if( height > targetHeight && width > targetWidth) {
		obj.style.width = '800px';		obj.style.height = '800px';
		obj.style.display = 'none';		obj.slideTimer = false;
		return;
	}
	obj.style.height = height + 'px';	obj.style.width = width + 'px';
	obj.slideTimer = setTimeout('slide_closed(' + x + ');', 50);
}


function toggle_open(obj, wLayer) {
	while(obj.nextSibling && (obj.className != wLayer)) obj = obj.nextSibling;
	obj.style.position = 'absolute';
	obj.style.visibility = 'visible';
	obj.speed = -1 * obj.speed;
	if(obj.slideTimer) return;
	var x = slider.length;
	slider[x] = obj;
	slide_open(x);
}



function slide_open(x) {
	var obj = slider[x];
	if(obj.style.display != 'block') obj.style.display = 'block';
	var height = obj.offsetHeight + obj.speed * slideSpeed;
	var width = obj.offsetWidth + obj.speed * slideSpeed;
	var targetHeight = totalWidth;		var targetWidth = totalHeight;

	if( height > targetHeight && width > targetWidth) {
		obj.style.width = '800px';		obj.style.height = '800px';
		obj.slideTimer = false;
		return;
	}
	
	if(height <= 1 && width <= 1) {
		obj.style.height = '1px';		obj.style.width = '1px';
		obj.slideTimer = false;
		return;
	}
	
	obj.style.height = height + 'px';
	obj.style.width = width + 'px';
	obj.slideTimer = setTimeout('slide_open(' + x + ');', 50);
}


function resizeParents(obj, diffH, diffW) {}
