// disable the specified button to prevent it being pressed again then call onClickAction function setAction( actionValue ) { document.forms[0].action.value = actionValue; } // turnoff and disable "dpaOptOut" if limited company or "limited liability partnership" is selected function legalStatusChange(legalStatus, dpaOptOut) { var legalStatus = document.getElementById('legalStatus'); var dpaOptOut = document.getElementById('dpaOptOut'); // Limited company and Limited liability partnership have indexes of 3 and 4 respectively if (legalStatus.selectedIndex>=3) { dpaOptOut.checked=false; dpaOptOut.disabled=true; } else { dpaOptOut.disabled=false; } } // Logic tags needed to show/hide the EnergyView registration section function showEnergyViewRegistration() { var energyViewCheckBox = document.getElementById('energyView'); if (energyViewCheckBox.checked) { showDiv('energyViewRegistration'); } else { hideDiv('energyViewRegistration'); } } // reset action for administer users function administerUsersReset(formObj) { formObj.firstName.value=''; formObj.lastName.value=''; formObj.companyName.value=''; formObj.email.value=''; } //as above but updated for quotes function statusChange(formObj) { // Limited company and Limited liability partnership have indexes of 4 and 5 respectively if (formObj.status.selectedIndex>3) { formObj.dpa.checked=false; formObj.dpa.disabled=true; } else { formObj.dpa.disabled=false; } } function popUp(URL) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400,left = 340,top = 312');"); } // if the given div was hidden using display="none" then this will show it using inline function showDiv(divId) { var div = document.getElementById(divId); div.style.display = "inline"; } // hides the given div using display="none" function hideDiv(divId) { var div = document.getElementById(divId); div.style.display = "none"; } // either this object or the other object is allowed to contain something, atleast one object must be enabled function eitherOr(thisId, otherId ) { var thisObject = document.getElementById(thisId); var otherObject = document.getElementById(otherId); otherObject.disabled = (thisObject.value!="" && otherObject.value==""); thisObject.disabled = (otherObject.value!="" && thisObject.value==""); if (otherObject.disabled) { otherObject.style.backgroundColor = '#E6EAF1'; } else { otherObject.style.backgroundColor = '#FFFFFF'; } if (thisObject.disabled) { thisObject.style.backgroundColor = '#E6EAF1'; } else { thisObject.style.backgroundColor = '#FFFFFF'; } } function disable(id) { var element = document.getElementById(id); element.disabled=true; } function enable(id) { var element = document.getElementById(id); element.disabled=false; } function setValue(id, newValue) { var element = document.getElementById(id); element.value = newValue; } function setCheckedValue(id, newValue) { var element = document.getElementById(id); element.checked=newValue; element.value=newValue; } function checkAll(field) { // All list boxes are selected and check boxes are checked for (i = 0; i < field.length; i++) { field[i].selected = field[i].checked = true ; } } function uncheckAll(field) { // All list boxes are de-selected and check boxes are un-checked for (i = 0; i < field.length; i++) { field[i].selected = field[i].checked = false; } } var newWindow; function NewWindows(mypage, myname, w, h, scroll) { if (newWindow != null) { if (!newWindow.closed) { newWindow.close(); } } var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable' win = window.open(mypage, myname, winprops) if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } } function targetopener(mylink, closeme, closeonly) { if (! (window.focus && window.opener))return true; window.opener.focus(); if (! closeonly)window.opener.location.href=mylink.href; if (closeme)window.close(); return false; } function displayPopup(pageName, pageWidth, pageHeight) { if (newWindow != null) { if (!newWindow.closed) { newWindow.close(); } } availableHeight = screen.availHeight; availableWidth = screen.availWidth; midHeight = availableHeight / 2; midWidth = availableWidth / 2 windowX = Math.floor(midWidth - (pageWidth / 2)); windowY = Math.floor(midHeight - (pageHeight / 2)); browserType = navigator.appName.toLowerCase(); if (browserType.indexOf("netscape") >= 0) { XPosString = "screenX=" + windowX + ","; YPosString = "screenY=" + windowY + ","; } else if (browserType.indexOf("microsoft") >= 0) { XPosString = "left=" + windowX + ","; YPosString = "top=" + windowY + ","; } else { XPosString = ""; YPosString = ""; } eval("newWindow = window.open(pageName,'information','location=no,menubar=no,resizable=yes," + XPosString + YPosString + "scrollbars=yes,status=no,toolbar=no,width=" + pageWidth + ",height=" + pageHeight + "')"); newWindow.focus(); return false; }