function getById(elementname){if(document.all){element=document.all[elementname];}else{element=document.getElementById(elementname);}return element;}function availability(classid){var xmlHttp;if(window.XMLHttpRequest){xmlHttp=new XMLHttpRequest();}else if(window.ActiveXObject){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){if(xmlHttp.responseText!='0'){getById('availabilityDiv').innerHTML=xmlHttp.responseText;getById('link6').blur();getById('link6').style.color="blue";getById('link7').blur();getById('link7').style.color="blue";getById('link8').blur();getById('link8').style.color="blue";getById('link'+classid).style.color="black";getById('moretimeslink').href="http://www.albertadriverexaminer.ca/choosetime.php?class="+classid+"&city="+getById('city').value+"&m="+getById('m').value+"&y="+getById('y').value+"&date="+getById('stamp').value+"&examiner="+getById('examiner').value;}else if(parseInt(getById('attempt').value)<=5){getById('attempt').value=parseInt(getById('attempt').value)+1;getById('stamp').value=parseInt(getById('stamp').value)+86400;availability(classid);}else{getById('availabilityDiv').innerHTML="<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thereisnoupcomingroadtestavailability.";}}}};xmlHttp.open('GET',"rci/rci.ajax.getAvailability.php?classid="+classid+"&attempt="+getById('attempt').value,true);xmlHttp.send(null);}function rci_load(){var xmlHttp;if(window.XMLHttpRequest){xmlHttp=new XMLHttpRequest();}else if(window.ActiveXObject){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){getById('rci_container').innerHTML=xmlHttp.responseText;setTimeout("availability(6)",300);}}};xmlHttp.open('GET',"rci/rci.ajax.load.php",true);xmlHttp.send(null);}