function ChangeStateList(Country, State) { if (!Country) return; var req = new JsHttpRequest(); req.onreadystatechange = function() { if (req.readyState == 4) { if (req.responseJS) { var pNode = document.getElementById('TDStateID'); var child; while(child = pNode.firstChild) { pNode.removeChild(child); } if(req.responseJS.IsStates > 0) { var sel = document.createElement( "SELECT" ); sel.setAttribute('name', 'State'); var oOpt = document.createElement( "OPTION" ); sel.options.add( oOpt ); oOpt.text = ""; oOpt.setAttribute( 'value', "" ); var state; for(state in req.responseJS.TextArray) { var oOpt = document.createElement( "OPTION" ); sel.options.add( oOpt ); oOpt.setAttribute( 'value', req.responseJS.TextArray[state].Code ); oOpt.selected = req.responseJS.TextArray[state].Selected ? 'selected' : ''; oOpt.text = req.responseJS.TextArray[state].Name; } pNode.appendChild(sel); } else { var inp = document.createElement( "INPUT" ); inp.setAttribute('name', 'OtherStateName'); if (req.responseJS.TextOtherName && req.responseJS.TextOtherName != "undefined") { inp.setAttribute('value', req.responseJS.TextOtherName); } pNode.appendChild(inp); } } } } req.caching = false; req.open(null, 'form.POST /ajax_common.php', true); req.send({ Action:"GetStateList", Ajax:"1", Country:Country, OtherStateName:State, State:State}); } function ChangeDate(fromID, toID) { fromElem = document.getElementById(fromID); toElem = document.getElementById(toID); toElem.value = fromElem.value; } function CheckPackage(elm) { for (var i = 0; i < elm.options.length; i++) { if (elm.options[i].selected && elm.options[i].id.substr(0, 3) == 'out') { elm.selectedIndex = 0; alert('This package is out of stock'); } } }