// JavaScript Document
var xmlhttp = false;

//Check if we are using IE.
try {
	//If the javascript version is greater than 5.
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
	//If not, then use the older active x object.
	try {
	//If we are using IE.
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
	//Else we must be using a non-IE browser.
	xmlhttp = false;
	}
}
//If we are using a non-IE browser, create a JavaScript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	xmlhttp = new XMLHttpRequest();
}

var xmlhttp2 = false;

//Check if we are using IE.
try {
	//If the javascript version is greater than 5.
	xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
	//If not, then use the older active x object.
	try {
	//If we are using IE.
	xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
	//Else we must be using a non-IE browser.
	xmlhttp2 = false;
	}
}
//If we are using a non-IE browser, create a JavaScript instance of the object.
if (!xmlhttp2 && typeof XMLHttpRequest != 'undefined') {
	xmlhttp2 = new XMLHttpRequest();
}


function loaddiv(divtofill, divwithcontent, url, ajax2) {
	// This is only for the Proposals page.
	// the div has to either be filled with an url or content from another div
	if(divwithcontent) {
   		document.getElementById(divtofill).innerHTML = document.getElementById(divwithcontent).innerHTML;
	} else if(url) {
		var obj = document.getElementById(divtofill);
		// obj3.style.height = '100%';
		obj.innerHTML = '<div align="center" style="padding-top:20px">loading....</div>';

		var serverPage = url + "sid="+Math.random();
		
		if(ajax2) {
			xmlhttp2.open("GET", serverPage);
			xmlhttp2.onreadystatechange = function() {
	
				if (xmlhttp2.readyState == 4 && xmlhttp2.status == 200) {
					obj.innerHTML = xmlhttp2.responseText;
				}
			}
			xmlhttp2.send(null);
		} else {
			xmlhttp.open("GET", serverPage);
			xmlhttp.onreadystatechange = function() {
	
				if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					obj.innerHTML = xmlhttp.responseText;
				}
			}
			xmlhttp.send(null);
		}
	}
}

