<!-- 
// ======================================================================================================================
// ************************************************** "Legacy" section. *************************************************
// ======================================================================================================================
function showRates(form) {
    form.rate_per_minute.value = form.planrate.value;
}

function showPlanRates(form) {
	var rateString=form.planrate.value;
	var rateValues=new Array();
	rateValues=rateString.split(',');
	form.rate_per_minute0.value = rateValues[0];
	form.rate_per_minute1.value = rateValues[1];
	form.rate_per_minute2.value = rateValues[2];
	form.rate_per_minute3.value = rateValues[3];
}

function submitForPin(form,pinValue) {
    form.pinSubmited.value = pinValue;
    form.submit();
}

function submitLocalNumberSearch(form) {
	if((form.npa.value == "") || (form.nxx.value == "") || (form.number.value == "") || (form.npa.value.length != 3) || (form.nxx.value.length != 3) || (form.number.value.length != 4)) {
	    alert('Please enter all 10 digits of your phone number to find local access number');
	} else {
	    form.submit();
	}
}



	function executeDoSubmit1(form, event) {
		var keycode;
	        if (window.event) {
	        	keycode  = window.event.keyCode;
		} else if (event) {
	        	keycode = event.which;
		}
		if (keycode == 13) {
			form.submit();
		}
	}

	function submitAndRedirect(form,redirectPage) {
	    form.redirect.value = redirectPage;
	    form.submit();
	}

	function checkAll(form) {
	    for( var i = 0; i < form.elements.length; i++) {
	        form.elements[i].checked = true;
	    }
	}

	function uncheckAll(form) {
	    for( var i = 0; i < form.elements.length; i++) {
	        form.elements[i].checked = false;
	    }
	}

// ======================================================================================================================
// ************************************************** End of the "Legacy" section. **************************************
// ======================================================================================================================




// ***************************************************************************************************************************
// ****************************************** [...] and now the **************************************************************
// **************************          TRUELY GENERAL USE FUNCTIONS :-)                 **************************************
// ***************************************************************************************************************************
// ***************************************************************************************************************************
	
	

// ======================================================================================================================
// ************************************************** Some String utility functions  ************************************
// ======================================================================================================================
// (Remark: the Trim related functions were taken from the /ep/ui/com/enjoyprepaid/totalmanager/interfaces/customer/displayProfile.jsp page)

	// ==================================================================
	// LTrim(string) : Returns a copy of a string without leading spaces.
	// ==================================================================
	function LTrim(str)
	{
		if (str == null) {
			return str;
		}
		var whitespace = new String(" \t\n\r");
		
		var s = new String(str);
		
		if (whitespace.indexOf(s.charAt(0)) != -1) {
			// We have a string with leading blank(s)...
			var j=0, i = s.length;
			
			// Iterate from the far left of string until we
			// don't have any more whitespace...
			while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
				j++;
				
			// Get the substring from the first non-whitespace
			// character to the end of the string...
			s = s.substring(j, i);
		}
		return s;
	}

	// ==================================================================
	// RTrim(string) : Returns a copy of a string without trailing spaces.
	// ==================================================================
	function RTrim(str)
	{
		if (str == null) {
			return str;
		}
	
		// We don't want to trip JUST spaces, but also tabs,
		// line feeds, etc.  Add anything else you want to
		// "trim" here in Whitespace
		var whitespace = new String(" \t\n\r");
		
		var s = new String(str);
		
		if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
			// We have a string with trailing blank(s)...
			var i = s.length - 1;       // Get length of string
			
			// Iterate from the far right of string until we
			// don't have any more whitespace...
			while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
				i--;
				
			// Get the substring from the front of the string to
			// where the last non-whitespace character is...
			s = s.substring(0, i+1);
		}
		
		return s;
	}

	// =============================================================
	// Trim(string) : Returns a copy of a string without leading or trailing spaces
	// =============================================================
	function Trim(str)
	{
		if (str == null) {
			return str;
		}
		return RTrim(LTrim(str));
	}

	/**
	 * Preffixes the received number with the zero string if that number consists from a single digit.
	 * That is, 0 to 9 become "00" to "09", while numbers above (or equal to) 10 remain the same.
	 * It is useful for more uniform display in dates, hours etc.
	 * NB: negative numbers are returned as received! (this function is intended to be used only with positive numbers!)
	 */
	function lpadNumberWithZeroIfSingleDigit( number ) {
		if ( number == undefined || number < 0 )
			return number;
		
		var zeroPreffix = "0";
		var emptyString = "";
		if ( number.toString().length == 1 && "0" <= number.toString() && number.toString() <= "9" )
			return zeroPreffix + number;
		else 
			return emptyString + number;
	}
	
	/**
	 * Changes the value of the date part element whose ID is received by preffixing the value with the zero string if that number consists from a single digit.
	 * That is, 0 to 9 become "00" to "09", while numbers above (or equal to) 10 remain the same.
	 * It is useful for more uniform display in dates, hours etc.
	 */
	function lpadDatePartElemWithZeroIfSingleDigit( elementID ) {
		if ( document.getElementById( elementID ) == null )
			return;
		// else set the element value with the padded numeric string
		document.getElementById( elementID ).value = lpadNumberWithZeroIfSingleDigit( document.getElementById( elementID ).value );
	}
	
