var xmlHttp; var type; function save_cart(url) { xmlHttp=GetXmlHttpObject(state_change); xmlHttp.open("GET", url , true) xmlHttp.send() } function process(url, form_object) { if(form_object) var str= get_form_values(form_object); xmlHttp=GetXmlHttpObject(state_change); xmlHttp.open("POST", url , true) xmlHttp.send(str) } function state_change() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById('result').innerHTML=xmlHttp.responseText; } } function update_model(path, val) { var url=path + "lib/ajax/update_model.php?make=" + val; xmlHttp=GetXmlHttpObject(state_change_update_model); xmlHttp.open("GET", url , true) xmlHttp.send(null) } function state_change_update_model() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById('_model').innerHTML=''; document.getElementById('_model').innerHTML=xmlHttp.responseText; } } function update_model1(path, val, type_num, name) { var url=path + "lib/ajax/update_model.php?make=" + val + "&name=" + name; type = type_num; xmlHttp=GetXmlHttpObject(state_change_update_model1); xmlHttp.open("GET", url , true) xmlHttp.send(null) } function state_change_update_model1() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { if(type){ document.getElementById('_model'+type).innerHTML=''; document.getElementById('_model'+type).innerHTML=xmlHttp.responseText; } else{ document.getElementById('_model').innerHTML=''; document.getElementById('_model').innerHTML=xmlHttp.responseText; } } } function update_printer(path, val) { var url=path + "lib/ajax/update_printer.php?printer_seq=" + val; xmlHttp=GetXmlHttpObject(state_change_update_printer); xmlHttp.open("GET", url , true) xmlHttp.send(null) } function state_change_update_printer() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById('_printer').innerHTML=''; document.getElementById('_printer').innerHTML=xmlHttp.responseText; } } function validate_email(path, val) { var url=path + "lib/ajax/validate.php?type=email&val=" + val; xmlHttp=GetXmlHttpObject(state_change_validate_email); xmlHttp.open("GET", url , true) xmlHttp.send(null) } function state_change_validate_email() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { if(xmlHttp.responseText=='valid'){ alert('Email is valid'); document.getElementById('valid').value='1'; } else{ alert('Email already exists. Please choose different Email'); document.getElementById('email').value=''; document.getElementById('email').focus(); } } } function validate_aspace(path, val) { var url=path + "lib/ajax/validate.php?type=aspace&val=" + val; xmlHttp=GetXmlHttpObject(state_change_validate_aspace); xmlHttp.open("GET", url , true) xmlHttp.send(null) } function state_change_validate_aspace() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { if(xmlHttp.responseText=='valid') alert('Aspace URL is valid'); else{ alert('Aspace URL already exists. Please choose different Aspace URL'); document.getElementById('aspace').value=''; document.getElementById('aspace').focus(); } } } function validate_id(path, id) { var url=path + "lib/ajax/validate_id.php?uid=" + id; xmlHttp=GetXmlHttpObject(state_change_validate); xmlHttp.open("GET", url , true) xmlHttp.send(null) } function state_change_validate() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { if(xmlHttp.responseText=='valid') alert('User ID is valid'); else{ alert('ID already exists. Please choose different ID'); document.getElementById('user_id').value=''; document.getElementById('user_id').focus(); } } } function GetXmlHttpObject(handler) { var objXmlHttp=null if (navigator.userAgent.indexOf("Opera")>=0) { alert("This example doesn't work in Opera") return } if (navigator.userAgent.indexOf("MSIE")>=0) { var strName="Msxml2.XMLHTTP" if (navigator.appVersion.indexOf("MSIE 5.5")>=0) { strName="Microsoft.XMLHTTP" } try { objXmlHttp=new ActiveXObject(strName) objXmlHttp.onreadystatechange=handler return objXmlHttp } catch(e) { alert("Error. Scripting for ActiveX might be disabled") return } } if (navigator.userAgent.indexOf("Mozilla")>=0) { objXmlHttp=new XMLHttpRequest() objXmlHttp.onload=handler objXmlHttp.onerror=handler return objXmlHttp } } function get_form_values(obj){ var str=''; for(var i=0; i