// JavaScript Document
var xmlHttp;
var cur_lyr;	// holds id of currently visible layer
function createXMLHttpRequest(){
	if(window.ActiveXObject){
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if(window.XMLHttpRequest){
		xmlHttp = new XMLHttpRequest();
	}
}

function startRequest(){
	createXMLHttpRequest();
	xmlHttp.onreadystatechange=handleStateChange;
	xmlHttp.open("GET","simpleResponse.xml",true);
	xmlHttp.send(null);
}

function handleStateChange(){
	if(xmlHttp.readyState == 4){
		if(xmlHttp.status == 200){
			alert("The server replied with: " + xmlHttp.responseText);
		}
	}
}

function swapLayers(id) {
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.display = "block";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.display = "none";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

function showSideMenu(id){
	if(cur_lyr == id)
	{}
	else{
		var lyr = getElemRefs(id);
		if (lyr && lyr.css){
			lyr.css.display = "block";
			lyr.css.position = "absolute";
			lyr.css.left ="32%"; /* Set 1px less than menu width */
			lyr.css.top = "180px";
			
		}
			
	}
}
function hideSideMenu(id){
	if(cur_lyr == id)
	{}
	else{
		hideLayer(id);	
	}

	
}