// ======================================================================================================================
// *********************** End of the "Some String utility functions" section *******************************************
// ======================================================================================================================


// ======================================================================================================================
// ************************************************** Some window object utility functions  *****************************
// ======================================================================================================================

	/**
	 * The syntax of the window.open method is given below:
	 * 		open (URL, windowName[, windowFeatures])
	 * 
	 * 			URL 			The URL of the page to open in the new window. This argument could be blank.
	 * 			windowName 		A name to be given to the new window. The name can be used to refer this window again.
	 * 			windowFeatures 	A string that determines the various window features to be included in the popup window (like status bar, address bar etc) 
	 * 
	 */
	function openEasyBigger(theURL) {
    	var width = 610;
    	var height = 450;
    	if (screen) {
    		width = screen.width * 0.77;
    		height = screen.height * 0.77;
    	}
    	
    	var temp = window.open( theURL, ""
    							, "scrollbars=yes,width=" + width + ",height=" + height + ",titlebar=no"
    							);
    	temp.focus();
    }


	/* simplist function for disabling the other search criteria input element, depending on the currently checked radio button */
	function disableTheOtherSearchCriteriaInputElem( elemToBeDisabled, elemToBeEnabled ) {
		elemToBeDisabled.disabled = true; 
		elemToBeEnabled.disabled = false; 
	}
	
	/* simplist function for disabling the other search criteria input element(s), depending on the currently checked radio button */
	function disableTheOtherSearchCriteriaInputElems( elemsToBeDisabled, elemsToBeEnabled ) {
		for ( i = 0; i < elemsToBeDisabled.length; i++ ) 
			elemsToBeDisabled[ i ].disabled = true; 
		
		for ( i = 0; i < elemsToBeEnabled.length; i++ ) 
			elemsToBeEnabled[ i ].disabled = false; 
	}
	
	/* simplist function for disabling/making readOnly the other search criteria input element(s), depending on the currently checked radio button */
	function deactivateTheOtherSearchCriteriaInputElems( elemsToBeDisabled, elemsToBeMadeReadOnly, elemsToBeEnabled ) {
		for ( i = 0; i < elemsToBeDisabled.length; i++ ) {
			elemsToBeDisabled[ i ].disabled = true; 
			elemsToBeDisabled[ i ].style.backgroundColor = "LightGrey"; 	// elemsToBeDisabled[ i ].style="background-color:inactivecaption";
			// elemsToBeDisabled[ i ].style.color = "Grey"; 	// commented because the ".style.color" fragment leads to an "Invalid property value" error in IE6 ! 
		}
		
		for ( i = 0; i < elemsToBeMadeReadOnly.length; i++ ) {
			elemsToBeMadeReadOnly[ i ].disabled = false; 
			elemsToBeMadeReadOnly[ i ].readOnly = true;
			elemsToBeMadeReadOnly[ i ].style.backgroundColor = "LightGrey"; 	// elemsToBeDisabled[ i ].style="background-color:inactivecaption";
			// elemsToBeMadeReadOnly[ i ].style.color = "Grey"; 	// commented because the ".style.color" fragment leads to an "Invalid property value" error in IE6 ! 
		}
		
		for ( i = 0; i < elemsToBeEnabled.length; i++ ) {
			elemsToBeEnabled[ i ].disabled = false; 
			elemsToBeEnabled[ i ].readOnly = false; 
			elemsToBeEnabled[ i ].style.backgroundColor = "White"; 
			// elemsToBeEnabled[ i ].style.color = "Black"; 	// commented because the ".style.color" fragment leads to an "Invalid property value" error in IE6 ! 
		}
	}
	
