//the following function provide the autotabbing between phonenumber fields //tested in firefox 1.5+ and IE 6.0+ //an array that will hold all the 'INPUT' elements on the current page var allinputs; //load function will register the 'keyHandler' function as the onKeyUp listner function loadAutoTab(){ //register listener document.onkeyup = keyHandler; //get all INPUT' elements allinputs = document.getElementsByTagName("INPUT"); document.getElementById('wlw-checkbox_key:{actionForm.copyHomeAddress}').checked=1; val1 = document.getElementById('wlw-checkbox_key:{actionForm.copyHomeAddress}'); if (val1 != null) { if (val1.checked == 1) { document.getElementById('toggleBilling').style.display = "none"; } else { document.getElementById('toggleBilling').style.display = ""; } } } //this function is a listener for the onKeyUp event function keyHandler(e){ if (document.all) { e = window.event; } var eventElement ; //get the element that triggered the event if(e.target){ eventElement=e.target; }else if (e.srcElement) { eventElement = e.srcElement; } var idx = getInputIndex(eventElement); //if the event was triggered by an 'INPUT' element check to see if the cursor needs to be moved to the next 'INPUT' element if(idx != -1){ //get the next 'INPUT' element var next = allinputs[idx+1]; if(next){ //move cursor if needed if(movecursor(eventElement, next)){ next.focus(); } } } } //returns the index of 'elementToFind' in 'allinputs' function getInputIndex(elementToFind){ for(var i = 0; i < allinputs.length; i++){ if(elementToFind == allinputs[i]){ return i; } } return -1; } //return true if the cursor should be moved to the next 'INPUT' element //false if the cursor is to remain on the current element function movecursor(eventElement,next){ var eleSize = eventElement.size; //do not move cursor if the current element size is > 4 if(eleSize > 4){ return false; } //do not move cursor if the next element size is > 4 if(next.size > 4){ return false; } //do not move cursor if the current element size is > then the next elements size if(eleSize > next.size){ return false; } //move cursor is the current element is filled all the way if(eventElement.value.length == eventElement.size){ return true; }else{ return false; } } //end autotabbing between phonenumber fields //this will stop the client side autocomplete function killAutoComplete(eleName){ var target = document.getElementById(eleName); if(target){ target.setAttribute("autocomplete","off"); } } //DWR utils var lastError = null; function tolerantFaultHandler(error) { //alert(error); lastError = error; } //populating credit card address with Home address function getHomeAddress() { DWRUtil.setValue('{actionForm.credit_city}', DWRUtil.getValue('{actionForm.city}')); DWRUtil.setValue('wlw-select_key:{actionForm.credit_billingCountry}',DWRUtil.getValue('wlw-select_key:{actionForm.billingCountry}')); DWRUtil.setValue('wlw-select_key:{actionForm.credit_state}',DWRUtil.getValue('wlw-select_key:{actionForm.state}')); DWRUtil.setValue('{actionForm.credit_streetAddress}',DWRUtil.getValue('{actionForm.streetAddress}')); DWRUtil.setValue('wlw-select_key:{actionForm.credit_streetAddress2}',DWRUtil.getValue('wlw-select_key:{actionForm.streetAddress2}')); DWRUtil.setValue('{actionForm.credit_aptNo}',DWRUtil.getValue('{actionForm.aptNo}')); DWRUtil.setValue('{actionForm.credit_zip}',DWRUtil.getValue('{actionForm.zip}')); } function disableDropdown(){ val1 = document.getElementById('wlw-checkbox_key:{actionForm.autoRecharge}'); if (val1.checked == 1) { document.getElementById('disablerechargesec').style.visibility ='visible' } else { document.getElementById('disablerechargesec').style.visibility ='hidden' } } function getAddressInfo(){ val1 = document.getElementById('wlw-checkbox_key:{actionForm.copyHomeAddress}'); if (val1.checked == 1) { document.getElementById('toggleBilling').style.display = "none"; } else { document.getElementById('toggleBilling').style.display = ""; DWRUtil.setValue('{actionForm.credit_city}',''); DWRUtil.setValue('wlw-select_key:{actionForm.credit_billingCountry}',''); DWRUtil.setValue('wlw-select_key:{actionForm.credit_state}',''); DWRUtil.setValue('{actionForm.credit_streetAddress}',''); DWRUtil.setValue('wlw-select_key:{actionForm.credit_streetAddress2}',''); DWRUtil.setValue('{actionForm.credit_aptNo}',''); DWRUtil.setValue('{actionForm.credit_zip}',''); } } //dynamic credit card loading function handleGetCCInfo(ccinfo) { DWRUtil.setValue('city',ccinfo.billCity); DWRUtil.setValue('{actionForm.city}',ccinfo.billCity); DWRUtil.setValue('country',ccinfo.billCountry); DWRUtil.setValue('{actionForm.country}',ccinfo.billCountry); DWRUtil.setValue('ccName',ccinfo.billName); DWRUtil.setValue('{actionForm.ccName}',ccinfo.billName); DWRUtil.setValue('states',ccinfo.billState); DWRUtil.setValue('{actionForm.state}',ccinfo.billState); DWRUtil.setValue('addrLine1',ccinfo.billStreet); DWRUtil.setValue('{actionForm.addrLine1}',ccinfo.billStreet); DWRUtil.setValue('addrLine2',ccinfo.billStreet2); DWRUtil.setValue('{actionForm.addrLine2}',ccinfo.billStreet2); DWRUtil.setValue('addrLine2num',ccinfo.billStreet2num); DWRUtil.setValue('{actionForm.addrLine2num}',ccinfo.billStreet2num); DWRUtil.setValue('ZIP',ccinfo.billZip); DWRUtil.setValue('{actionForm.ZIP}',ccinfo.billZip); DWRUtil.setValue('ccExpMonth',ccinfo.ccExpMonth); DWRUtil.setValue('{actionForm.ccExpMonth}',ccinfo.ccExpMonth); DWRUtil.setValue('ccExpYear',ccinfo.ccExpYear); DWRUtil.setValue('{actionForm.ccExpYear}',ccinfo.ccExpYear); DWRUtil.setValue('ccNumber','XXXXXXXXXXXX'+ccinfo.ccNo); DWRUtil.setValue('{actionForm.ccNumber}','XXXXXXXXXXXX'+ccinfo.ccNo); DWRUtil.setValue('ccType',ccinfo.ccType); DWRUtil.setValue('{actionForm.ccType}',ccinfo.ccType); } function getCCInfo(){ var key = DWRUtil.getValue('wlw-select_key:{actionForm.profile}'); IcmUIHelper.getCreditCard(key,handleGetCCInfo); } //dynamic state loading function changeState(country) { IcmUIHelper.getStateChange(createStateList, country ); } function createStateList(data){ DWRUtil.removeAllOptions("wlw-select_key:{actionForm.state}"); DWRUtil.addOptions("wlw-select_key:{actionForm.state}", data, false); } function changeStateShop(country) { IcmUIHelper.getStateChange(createStateListShop, country ); } function changeStateCredit(country) { IcmUIHelper.getStateChangeCredit(createStateListCredit, country ); } function createStateListCredit(data){ DWRUtil.removeAllOptions("wlw-select_key:{actionForm.credit_state}"); DWRUtil.addOptions("wlw-select_key:{actionForm.credit_state}", data, false); } function createStateListShop(data){ DWRUtil.removeAllOptions("wlw-select_key:{actionForm.state}"); DWRUtil.addOptions("wlw-select_key:{actionForm.state}", data, false); } function checkService() { if(DWRUtil.getValue('wlw-select_key:{actionForm.state}') == 'LA') document.getElementById('notsupported').innerHTML="Prepaid Virtual Card service is not available in LA, SC, and SD states. Sign up for Platinum or Postpaid Virtual Card service and enjoy the same low rates and benefits!"; else if(DWRUtil.getValue('wlw-select_key:{actionForm.state}') == 'SC') document.getElementById('notsupported').innerHTML="Prepaid Virtual Card service is not available in LA, SC, and SD states. Sign up for Platinum or Postpaid Virtual Card service and enjoy the same low rates and benefits!" else if(DWRUtil.getValue('wlw-select_key:{actionForm.state}') == 'SD') document.getElementById('notsupported').innerHTML="Prepaid Virtual Card service is not available in LA, SC, and SD states. Sign up for Platinum or Postpaid Virtual Card service and enjoy the same low rates and benefits!" else document.getElementById('notsupported').innerHTML=""; }