function deliveryEstimateError(errorCode, errorMessage){ document.getElementById("deliveryDateBox").value = "Error: " + errorCode + " : " + errorMessage;}
function changeShippingOption(){ var deliveryOptionsListMenu = document.getElementById("deliveryOptionsSelect"); var selectedShippingChoice = deliveryOptionsListMenu.value; for(var i=0; i<deliveryDestObj.shippingOptionsArr.length; i++){ var apiShippingDesc = deliveryDestObj.shippingOptionsArr[i].shippingOptionName; if(apiShippingDesc == selectedShippingChoice){ document.getElementById("deliveryDateBox").value = deliveryDestObj.shippingOptionsArr[i].arrivalDesc; deliveryDestObj.selectNewShippingMethod(apiShippingDesc);}
}
}
function buildDeliveryWidget(){ var deliveryOptionsListMenu = document.getElementById("deliveryOptionsSelect"); for(var i=0; i<deliveryDestObj.shippingOptionsArr.length; i++){ var shippingDescription = deliveryDestObj.shippingOptionsArr[i].shippingOptionName; deliveryOptionsListMenu.options[deliveryOptionsListMenu.length] = new Option(shippingDescription, shippingDescription);}
changeShippingOption(); earliestDeliveryDateObj.setTime(Date.parse(deliveryDestObj.earliestDelivery()));}
function countdownTimerEvent(hours, minutes, seconds){ var hoursDesc = "Hours"; if(hours == "1")
hoursDesc = "Hour"; document.getElementById("countdownTimer").innerHTML = hours + " " + hoursDesc + ", " + minutes + " Min, " + seconds + " sec";}
var earliestDeliveryDateObj = new Date(); var deliveryDestObj = new ShippingEst(); deliveryDestObj.responseEvnt(buildDeliveryWidget, this); deliveryDestObj.attachErrorEvent(deliveryEstimateError, this); deliveryDestObj.countdownTimerEvnt(countdownTimerEvent, this); if(productIdOnPage != ""){ deliveryDestObj.setProductID(productIdOnPage); deliveryDestObj.fireRequest();}

