function updateImageInfo(imagename,text,id){
	// used for determining what branch to select in the dropdown menu
	document.getElementById('selectedBranch').value = id;
	
	imagexmlHttp=GetXmlHttpObject();
	if (imagexmlHttp==null){
  		alert ("Your browser does not support AJAX! get firefox");
  		return;
  	} 
	var url = "scripts/getimage.php?name=" + imagename + "&text=" + text ;+ "&id=" + id;
	
	imagexmlHttp.onreadystatechange=changeImage; // calls the function changeImage()
	imagexmlHttp.open("GET",url,true);
	imagexmlHttp.send(null);
}

function get_agency_office(agencyID){
	//============================ ajax here
	UPxmlHttp=GetXmlHttpObject();
	if (UPxmlHttp==null){
  		alert ("Your browser does not support AJAX! get firefox");
  		return;
  	} 
	var url = "scripts/populate_agent_branch.php?id=" + agencyID;

	UPxmlHttp.onreadystatechange=changeDropdownMenu; // calls the function changeDropdownMenu()
	UPxmlHttp.open("GET",url,true);
	UPxmlHttp.send(null);
}

//============================ CREATE xmlHttp
function GetXmlHttpObject(){
		var xmlHttp=null;
		try
		{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
		// Internet Explorer
		try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
	
function changeDropdownMenu(){
	if (UPxmlHttp.readyState==4){ // check if done
		document.getElementById("company_logo").innerHTML = "default Image"; // set the dfault image here, we just need the path to the image someone?
		resultText = UPxmlHttp.responseText;
		document.getElementById("register_page").innerHTML = resultText;
	}
}
function changeImage(){
	if (imagexmlHttp.readyState==4){ // check if done
		resultText = imagexmlHttp.responseText;
		document.getElementById("company_logo").innerHTML = resultText;
	}
}