//////////////////////////////////////////////////////////////////////////////
//
// straightforward javascript functions
//
//////////////////////////////////////////////////////////////////////////////

function openWindow(theURL, theName, width, height) {
        var w = window.open(theURL , ""+theName+"" ,"width=" + width + ",height="+ height + ",toolbar=no,directories=0,menubar=no,status=no,resizable=1,location=0,scrollbars=1,copyhistory=0,alwaysRaised=yes");
		return w;
}

//////////////////////////////////////////////////////////////////////////////

function loadURL(destination, elementID) {
	
	try {
		xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
		new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch (e) { /* do nothing */ }
	
	element = elementID;
	xmlhttp.onreadystatechange = triggered;
	xmlhttp.open("GET", destination, true);
	xmlhttp.send(null);
}

//////////////////////////////////////////////////////////////////////////////

function triggered() {
  	if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
    
		if( xmlhttp.responseText && (xmlhttp.responseText !='') ) {
			try {	
				document.getElementById(element).innerHTML = xmlhttp.responseText;
			}
			catch(e) {
				// IE fails unless we wrap the string in another element.
				var wrappingDiv = document.createElement('div');
				wrappingDiv.innerHTML = xmlhttp.responseText;
				document.getElementById(element).appendChild(wrappingDiv);
			}
		}
	}
}

//////////////////////////////////////////////////////////////////////////////

