// JavaScript Document /* FORM VALIDATION FUNCTION */ function addMake() { document.getElementById("make_title").value = ""; document.getElementById("make_comments").value = ""; document.getElementById("make_id").value = ""; document.getElementById("action").value = "add"; document.getElementById("button").value = ""; document.getElementById("popupheading").innerHTML = "    "; showDiv("addDiv"); } function formValidate(frm){ if(frm.make_title.value=='') { alert("Please Enter make Name"); frm.make_title.focus(); return false; } else if(frm.make_title.value.length > 32) { alert("make name can be maximum 32 characters long"); frm.make_title.focus(); return false; } else return true; } /* AJAX CALLING FUNCTION FOR POPULATING EDIT */ function editVehMake(id) { if (window.XMLHttpRequest) http_request = new XMLHttpRequest(); else if (window.ActiveXObject) http_request = new ActiveXObject("Microsoft.XMLHTTP"); url ='http://www.reliancemotors.com.na/secure/actions//make.action.php?action=edit&id='+id; // window.open(url); try { http_request.open('GET', url,true); } catch(err){alert(err.toString());} http_request.onreadystatechange = handleResponseVehmake; try { http_request.send(null); } catch(err){alert(err.toString());} } function handleResponseVehmake() { var xmldoc = http_request.responseXML; if(http_request.readyState == 4 ) { if(xmldoc.getElementsByTagName('make_title')[0].hasChildNodes()) document.getElementById("make_title").value = xmldoc.getElementsByTagName('make_title')[0].firstChild.data; if(xmldoc.getElementsByTagName('make_id')[0].hasChildNodes()) document.getElementById("make_id").value = xmldoc.getElementsByTagName('make_id')[0].firstChild.data; document.getElementById("action").value = "update"; document.getElementById("button").value = "UPDATE MAKE"; } }