// ======================================================================================================================
// ***************************** End of the "Some window object utility functions" section  *****************************
// ======================================================================================================================
	
	
	
	// ********************************************************************************************
	// ********************************************************************************************
	// ********************************************************************************************
	// **************************          A TEMPORARY WARNING:                 *******************
	// **************************         ======================                *******************
	// ************************** PLEASE DO NOT USE THE FUNCTIONS BELLOW !      *******************
	// ************************** (the ones which are in the                    *******************
	// ************************** "Java Script functions to Handle AutoSearch"  *******************
	// ************************** or in the "Yet Another Simple Ajax library"   *******************
	// ************************** sections/categories)                          *******************
	// **************************                                               *******************
	// ************************** THEY WORK (AT LEAST ON SOME BROWSERS)         *******************
	// ************************** BUT THEY ARE NOT YET COMPLETELY DONE !        *******************
	// ************************** THE NEXT VERSIONS MIGHT HAVE DIFFERENT        *******************
	// ************************** FUNCTION NAMES AND/OR SIGNATURES              *******************
	// ************************** AND/OR BEHAVIORS !                            *******************
	// ************************** (SO IT'S BETTER TO AVOID USING THEM           *******************
	// ************************** IN THEIR CURRENT FORM !)                      *******************
	// ********************************************************************************************
	// ********************************************************************************************
	// ********************************************************************************************
	
	
	// ********** Java Script functions to Handle AutoSearch *******************
	// 
	function selectKeyDown( form, filteringStringInputName ) {
	    // Delete Key resets previous search keys
	    if ( window.event.keyCode == 46 ) { // 'del' key
	        clearFilteringString( form, filteringStringInputName );
	        // TODO: add code for setting the selected element of the targeted list to the first element of the list (2007-10-25, emil.prager);
	        
	        // var userBrowser = navigator.appCodeName;
	        // alert( "You pressed the Delete key and you use " + userBrowser );
	    }
	}
	
	function selectKeyPress( form, filteringStringInputName ) {
	    // Notes:
	    //    1) previous keys are cleared onBlur/onFocus and with the Delete key;
	    //    2) if the search doesn't find a match, this returns to normal 1 key 
	    //        search setting returnValue = false below for ALL cases will 
	    //        prevent default behavior
	    
	    // TODOs:
	    //    1) add handling for Netscape/Firefox (&al, e.g. Opera, Safari/Konqueror &c.);
	    // 		[this in fact is a desirable, but not an urgent thing to do, because the Mozilla based browsers (as well as Opera) have already built-in this feature) [2007-10-24, emil.prager].
	    
	    
	    // form.elements[ filteringStringInputName ].style.visibility = "visible";
	    document.all[ "filteringText" ].style.visibility = "visible"; 	// NEW trial 2007-10-24, emil.prager;
	
	    var sndr = window.event.srcElement;
	    var pre = this.document.all[ filteringStringInputName ].value;
	    var key = window.event.keyCode;
	    var char = String.fromCharCode( key );
	
	    var regex = new RegExp( "^" + pre + char, "i" ); 	// "i" -> ignoreCase;
	
	    for ( var i = 0; i < sndr.options.length; i++ ) {
	        if ( regex.test( sndr.options[ i ].text ) ) {
	            sndr.options[i].selected = true;
	            document.all[ filteringStringInputName ].value += char;
	            
	            document.all[ "filteringText" ].value += char; 			// NEW trial 2007-10-24, emil.prager;
	            
	            // document.getElementById( "filteringText" ).value += char;
	            // document.getElementById( filteringStringInputName ).value += char;
	            
	            window.event.returnValue = false;
	            break;
	        }
	    }
	}
	
	
	function clearFilteringString( form, filteringStringInputName ) {
		// the following are good if the javascript is embedded in the page (by using a jsp:include directive, for example)
	    document.all[ filteringStringInputName ].value = "";
	    document.all[ "filteringText" ].value = ""; // TODO: hardcoding here!
	    
	    // document.getElementById( filteringStringInputName ).value = "";
	    // document.getElementById( "filteringText" ).value = "";
	    
	    // NEW trial: for the "normal" approach, i.e. for the case when the javascript is taken from another valid external Javascript file [2007-10-24, emil.prager];
	    // form.elements[ filteringStringInputName ].value = ""; // FIXME!
	    // form.elements[ "filteringText" ].value = ""; 
	}
	
	function selectListLeft( form, filteringStringInputName ) { 	 			// NEW trial 2007-10-24, emil.prager;
		document.all[ "filteringText" ].style.visibility = "hidden"; 				// for IE
		// document.getElementById( "filteringText" ).style.visibility = "hidden"; 	// for Mozilla (?)
		
		// clearFilteringString( form, filteringStringInputName );
	}
	
