var isHomePage = false;
function visi(nr)
{
	if (document.layers)
	{
		//vista = (document.layers[nr].visibility == 'show') ? 'show' : 'hide'
		vista = 'show';
		document.layers[nr].visibility = vista;
	}
	else if (document.all)
	{
		//vista = (document.all[nr].style.visibility == 'visible') ? 'visible'	: 'hidden';
		vista = 'visible';
		document.all[nr].style.visibility = vista;
	}
	else if (document.getElementById)
	{
		//vista = (document.getElementById(nr).style.visibility == 'visible') ? 'visible' : 'hidden';
		vista = 'visible';
		document.getElementById(nr).style.visibility = vista;
	}

}

function hideLayer(whichLayer) {
if (document.getElementById) {
// this is the way the standards work
document.getElementById(whichLayer).style.visibility = "hidden";
}
else if (document.all) {
// this is the way old msie versions work
document.all[whichlayer].style.visibility = "hidden";
}
else if (document.layers) {
// this is the way nn4 works
document.layers[whichLayer].visibility = "hidden";
}
}

function showLayer(whichLayer) {
if (document.getElementById) {
// this is the way the standards work
document.getElementById(whichLayer).style.visibility = "visible";
}
else if (document.all) {
// this is the way old msie versions work
document.all[whichlayer].style.visibility = "visible";
}
else if (document.layers) {
// this is the way nn4 works
document.layers[whichLayer].visibility = "visible";
}
}

function blocking(nr)
{
	if (document.layers)
	{
		current = (document.layers[nr].display == 'none') ? 'block' : 'none';
		document.layers[nr].display = current;
	}
	else if (document.all)
	{
		current = (document.all[nr].style.display == 'none') ? 'block' : 'none';
		document.all[nr].style.display = current;
	}
	else if (document.getElementById)
	{
		vista = (document.getElementById(nr).style.display == 'none') ? 'block' : 'none';
		document.getElementById(nr).style.display = vista;
	}
}
function zFront(layerToMove,otherLayers) {
	var otherLayerList = otherLayers.split(",");
	var frontLayerInt = otherLayerList.length + 5;
	
	obj = document.getElementById(layerToMove);
	if (typeof obj!="undefined")
	{
	 obj.style.zIndex = frontLayerInt;
	}

			
			for (var i=0; i < otherLayerList.length; i++ ) 
			{ 
				obj = document.getElementById(otherLayerList[i]);
				//alert(obj);
				if (obj != null)
					{
						try{
						obj.style.zIndex=i;
					   }
					 catch(err){
						alert(err);
						}
					}
		  	}

}


function bringToFront(frontLayer,otherLayers)
{
		visi(frontLayer);
		zFront(frontLayer,otherLayers);

		if (frontLayer != 'QuickContact')
		{
			hideLayer('QuickContact');
		}
		
		var aLayerList = otherLayers.split(",");
					
		if ((frontLayer == 'left') || (frontLayer == 'QuickContact'))
		{
			if (isHomePage == true)
			{
			hideLayer('interiorText');
			}
		}
}
// used for testing only
function showZ(layersToDisplay)
{
	var otherLayerList = layersToDisplay.split(",");
	var message;  
	for (var i=0; i < otherLayerList.length; i++ ) { 
	   
	   obj = document.getElementById(otherLayerList[i]);
		message = otherLayerList[i] + " z index is " + obj.style.zIndex + " and visibility is " + obj.style.visibility;
		
		if ( obj != null)
		{
			alert (message)
		}
	  }
	
	
}