// AJAX

var ajaxTarget;
var resObj;

if (navigator.appName.search("Microsoft") > -1) {
	IE = true;
	try {
		resObj = new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch(Error) {
		resObj = new ActiveXObject("MSXML2.XMLHTTP");
	}
} else {
	resObj = new XMLHttpRequest();
}

function sendReq(url,target) {
	ajaxTarget = target;
	resObj.open("get",url,true);
	resObj.onreadystatechange = handleResponse;
	resObj.send(null);
}

function handleResponse() {
	if (resObj.readyState == 4) {
		document.getElementById(ajaxTarget).innerHTML = resObj.responseText;
	}
}


// DIVERSE

	function toggle_layervis(id) {
		if (document.getElementById(id).style.display == 'block') {
			document.getElementById(id).style.display = 'none';
		} else {
			document.getElementById(id).style.display = 'block';
		}
	}

	function show(id) {
		document.getElementById(id).style.display = 'block';
	}

	function hide(id) {
		document.getElementById(id).style.display = 'none';
	}

	function openwin(URL,w,h,windowoptions) {
	
		showtoolbar = windowoptions.substring(0,1);
		showmenubar = windowoptions.substring(1,2);
		showscrollbar = windowoptions.substring(2,3);
		showstatus = windowoptions.substring(3,4);
		showresizable = windowoptions.substring(4);
		
		insertoptions = "toolbar="+showtoolbar+",menubar="+showmenubar+",scrollbars="+showscrollbar+",status="+showstatus+",resizable="+showresizable+",width="+w+",height="+h;
		
		thePage = window.open(URL,"mypopupwindow",insertoptions);
		thePage.focus();
	}
	
