var deliverychecked = false; function cartaction(action, pid, qty) { if (deliverychecked) { // addtocart() - adds product to the shopping cart // PARAM - pid : product ID var r = document.getElementById("Remarks"); var Rmks = (typeof(r.value)=='undefined') ? " " : r.value; if (action=='ADD') { var elts = document.body.getElementsByTagName("select") var ThisElt = 'opt' + pid; var Options = ''; for(i=0;i-1) { var catid = elts[i].id.substr((elts[i].id.indexOf(ThisElt) + ThisElt.length + 1)); Options += "&Options[" + catid + "]=" + elts[i].value; } } } else if (action=='CQTY') { var Options = ""; } atc = new AJAX(); atc.open("POST", "ajax_modcart.php", true); atc.onreadystatechange=function() { if (atc.readyState==4) { document.getElementById("shoppingcart").innerHTML=atc.responseText; } } atc.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); atc.send("action="+action+"&products_id="+pid+"&quantity="+qty+"&Remarks="+Rmks+Options); } else { alert("Please enter the postal code of the delivery address first."); deliverypc.focus(); } } function CheckTime(dpc){ ct = new AJAX(); ct.open("POST", "ajax_service.php", true); ct.onreadystatechange=function(){ if (ct.readyState==4){ pcStatus.innerHTML = ""; if (ct.responseText=="error") { Availability_Msg.innerHTML="Please enter a valid postal code."; deliverychecked = false; } else { Availability_Msg.innerHTML=ct.responseText; deliverychecked = true; } } } ct.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); pcStatus.innerHTML = ""; ct.send("deliverypc="+dpc); }