// ********** END of the "Java Script functions to Handle AutoSearch" section *******************



// ======================================================================================================================
// ************************************************** Some master-detail lists assignment utility functions  ************
// NB: These will be shortly replaced by the more user-friendly and modern drag 'n drop functions 
// (using the Rico AJAX framework) 	[2007-10-26, emil.prager@nobelglobe.com]
// ======================================================================================================================
// Remark: this in fact is the content of the /NobelServices/src/common/war-part/js/common/multiSelectSrcDst.js  
// JavaScript file [2007-10-30, emil.prager@nobelglobe.com]

    // --- Move Item ---
    
    function moveByName(srcName, dstName) {
        var src = document.getElementById(srcName);
        var dst = document.getElementById(dstName);
        moveItem(src, dst);
    }
    
    function moveItem(src, dst) {
        var selIndex = src.selectedIndex;
        while (selIndex != null) {
            var option = src.options[selIndex];
            if (option.value != null) {
                var dstLength = dst.length;
                dst.options[dstLength] = new Option(option.text, option.value);
                src.options[selIndex] = null;
            }
            selIndex = src.selectedIndex;
        }
    }
    
    // --- Move All Items ---
    
    function moveAllByName(srcName, dstName) {
        var src = document.getElementById(srcName);
        var dst = document.getElementById(dstName);
        moveAll(src, dst);
    }
    
    function moveAll(src, dst) {
        var length = src.length;
        for (i = 0; i < length; i++) {
            var option = src.options[i];
            var dstLength = dst.length;
            dst.options[dstLength] = new Option(option.text, option.value);
        }
        clearAllItems(src);
    }

    // --- Copy Item ---
    
    function copySingleToMultiByName(srcName, dstName) {
        var src = document.getElementById(srcName);
        var dst = document.getElementById(dstName);
        copyItemSingleToMulti(src, dst);
    }

    function copySingleToMultiByName(srcName, dstName, textPrefix, valuePrefix) {
        var src = document.getElementById(srcName);
        var dst = document.getElementById(dstName);
        copyItemSingleToMulti(src, dst, textPrefix, valuePrefix);
    }
    
    function copyItemSingleToMulti(src, dst) {
        var selIndex = src.selectedIndex;
        var option = src.options[selIndex];
        if (option.value != null) {
            var dstLength = dst.length;
            dst.options[dstLength] = new Option(option.text, option.value);
        }
    }

    function copyItemSingleToMulti(src, dst, textPrefix, valuePrefix) {
        var selIndex = src.selectedIndex;
        var option = src.options[selIndex];
        if (option.value != null) {
            var dstLength = dst.length;
            dst.options[dstLength] = new Option(textPrefix + option.text, valuePrefix + option.value);
        }
    }
    
    // --- Clear Items ---
    
    function clearAllItemsByName(srcName) {
        var src = document.getElementById(srcName);
        clearAllItems(src);
    }

    function clearAllItems(src) {
        for (i = 0; i < src.length; i++) {
            src.options[i] = null;
        }
        src.length = 0;
    }
    
    // --- Submit Items ---
    
    function selectAll(srcName) {
        var src = document.getElementById(srcName);
        var length = src.length;
        for (i = 0; i < length; i++) {
            src.options[i].selected = true;
        }
    }
    
