var BWTP_DateForDeliveryTimeList = "0000-00-00"; var BWTP_DeliveryDivId = document.getElementById("delivery-time-div"); var BWTP_ServingDivId; if( ! (BWTP_ServingDivId = document.getElementById("serving-time-div")) ) { BWTP_ServingDivId = false; } var BWTP_DeliveryDivIdContentHolder = BWTP_DeliveryDivId.innerHTML; var BWTP_ServingDivIdContentHolder = BWTP_ServingDivId ? BWTP_ServingDivId.innerHTML : ''; var BWTP_InitialDeliveryListItems = Array(); var BWTP_InitialServingListItems = Array(); function BWTP_IDisAvailable(id) { return document.getElementById(id) ? true : false; } function BWTP_NameOfHTMLtagIDbelongsTo(id) { return document.getElementById(id).nodeName; } function BWTP_MakeDeliveryTimeList() { var s; BWTP_EmptyBothDivItems(); CloseBoth(); document.getElementById("bwtp-delivery-time-value").value = ""; var d; if( (d=document.getElementById("bwtp-serving-time-value")) ) { d.value = ""; } var id = "bwdp-calendar-date-is-for-time-list"; //BWTP_DateForDeliveryTimeList = BWTP_IDisAvailable(id) ? ( (BWTP_NameOfHTMLtagIDbelongsTo(id) == 'INPUT' || BWTP_NameOfHTMLtagIDbelongsTo(id) == 'input') ? document.getElementById(id).value : document.getElementById(id).innerHTML ) : "0000-00-00"; BWTP_DateForDeliveryTimeList = BWTP_IDisAvailable(id) ? ( ( (s = BWTP_NameOfHTMLtagIDbelongsTo(id)) == 'INPUT' || s == 'input') ? document.getElementById(id).value : document.getElementById(id).innerHTML ) : "0000-00-00"; BWTP_RequestDropdownContents("delivery",BWTP_DateForDeliveryTimeList); } // function BWTP_MakeDeliveryTimeList() function BWTP_MakeHTTPconnection() { var http; try { http = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { try { http = new XMLHttpRequest(); } catch (e3) { http = false; } } } return http; } // function BWTP_MakeHTTPconnection() function BWTP_RequestDropdownContents(which,value) { var http = BWTP_MakeHTTPconnection(); if(! http) { return false; } var datestamp = new Date().getTime(); var params = new Array(); params.push( "which=" + encodeURIComponent(which) ); params.push( "value=" + encodeURIComponent(value) ); params.push( "type=div" ); params.push( "stamp=" + encodeURIComponent(datestamp) ); http.onreadystatechange = function() { BWTP_HandleDropdownContents(http,which); } //alert("GET","/date-time/TimePickerTimeListGeneration.php?" + params.join("&")); http.open("GET","/date-time/TimePickerTimeListGeneration.php?" + params.join("&"),true); http.setRequestHeader("Connection", "close"); http.send(''); } // function BWTP_RequestDropdownContents() function BWTP_HandleDropdownContents(http,which) { if(http.readyState == 4) { if(http.status == 200) { switch(which) { case "delivery" : var items = BWTP_OptionsString2ListItemsArray(http.responseText); BWTP_UpdateDeliveryDivItems(items); break; case "serving" : var items = BWTP_OptionsString2ListItemsArray(http.responseText); BWTP_UpdateServingDivItems(items); break; } } else { alert('\n\nContent request error, status code:\n'+http.status+' '+http.statusText); } } } // function BWTP_HandleDropdownContents() function BWTP_OptionsString2ListItemsArray(itemstring) { itemstring = itemstring.replace(/^\s*/ig,""); itemstring = itemstring.replace(/\s*$/ig,""); itemstring = itemstring.replace(/<\/option>/ig,""); itemstring = itemstring.replace(/\r/g,""); var retarray = Array(); var ta = itemstring.split("\n"); var len = ta.length; for( var i=0; i"); var text = tta[1]; tta[0] = tta[0].replace(/