javascript:
/* notes for use single function needs to be called on any page 
// getdoc(filetoload, formtosubmit, idofdivforresult)
// if using a form a button should be place at the end with the onclick= "getdoc("php.php", this.form, "divID")
// if you want a link to load a new page on pressing a link then you onmousedown="getdoc(php.php, null, divID) 
// note you must supply a div with an id for the results e.g. <div id="putitinhere"> */ 

function changeURL(linkname)
{

	document.getElementById("controlpannel").style.display = "block";
	document.getElementById("controlpannel").style.height = "300px";
       document.getElementById("hidebit").style.display = "block";
	
	if (linkname == "obj")
	{
		getdoc("/learningscope/objectives.php", null, "controlpannel");
		
	}
	else if (linkname == "arch")
	{
		getdoc("/learningscope/achievements.php", null, "controlpannel");
	}
	else if (linkname == "topic")
	{
		getdoc("/learningscope/topic.php", null, "controlpannel");
	}
	else if (linkname == "results")
	{
		getdoc("/learningscope/results.php", null, "controlpannel");

	}
	else if (linkname == "teachers")
	{
		getdoc("/learningscope/teachers/tcontrol-ajax.php", null, "controlpannel");

	}
	
	
	
	
}

function hidepan()
{
	document.getElementById("controlpannel").style.display = "none";
	document.getElementById("controlpannel").style.height = "0px";
       document.getElementById("hidebit").style.display = "none";
}


function clientTalk(fileURL, sendData, aID)
{
	
	this.areaID = aID; 
	 
    	// branch for native XMLHttpRequest object

	if (this.client == false)
	{

    	if(window.XMLHttpRequest && !(window.ActiveXObject)) 
	{
    		try 
		{
			this.client = new XMLHttpRequest();
        	} 
		catch(e) 
		{
			this.client = false;
        	}
    		// branch for IE/Windows ActiveX version
    	} 
	else if(window.ActiveXObject) 
	{
       	try 
		{
       	 	this.client = new ActiveXObject("Msxml2.XMLHTTP");
      		}
		catch(e) 
		{
        		try 
			{
          			this.client = new ActiveXObject("Microsoft.XMLHTTP");
        		}
			catch(e)
			{
          			this.client = false;
        		}
		}
    	}
	else 
	{
		// this is a fail write up a fail message 
		document.getElementById(aID).innerHTML = "Fail in Ajax start up"; 
	}
	}
	temp = this.client;

	if(this.client) 
	{

		this.client.onreadystatechange = function() {
		{

 			if(this.readyState == 4)
 			{
	
				if (this.status == 200) 
				{
  					if(this.responseText != null)
 					{
    					// success!
						document.getElementById(aID).innerHTML = this.responseText; 
			  		}	
			  		else
			  		{
  					 	alert("WHOOPS: information structure not as expected. ");
  					}
				}
				else
				{
					document.getElementById(aID).innerHTML = "loading ...." + this.status; 
				}
		 		
 		 	}
			else if (temp.readyState == 4)
			{
				if(temp.responseText != null)
 				{
    					// success!
					document.getElementById(aID).innerHTML = temp.responseText; 
				}	
				else
				{
  				 	alert("WHOOPS: information structure not as expected. ");
  				}

			}
 		 	else
 		 	{
				document.getElementById(aID).innerHTML = "loading ...." + this.status; 
			}	
		}


	}



		//handler;
		
	
	
		if (sendData != null)
		{
			// sendData is the name of the form that is being looked at must be sent as this.form in the onclick= method 
			DataString = ""; 
			for(var i=0; i< sendData.length;i++)
			{
				// note there might be some other fields that need sorting out at the moment I think this is right 
				if (sendData.elements[i].type == "checkbox")
				{
					// value is only sent if the checked value is on 
					if (sendData.elements[i].checked)
					{
						DataString += sendData.elements[i].name + "=" + sendData.elements[i].value + "&";
					}
				}
				else if (sendData.elements[i].type == "radio")
				{
					// value is only sent if the checked value is on 
					if (sendData.elements[i].checked)
					{
						DataString += sendData.elements[i].name + "=" + sendData.elements[i].value + "&";
					}
				}
				else if (sendData.elements[i].type != "button")
				{
					DataString += sendData.elements[i].name + "=" + sendData.elements[i].value + "&";
				}
			}
			//alert(DataString);
			this.client.open("POST", fileURL);
			this.client.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			this.client.send(DataString);
		}
		else
		{
			
			this.client.open("GET", fileURL);
			this.client.send(null);
		}
	}
}

function majax()
{
	// note this is a class javascript classes are functions???? 

	this.client = false;
	this.areaID = null; 
	this.sendData;
       this.loadfile; 
	this.getpage = clientTalk;
	//this.fhand = handler
	//this.todiv = outputtodiv;
}

function getdoc(fileURL, sendData, aID)
{
	var talk = new majax(); 
	talk.areaID = aID; 
	talk.getpage(fileURL, sendData, aID);
	
	
}

function changegroup(sform)
{
	getdoc('/learningscope/setgroup_ajax.php', sform, 'groupset');
	// hide the windows to the viewer. 
	document.getElementById('controlpannel').style.display = "none";
	document.getElementById('hidebit').style.display = "none";
	//changeURL('teachers');
	//hideshow('controlpannel');


}

function hideshow(divname)
{
	if (document.getElementById(divname).style.display == "none")
	{
		document.getElementById(divname).style.display = "block";
	}
	else
	{
		document.getElementById(divname).style.display = "none";
	}
	     
}

function setbg(color)
{
	document.getElementById("tbox").style.background=color;
}