function loadData(target, content_bit, url, show, urlExt){
 var ran_unrounded=Math.random()*1000000;
 var ran_number=Math.floor(ran_unrounded);
 var url = url + '?no_cache=' + ran_number;
 if(urlExt){
  var url = url + '&' + urlExt;
 }
 var xmlhttp = false;
 if (window.XMLHttpRequest){
  xmlhttp = new XMLHttpRequest();
  //xmlhttp.overrideMimeType('text/xml');
 }else if(window.ActiveXObject){
  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 }
 top.document.getElementById(target).style.visibility = 'visible';
 top.document.getElementById(target).style.display = 'block';

 if(show == 1){
  top.document.getElementById(target).innerHTML = 'loading';
 }
 xmlhttp.open('GET', url, true);
 xmlhttp.onreadystatechange = function() {
  if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
   top.document.getElementById(target).innerHTML = xmlhttp.responseText + ' ';
			if(content_bit == "open"){ //Opens all the input fields ready to receive data
				var soid = 1;
				while(top.document.getElementById('swapOut' + soid)){
					doSwapOut(soid);
					soid++;
				}
			}
			if(content_bit == "home"){ //Checks the home page for a local image
				//alert(top.document.localTest.height);
				if(top.document.localTest.height == 66){ //Local copy installed
					loadData('home_local', '', 'ajax/localInstall.php', 1, '');
				}else{
					top.document.localTest.height = '0px';
				}
			}
   return true;
  }else{
   if(show == 1){
    top.document.getElementById(target).innerHTML = '<img src="images/ajax_loader.gif" alt=\"Loading\" title=\"Loading\" style=\"width:16px; height:16px;\" />';
   }
   return false;
  }
 };
 xmlhttp.send(null);  
}

function readData(url,urlExt,userType){
 var ran_unrounded=Math.random()*1000000;
 var ran_number=Math.floor(ran_unrounded);
 var url = url + '?no_cache=' + ran_number;
	if(urlExt){
		var url = url + urlExt;
	}
 var xmlhttp = false;
 if (window.XMLHttpRequest){
  xmlhttp = new XMLHttpRequest();
 }else if(window.ActiveXObject){
  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 }
 xmlhttp.open('GET', url, true);
 xmlhttp.onreadystatechange = function() {
  if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
   if(xmlhttp.responseText){
				switch(userType){
					case(1): //Call a class into a dropdown
						top.document.classForm.classID.selectedIndex = xmlhttp.responseText;
						break;
					case(2): //address check
						if(xmlhttp.responseText == 'Fail'){
							top.document.getElementById('pane_popup').style.width = '400px';
							loadData('pane_popup', '', 'ajax/dupCheck_display.php', 1, urlExt);
						}else{
							//alert('It has passed: ' + xmlhttp.responseText);
						}
						break;
				}
    return true;
   }else{
    return false;
   }
  }
 };
 xmlhttp.send(null);  
}
