// This JScript File should contain all javascript used by controls // MUST NOT USE PROTOTYPE FUNCTIONS as this is included in clients websites // and prototype can clash with existing scripts. // *************************************************************************** // // This section of the JS file contains generic javascript functions for // manipulating controls // *************************************************************************** // //**************************************** // Function: PUControl_ShowHideControl // Purpose: This function hides or displays the control specified in sID, depending on the value of the // control oControl, and the value of oControl, specified by sValue. // If the value of oControl and sValue match, the control sID is displayed // Param: oControl - the control the user is interacting with // sValue - value you want oControl to be so sID is shown, otherwise it is hidden // sID - ID of the control you want to show/hide // Returns: none //**************************************** function PUControl_ShowHideControl( oControl, sValue, sID) { // Find the object var oObject = document.getElementById(sID); // Check if the value of oControl equals sValue if (oControl.value == sValue) { // Show the object oObject.style.display = ""; } else { // Hide the object oObject.style.display = "none"; } } //**************************************** // Function: PUControl_ClearContols // Purpose: This function clears the values in oClearControls, if the value oControl matches sValue // Param: oControl - the control the user is interacting with // sValue - Value of which you want the control to be for the contols in oClearContols to then be cleared // oClearContols - IDs of the controls you want to clear // Returns: none //**************************************** function PUControl_ClearContols(oControl, sValue, oClearContols ) { // Check if the value of oControl equals sValue if (oControl.value == sValue) { // Loop through the controls and clear their values for ( var lCounter=0, lSize=oClearContols.length; lCounter lmaxLength) { // Yes, truncate the input to the limit oControl.value = oControl.value.substring(0,lmaxLength) // Update the text to say how many characters remaining, hightlighted in red document.getElementById(oControl.name + '_lCharCountLabel').innerHTML = '' + sCharCountLabel + ':' document.getElementById(oControl.name + '_lCharCounter').innerHTML = '0' bClipped = true; } else { // No, Update the text to say how many characters remaining document.getElementById(oControl.name + '_lCharCountLabel').innerHTML = sCharCountLabel + ':' document.getElementById(oControl.name + '_lCharCounter').innerHTML = lmaxLength - oControl.value.length } return bClipped; }