var ns4 = document.layers;
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);

function show(id){
	// Netscape 4
	// @@ Doesn't work !!
	if(ns4){
		document.layers[id].visibility = "show";
		document.layers[id].display = "block";
	}
	// Explorer 4
	else if(ie4){
		document.all[id].style.visibility = "visible";
		document.all[id].style.display = "block";
	}
	// W3C - Explorer 5+ and Netscape 6+
	else if(ie5 || ns6){
		document.getElementById(id).style.visibility = "visible";
		document.getElementById(id).style.display = "block";
	}
}

function hide(id){
	// Netscape 4
	// @@ Doesn't work !!
	if(ns4){
		document.layers[id].visibility = "hide";
		document.layers[id].display = "none";
	}
	// Explorer 4
	else if(ie4){
		document.all[id].style.visibility = "hidden";
		document.all[id].style.display = "none";
	}
	// W3C - Explorer 5+ and Netscape 6+
	else if(ie5 || ns6){
		document.getElementById(id).style.visibility = "hidden";
		document.getElementById(id).style.display = "none";
	}
}

function isVisible(id)
{
	// Netscape 4
	// @@ Doesn't work !!
	if(ns4){
		return document.layers[id].visibility == "show";
	}
	// Explorer 4
	else if(ie4){
		return document.all[id].style.visibility == "visible";
	}
	// W3C - Explorer 5+ and Netscape 6+
	else if(ie5 || ns6){
		return document.getElementById(id).style.visibility == "visible";
	}
}

function showOnly(srcElementName)
// Shows the month named 'srcElementName' hides the rest
{
	// Must provide this function elsewhere !!
	hideAll();
	show(srcElementName);
}

function toggle(srcElementName)
// Shows the month named 'srcElementName' hides the rest
{
	var visible = isVisible(srcElementName);
	if (visible)
		hide(srcElementName);
	else
		show(srcElementName);
}


function showHide(srcElementName, show)
// Show or hide an element named 'srcElementName'
{
	if (show)
		show(srcElementName);
	else
		hide(srcElementName);
}

function resize(img, size)
{
	var maxDim = size;
	var width = img.width;
	var height = img.height;
	if (width > maxDim)
	{
		width = maxDim;
		height = (maxDim*img.height)/img.width;
		img.width = width;
		img.height = height;
	}
	else if (height > maxDim)
	{
		height = maxDim;
		width = (maxDim*img.width)/img.height;
		img.height = height;
		img.width = width;
	}
}


