ns4 = (document.layers)? true:false; ie4 = (document.all)? true:false; function ShowLayer(id) { if (ns4) { document.layers[id].visibility = "show"; } else if (ie4) { document.all[id].style.visibility = "visible"; } } function HideLayer(id) { if (ns4) document.layers[id].visibility = "hide" else if (ie4) document.all[id].style.visibility = "hidden" } function navigateList(form,newparam,newvalue) { form.action = form.action + "?" + newparam + "=" + newvalue; form.submit(); } function UnderConstruction() { window.alert("Coming Soon."); } function onBodyLoad() { } /*********************************************************** * BEGIN - functions for one-to-many screens ************************************************************/ function ChangeListRight(availableList,selectedList,associatedItem) { var TempString = ""; var associatedValue = ""; var associatedText = ""; var hasSelected = false; // was an extra element passed? if(!isUndefined(associatedItem)) { // set value if text box if(associatedItem.type == 'text') { associatedValue = associatedItem.value; associatedText = associatedItem.value; } // set value if select box if (associatedItem.type == 'select-one') { for(var i=0; i < associatedItem.options.length; i++) { if (associatedItem.options[i].selected) { associatedValue = associatedItem.options[i].value associatedText = associatedItem.options[i].text } } } // set associatedValue separator string TempString = ","; } for(var i=0; i < availableList.options.length; i++) { if (availableList.options[i].selected) { hasSelected = false; for(var n=0; n < selectedList.options.length && !hasSelected; n++) { if(selectedList.options[n].value == availableList.options[i].value + TempString + associatedValue) { hasSelected = true; } } if(!hasSelected) { selectedList.options[selectedList.options.length] = new Option(availableList.options[i].text + TempString + associatedText, availableList.options[i].value + TempString + associatedValue, 1); // sj-removed for alpha3 /*availableList.options[i] = null; // remove the ith element i--; // after remove the ith element, the index is changed */ } } } } function SaveSelected(selectedList) { for (i=0; i < selectedList.length; i++) { selectedList[i].selected = true; } } function ChangeListLeft(selectedList,availableList) { for(var i=0; i < selectedList.options.length; i++) { if (selectedList.options[i].selected) { var toTrim = selectedList.options[i].text.indexOf(','); // sj-removed for alpha3 // add value to available list /* if(!isUndefined(availableList)) { availableList.options[availableList.options.length] = new Option(Left(selectedList.options[i].text,toTrim), selectedList.options[i].value, 1); } */ selectedList.options[i] = null; // remove the ith element i--; // after remove the ith element, the index is changed } } } function disableBothLists(selectedList,availableList) { // unselect all in availList for(var i=0; i < availableList.options.length; i++) { availableList.options[i].selected = false; } availableList.disabled = true; //remove all elements for(var i=0; i < selectedList.options.length; i++) { selectedList.options[i] = null; // remove the ith element i--; // after remove the ith element, the index is changed } selectedList.disabled = true; } function AddTextValue(availableText,selectedList) { selectedList.options[selectedList.options.length] = new Option(availableText.value); } function SubmitFind() { if (ie4) { if ( window.event.keyCode == 13) { FindValues(); } /* } else { if (window.event.which == 13) { FindValues(); } */ } } /*********************************************************** * END - functions for one-to-many screens ************************************************************/ function ValCharCharacters(string_value, name_display) { var Success = true; var aInvalidString = "'"; if (string_value.indexOf(aInvalidString) >= 0) { alert("The field " + name_display + " may not contain the character " + aInvalidString + ". Please edit your text and try again.") Success = false; } return Success; } function ValCharCount(string_value, name_display, maxlength) { var Success = true; if ((string_value.length > maxlength)) { //hsw 1/29/02 B336 alert("You may only enter " + maxlength + " characters for the field '" + name_display + "'. Please edit your text and try again."); Success = false; } return Success; } //hsw 2/07/02 for textarea field size validation (B336) //this applies to OnKeyDown event in IE, it does not work in nested table in netscape.. function charCount1(field, name_display, maxlength) { if (field.value.length > maxlength) { //alert("You have reached the " + maxlength + " character limit for this form field '" + name_display + "'."); if (confirm("You have entered " + field.value.length + " characters, which is longer than the limit (" + maxlength + " characters) for this field '" + name_display + "'. \n Click 'OK', trailling text will be truncated. \n Click 'Cancel' to edit text.")) { field.value = field.value.substring(0,maxlength); } field.focus(); } } //this applies to OnChange event in Netscape function charCount2(field, name_display, maxlength) { if (navigator.appName == 'Netscape' && navigator.appVersion.indexOf('4.') == 0) { if (field.value.length > maxlength) { if (confirm("You have entered " + field.value.length + " characters, which is longer than the limit (" + maxlength + " characters) for this field '" + name_display + "'. \n Click 'OK', trailling text will be truncated. \n Click 'Cancel' to edit text.")) { field.value = field.value.substring(0,maxlength); } field.focus(); } } else { //IE, do not alert again.. if (field.value.length > maxlength) { field.value = field.value.substring(0,maxlength); field.focus(); } } } // Validate Number function ValInteger(string_value, name_display) { //Returns true if value is an integer or is NULL otherwise returns false var Success = true; var number_format = " 0123456789"; var check_char; var trailing_blank = false; // indicates if the trailing blank stream has started var digits = false; // indicates if the digit stream has started if (string_value != null) { //Characters can be only digits for (var i = 0; i < string_value.length; i++) { check_char = number_format.indexOf(string_value.charAt(i)); if (check_char < 0) Success = false; else if (check_char == 0) { // blank space; ignored leading blanks if (digits) { trailing_blank = true; } } else if (trailing_blank) { Success = false; } else { digits = true; } if (Success == false) { alert("Invalid Number for field "+name_display) break; } } } return Success } // Validate Date function ValDate(string_value, name_display) { //Returns true if value is a date format mm/dd/yyyy or is NULL //otherwise returns false var Success = true; if (string_value.length != 0) { //Parse the mm-dd-yyyy format isplit = string_value.indexOf('-'); if (isplit == -1 || isplit == string_value.length) Success = false; else { sMonth = string_value.substring(0, isplit); isplit = string_value.indexOf('-', isplit + 1); if (isplit == -1 || (isplit + 1 ) == string_value.length) Success = false; else { sDay = string_value.substring((sMonth.length + 1), isplit); sYear = string_value.substring(isplit + 1); } } if (Success) if (!ValIntegerRange(sMonth, 1, 12)) //check month Success = false; else if (!ValIntegerRange(sYear, 1000, 9999)) //check year Success = false; else if (!ValDay(sYear, sMonth, sDay)) // check day Success = false; } if (Success == false) alert("Invalid Date Format for Field "+name_display) return Success } //validate day function ValDay(pYear, pMonth, pDay) { var Success = true; maxDay = 31; if (pMonth == 4 || pMonth == 6 || pMonth == 9 || pMonth == 11) maxDay = 30; else if (pMonth == 2) { if (pYear % 4 > 0) maxDay =28; else if (pYear % 100 == 0 && pYear % 400 > 0) maxDay = 28; else maxDay = 29; } Success = ValIntegerRange(pDay, 1, maxDay); //check day return Success } function ValIntegerRange(string_value, min_value, max_value) { //if value is in range then return true else return false var Success = true; if (string_value.length == 0) Success = true; if (!ValInteger(string_value, '')) Success = false; else { // check minimum if (min_value != null) { if (string_value < min_value) Success = false; } // check maximum if (max_value != null) { if (string_value > max_value) Success = false; } } return Success } function Right(str, n) { if (n <= 0) // Invalid bound, return blank string return ""; else if (n > String(str).length) // Invalid bound, return return str; // entire string else { // Valid bound, return appropriate substring var iLen = String(str).length; return String(str).substring(iLen, iLen - n); } } function Left(str, n) { if (n <= 0) // Invalid bound, return blank string return ""; else if (n > String(str).length) // Invalid bound, return return str; // entire string else // Valid bound, return appropriate substring return String(str).substring(0,n); } function LTrim(str) { for (var i=0; str.charAt(i)==" "; i++); return str.substring(i,str.length); } function RTrim(str) { for (var i=str.length-1; str.charAt(i)==" "; i--); return str.substring(0,i+1); } function Trim(str) { return LTrim(RTrim(str)); } function doCookie(cookie_name) { if(document.cookie) { index = document.cookie.indexOf(cookie_name); } else { index = -1; } var expires = "Monday, 04-Apr-2010 05:00:00 GMT" if (index == -1) { document.cookie=cookie_name+"=1; expires=" + expires; } else { countbegin = (document.cookie.indexOf("=", index) + 1); countend = document.cookie.indexOf(";", index); if (countend == -1) { countend = document.cookie.length; } count = eval(document.cookie.substring(countbegin, countend)) + 1; document.cookie=cookie_name+"="+count+"; expires=" + expires; } } function gettimes(cookie_name) { if(document.cookie) { index = document.cookie.indexOf(cookie_name); if (index != -1) { countbegin = (document.cookie.indexOf("=", index) + 1); countend = document.cookie.indexOf(";", index); if (countend == -1) { countend = document.cookie.length; } count = document.cookie.substring(countbegin, countend); //alert (count+ " times"); return count; } } return 0; } function killCookie(cookie_name) { document.cookie= cookie_name+"=0; expires=Fri, 13-Apr-1970 00:00:00 GMT"; } function isUndefined(a) { return typeof a == 'undefined'; } /** * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/) */ function echeck(str) { var at="@"; var dot="."; var lat=str.indexOf(at); var lstr=str.length; var ldot=str.indexOf(dot); if (str.indexOf(at)==-1){ alert("Invalid E-mail Address"); return false; } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ alert("Invalid E-mail Address"); return false; } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ alert("Invalid E-mail Address"); return false; } if (str.indexOf(at,(lat+1))!=-1){ alert("Invalid E-mail Address"); return false; } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ alert("Invalid E-mail Address"); return false; } if (str.indexOf(dot,(lat+2))==-1){ alert("Invalid E-mail Address"); return false; } if (str.indexOf(" ")!=-1){ alert("Invalid E-mail Address"); return false; } return true; } function ValidateEmail(emlField){ //var emailID=document.frmSample.txtEmail; /* if ((emlField.value==null)||(emlField.value=="")){ alert("Please Enter your Email Address"); emlField.focus(); return false; }*/ if (!((emlField.value==null)||(emlField.value==""))) { if (echeck(emlField.value)==false){ //emlField.value=""; emlField.focus(); return false; } return true; } } function ParseUSNumber(PhoneField) { var FmtStr=""; var index = 0; var LimitCheck; var PhoneNumberInitialString = PhoneField.value; LimitCheck = PhoneNumberInitialString.length; if (!LimitCheck == 0) { while (index != LimitCheck) { if (isNaN(parseInt(PhoneNumberInitialString.charAt(index)))) { } else { FmtStr = FmtStr + PhoneNumberInitialString.charAt(index); } index = index + 1; } if (FmtStr.length == 10) { FmtStr = FmtStr.substring(0,3) + "-" + FmtStr.substring(3,6) + "-" + FmtStr.substring(6,10); } else { FmtStr=PhoneNumberInitialString; alert("United States phone/fax numbers must have exactly ten digits (numbers)."); PhoneField.focus(); } PhoneField.value=FmtStr; } }