
function $(id) {
	return document.getElementById(id);
}

function GenericXMLHttpRequest() {
	var xmlhttplocal;

	try {
		xmlhttplocal = new ActiveXObject('Msxml2.XMLHTTP');
	} catch (e) {
		try {
			xmlhttplocal = new ActiveXObject('Microsoft.XMLHTTP');
		} catch (e) {
			xmlhttplocal = false;
		}
  	}
	if (!xmlhttplocal && typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttplocal = new XMLHttpRequest();
		} catch (e) {
			xmlhttplocal = false;
			alert ('couldn\'t create xmlhttp object');
		}
	}

	return xmlhttplocal;
}

function getSelectedValue(selectCtrl) {
	if(selectCtrl == null) {
		return null;
	}

	var selectedIndex = selectCtrl.options.selectedIndex;

	return selectCtrl.options[selectedIndex].value;
}

function showLayer(layerName) {
	var layer = document.getElementById(layerName);
	if(layer) {
		layer.style.display = '';
	}
}

function hideLayer(layerName) {
	var layer = document.getElementById(layerName);
	if(layer) {
		layer.style.display = 'none';
	}
}