// ********** END of the "Some master-detail lists assignment utility functions" section *******************
	
	
// ******************* Array and select lists utility functions *******************

	/* small utility function to check whether an array contains an element 
	 * (inserted here because I didn't find a js built-in function to do that (or a function from a framework we already use) 
	 */
	function arrayContains( /* Array */ array, /* var */ elem ) {
		for ( var i = 0; i < array.length; i++ )
			if ( array[ i ] != undefined 
				&& elem == array[ i ]
			)
				return true;
			else 
				continue;
		
		return false;
	}

	function sortLexicographicallyByName( a, b ) {
    	var x = a.toLowerCase();
    	var y = b.toLowerCase();
    	return ( (x < y) ? -1 
    				 : ( (x > y) ? 1 : 0 ) 
    		);
	}
	
	function sortList( myListId ) {
		var lb = document.getElementById( myListId );
		arrTexts = new Array();
		arrValues = new Array();
		arrOldTexts = new Array();
	
		for ( i = 0; i < lb.length; i++ ) {
			arrTexts[i] = lb.options[i].text;
			arrValues[i] = lb.options[i].value;
			
			arrOldTexts[i] = lb.options[i].text;
		}
		
		arrTexts.sort( /* sortLexicographicallyByName */ );
		
		for ( i = 0; i < lb.length; i++ ) {
			lb.options[i].text = arrTexts[i];
			for ( j = 0; j < lb.length; j++ ) {
				if ( arrTexts[i] == arrOldTexts[j] ) {
					lb.options[i].value = arrValues[j];
					j = lb.length;
				}
			}
		}
	}
	
	function computeCommaSeparatedStringFromList( myListId ) {
		var lb = document.getElementById( myListId );
		var commaSeparatedIdValues = "";
		// arrValues = new Array();
	
		// TODO: use the javascript buil-in function join() for this!
		var i = -1;
		for ( i = 0; i < lb.length - 1; i++ ) {
			commaSeparatedIdValues += lb.options[i].value + ",";
		}
		if ( i == lb.length - 1 )
			commaSeparatedIdValues += lb.options[i].value;
		
		
		return commaSeparatedIdValues;
	}
	
	
	/* function for filling (populating ) a select list
	 * (the boolean arg appendMode says if the list should be emptied first (if false))
	 */
	function populateSelectList( targetElem, withText, appendMode ) {
		var targetList = document.getElementById( targetElem ); 	// $( targetElem );
		
		if ( ! appendMode )
			targetList.innerHTML = ""; 		// reinitialization;
		
		// we'll use the method accepted by IE (also by Mozilla etc.), with constructing instances of the kind:
		// 		opt = new Option( 'text', 'value' );
		
		var optionValues = withText.getElementsByTagName( "option" );
		var opt; 
		var optValue;
		var optText;
		for ( var i = 0; i < optionValues.length; i++ ) {
			optValue = optionValues[ i ].attributes[ 0 ].nodeValue;
			optText  = optionValues[ i ].firstChild.nodeValue;
			opt = new Option( optText, optValue );
			// alert ( "<opt value=" + optValue + ">" + optText + "</opt>" );
			targetList.options[ targetList.options.length ] = opt;
		}
	}
	
	


// ======================================================================================================================
// ************************************************** Yet Another Simple Ajax library  **********************************
// NB: These will be shortly replaced by the more user-friendly and modern drag 'n drop functions 
// (using the Rico AJAX framework) 	[2007-10-26, emil.prager@nobelglobe.com]
// ======================================================================================================================

	function getXMLHTTPRequest() {
		try {
			req = new XMLHttpRequest();
		} catch(err1) {
			try {
				req = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (err2) {
				try {
					req = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (err3) {
					req = false;
				}
			}
		}
		
		return req;
	}
	
	
	var http = getXMLHTTPRequest();
	
	
	// TO BE CONTINUED ! 
	// PLEASE AVOID USING THOSE FUNCTIONS FOR THE MOMENT, UNTIL THESE WARNINGS WILL BE REMOVED!
	
	

// ********** END of the "Yet Another Simple Ajax library" section ******************************************************



// -->




 /***********************************************
 * Bookmark site script- � Dynamic Drive DHTML code library (www.dynamicdrive.com)
 * This notice MUST stay intact for legal use
 * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
 ***********************************************/
 
 /* Modified to support Opera and we excluded FireFox browser (there is no solution for bookmarking in FireFox) */
 function bookmarksite(title,url){
 	if(window.opera && window.print) { // opera
		  var elem = document.createElement('a');
		  elem.setAttribute('href',url);
		  elem.setAttribute('title',title);
		  elem.setAttribute('rel','sidebar');
		  elem.click();
	} 
	else if(document.all)// ie
	      window.external.AddFavorite(url, title);
 }