var lastLayer;
function toggleLayer(whichLayer){
	lastLayer=whichLayer;
	var thisLayer;
	if (document.getElementById)	{
		// this is the way the standards work
		thisLayer = document.getElementById(whichLayer);
	}else if (document.all){
		// this is the way old msie versions work
		thisLayer = document.all[whichLayer];
	}else if (document.layers){
		// this is the way nn4 works
		thisLayer = document.layers[whichLayer];
	}
	if(thisLayer!=null)	
		thisLayer.style.display =  thisLayer.style.display=="block" ? "none" : "block";
}

function hideLayer(whichLayer){
	lastLayer=whichLayer;
	var thisLayer;
	if (document.getElementById)	{
		// this is the way the standards work
		thisLayer = document.getElementById(whichLayer);
	}else if (document.all){
		// this is the way old msie versions work
		thisLayer = document.all[whichLayer];
	}else if (document.layers){
		// this is the way nn4 works
		thisLayer = document.layers[whichLayer];
	}
	if(thisLayer!=null)
		thisLayer.style.display = "none";
}

function showLayer(whichLayer){
	lastLayer=whichLayer;	
	var thisLayer;
	if (document.getElementById)	{
		// this is the way the standards work
		thisLayer = document.getElementById(whichLayer);
	}else if (document.all){
		// this is the way old msie versions work
		thisLayer = document.all[whichLayer];
	}else if (document.layers){
		// this is the way nn4 works
		thisLayer = document.layers[whichLayer];
	}
	if(thisLayer!=null)
		thisLayer.style.display = "block";
}

function appendLayer(sourceLayer,destinationLayer){
	var thisLayer; var thatLayer;
	if (document.getElementById)	{
		// this is the way the standards work
		thisLayer = document.getElementById(sourceLayer);
		thatLayer = document.getElementById(destinationLayer);
	}else if (document.all){
		// this is the way old msie versions work
		thisLayer = document.all[sourceLayer];
		thatLayer = document.all[destinationLayer];
	}else if (document.layers){
		// this is the way nn4 works
		thisLayer = document.layers[sourceLayer];
		thatLayer = document.layers[destinationLayer];
	}
//	thatLayer.innerHTML = thatLayer.innerHTML  + thisLayer.innerHTML;
	var newDiv;
	if(thisLayer!=null && thatLayer!=null){
		var newLayer = document.createElement('div');
		newDiv = new Date().getTime();
		newLayer.setAttribute("id",newDiv);
		newLayer.innerHTML = thisLayer.innerHTML;
		thatLayer.appendChild(newLayer);
	}
	return newDiv;

}
function moveLayer(sourceLayer,destinationLayer){
	var newDiv = appendLayer(sourceLayer,destinationLayer);
	removeLayer(sourceLayer);
	return newDiv;

}
function removeLayer(whichLayer){
	
	var thisLayer;
	if (document.getElementById)	{
		// this is the way the standards work
		thisLayer = document.getElementById(whichLayer);
	}else if (document.all){
		// this is the way old msie versions work
		thisLayer = document.all[whichLayer];
	}else if (document.layers){
		// this is the way nn4 works
		thisLayer = document.layers[whichLayer];
	}

//	thisLayer.innerHTML = '';
	if(thisLayer){
		thisLayer.style.display = "block";
		thisLayer.parentNode.removeChild(thisLayer);
	}


}


