function showPic (whichpic, objName, divName) {
	document.getElementById(divName).style.display = 'block';
	src = whichpic.href;
	obj = document.getElementById(objName);
	if(obj.src != whichpic.href){
		if(document.getElementById('leftul')){
			var anchors = document.getElementById('leftul').getElementsByTagName('a');
			for (var i=0; i<anchors.length; i++){
				anchors[i].className = '';
			}
			whichpic.className = 'close';
		}
		var width = obj.width;
		var height = obj.height;
		setOpacity(objName, 0);
		obj.src = whichpic.href;
		var imgPre = new Image();
		imgPre.onload = function(){fadeIn(objName);resizePic(objName, width, height, imgPre.width, imgPre.height);}
		imgPre.src = whichpic.href;
	} else {
		hideDiv(objName, divName, 100, 100);
	}
}
function fadeIn(objName) {
	var timer = 0;
	var speed = 40;
	var opac;
	for(i = 1; i <= 5; i++) {
		opac = i * 20;
		setTimeout("setOpacity('" + objName + "'," + opac + ")",(timer * speed)); 
		timer++;
	}
}
function resizePic(objName, oldWidth, oldHeight, newWidth, newHeight) {
	var timer = 0;
	var speed = 30;
	obj = document.getElementById(objName);
	var widthChange = (newWidth - oldWidth)/10;
	var heightChange = (newHeight - oldHeight)/10;
	var width, height;
	for(i = 1; i <= 10; i++) {
		width = oldWidth + (i * widthChange);
		height = oldHeight + (i * heightChange);
		setTimeout("setDim('" + objName + "'," + width + "," + height + ")",(timer * speed)); 
		timer++;
	}	
}
function hideDiv(objName, divName, newWidth, newHeight) {
	if(document.getElementById('leftul')){
		var anchors = document.getElementById('leftul').getElementsByTagName('a');
		for (var i=0; i<anchors.length; i++){
			anchors[i].className = '';
		}
	}
	obj = document.getElementById(objName);
	var width = obj.width;
	var height = obj.height;
	resizePic(objName, width, height, newWidth, newHeight);
	setTimeout("displayNone('" + objName + "','" + divName + "')", 300);
	return false;
}
function setDim(objName, width, height){
	obj = document.getElementById(objName);
	obj.style.width = width+'px';
	obj.style.height = height+'px';
}

function setOpacity(objName, opacity) {
	obj = document.getElementById(objName);
	obj.style.filter = "alpha(opacity="+opacity+")";
	obj.style.opacity = opacity/100;
}

function displayNone(objName, divName){
	document.getElementById(objName).src = '/pics/blank.gif';
	document.getElementById(divName).style.display = 'none';
}

