//Create Requestfunction createRequestObject(){{try{request_o = new ActiveXObject("Microsoft.XMLHTTP");}catch(ex){//either this is not IE, or it is a version of IE which does not support XMLHTTPvar notIECompatibleXMLHTTP=true;}if(notIECompatibleXMLHTTP==true){try{request_o = new XMLHttpRequest();}catch(ex){//we can't use AJAX because this browser is not compatible.request_o = false;}}return request_o;}var XMLHTTP_o;if(XMLHTTP_o=getXMLHTTP()){alert('YAY we can do AJAX.');alert(XMLHTTP_o.toString());}else{alert('WAAAH not compatible.');}}//------------------------------------------------------------------//Holds the whole request in one variablevar http = createRequestObject(); //-------------------------------------------------------------------function getNextDrop(name){	  if (name == "divisions")    {  var thisProgram = document.visaForm.program.options.selectedIndex;  var pValue = document.visaForm.program.options[thisProgram].value;    //alert(pValue);    http.open('get', 'ajaxFunctions.php?action=getDivision&program=' + pValue);    //Check to see if there is an answer from server		http.onreadystatechange = handleResponse; //what to do with the data		}		if (name == "events")    {  var thisProgram = document.visaForm.program.options.selectedIndex;  var pValue = document.visaForm.program.options[thisProgram].value;    //alert(pValue);    http.open('get', 'ajaxFunctions.php?action=getEvent&program=' + pValue);    //Check to see if there is an answer from server		http.onreadystatechange = handleResponse2; //what to do with the data		}	  //Sends data request			http.send(null);			}function handleResponse(){	   	 //Check for ready state = 4 	  	if(http.readyState == 4){		var response = http.responseText;				//where to place the response // in a DIV TAG	   	       			document.getElementById('divisions').innerHTML = response;	}}function handleResponse2(){	   	 //Check for ready state = 4 	  	if(http.readyState == 4){		var response = http.responseText;				//where to place the response // in a DIV TAG	   	       			document.getElementById('events').innerHTML = response;	}}function addResult(){var tbl = document.getElementById('lastResults');var lastRow = tbl.rows.length;var iteration = lastRow;var row = tbl.insertRow(lastRow);//create textvar text1 = document.createTextNode("Type: ");var text2 = document.createTextNode("Year: ");var text3 = document.createTextNode("Competition Name: ");var text4 = document.createTextNode("Location: ");var text5 = document.createTextNode("Place: ");//create select boxvar ni = document.createElement('select');ni.name = "ni" + iteration;ni.setAttribute ("className" , "inForm3");ni.setAttribute ("class" , "inForm3");ni.options[0] = new Option('National', 'national');ni.options[1] = new Option('International', 'International');//create text fieldvar tfield1 = document.createElement('input');tfield1.name = "year" + iteration;tfield1.size = 4;tfield1.maxLength = 4;tfield1.setAttribute ("className" , "inForm1");tfield1.setAttribute ("class" , "inForm1");var tfield2 = document.createElement('input');tfield2.name = "competition" + iteration;tfield2.size = 30;tfield2.maxLength = 200;tfield2.setAttribute ("className" , "inForm1");tfield2.setAttribute ("class" , "inForm1");var tfield3 = document.createElement('input');tfield3.name = "location" + iteration;tfield3.size = 30;tfield3.maxLength = 200;tfield3.setAttribute ("class" , "inForm1");tfield3.setAttribute ("className" , "inForm1");var tfield4 = document.createElement('input');tfield4.name = "place" + iteration;tfield4.size = 30;tfield4.maxLength = 250;tfield4.setAttribute ("class" , "inForm1");tfield4.setAttribute ("className" , "inForm1");//create white space and line breakvar space = document.createTextNode(" ");var lbreak0 = document.createElement('br');var lbreak = document.createElement('br');var lbreak1 = document.createElement('br');var lbreak2 = document.createElement('br');// create cellvar extraCell = row.insertCell(0);extraCell.appendChild(lbreak0);extraCell.appendChild(text1);extraCell.appendChild(ni);extraCell.appendChild(space);extraCell.appendChild(text2);extraCell.appendChild(tfield1);extraCell.appendChild(lbreak);extraCell.appendChild(text3);extraCell.appendChild(tfield2);extraCell.appendChild(lbreak1);extraCell.appendChild(text4);extraCell.appendChild(tfield3);extraCell.appendChild(lbreak2);extraCell.appendChild(text5);extraCell.appendChild(tfield4);}function removeResult(){var tbl = document.getElementById('lastResults');var lastRow = tbl.rows.length;//alert(lastRow);if (lastRow > 2){tbl.deleteRow(lastRow - 1);}  }function textCounter(field, countfield, maxlimit) {if (field.value.length > maxlimit) // if too long...trim it!field.value = field.value.substring(0, maxlimit);// otherwise, update 'characters left' counterelsecountfield.value = maxlimit - field.value.length;}function getClicked (){var tbl = document.getElementById('lastResults');var lastRow = tbl.rows.length;var change = document.visaForm.sTableLength.value = lastRow;//alert(change);}var horizontal_offset="10px" //horizontal offset of hint box from anchor link/////No further editting neededvar vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change.var ie=document.allvar ns6=document.getElementById&&!document.allfunction getposOffset(what, offsettype){var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;var parentEl=what.offsetParent;while (parentEl!=null){totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;parentEl=parentEl.offsetParent;}return totaloffset;}function iecompattest(){return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body}function clearbrowseredge(obj, whichedge){var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1if (whichedge=="rightedge"){var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40dropmenuobj.contentmeasure=dropmenuobj.offsetWidthif (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)}else{var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18dropmenuobj.contentmeasure=dropmenuobj.offsetHeightif (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight}return edgeoffset}function showhint(menucontents, obj, e, tipwidth){if ((ie||ns6) && document.getElementById("hintbox")){dropmenuobj=document.getElementById("hintbox")dropmenuobj.innerHTML=menucontentsdropmenuobj.style.left=dropmenuobj.style.top=-500if (tipwidth!=""){dropmenuobj.widthobj=dropmenuobj.styledropmenuobj.widthobj.width=tipwidth}dropmenuobj.x=getposOffset(obj, "left")dropmenuobj.y=getposOffset(obj, "top")dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"dropmenuobj.style.visibility="visible"obj.onmouseout=hidetip}}function hidetip(e){dropmenuobj.style.visibility="hidden"dropmenuobj.style.left="-500px"}function createhintbox(){var divblock=document.createElement("div")divblock.setAttribute("id", "hintbox")document.body.appendChild(divblock)}if (window.addEventListener)window.addEventListener("load", createhintbox, false)else if (window.attachEvent)window.attachEvent("onload", createhintbox)else if (document.getElementById)window.onload=createhintbox