/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	Version:		
	Date:		

	Script Name:  svmXCommon.js
	Created By:   Adam Lotrowski
	Date:         02/05/2003
	Copyright:    Copyright 2003, SVMedia
	Purpose:      Common javascript functions
	
	History:
  
  	TABLE OF FUNCTIONS:
	___________________________________________________________________________________________________________________________________________
			
	Trim................................Remove extra spaces from left and right sides of string
	RTrim...............................Remove extra spaces from right side of string
	LTrim...............................Remove extra spaces from left side of string
	
	RemoveQRYStringNameValuePairExcept..Remove All Name/Value Pair Parameters from Querystring Except One
	RemoveQRYStringNameValuePair........Remove Name/Value Pair Parameters from Querystring
	getOpenerQueryString................Return Parent.Opener Querystring
	getOpenerURL........................Return Parent.Opener URL
	buildDropdownDate...................Build date string based on date select input parts
	buildDropdownTime...................Build time string based on date select input parts		
	
	showtip.............................Display tool-tip over any page element on event
	hidetip.............................Hide tool-tip
	
	GetCheckedValuesCSV.................Return csv list of checkbox values checked
		
	printPageWindow.....................Print page Window
	printPageFrame......................Print page Frame
	ClipBoard...........................Store inner text of element to clip board
	submitForm..........................Submits form adding default functionality
	emptyField..........................Sets field emply if equals specified value
	isVowel.............................Boolean check if string starts with vowel to determine if it should be preceeded with a 'an' or 'a'
		
	checkAll............................All checkboxes associated to 'check all' checkbox will equal 'check all' input
	AllChecked..........................Checks that the 'check all' checkbox is in consistent state with all its associated checkboxes

	openFFPWindow.......................Opens a window for a new FFP (form flow process)
	closeWindow.........................Close current window, refresh parent, and set focus to parent
	closeWindowNoRefresh................Close window, set focus to parent
	closeWindowRefresh..................Close current window, refresh parent, and set focus to parent (Parent passed in object)
	openServiceWindow...................Open Service Window with scroll, reszie at 700x360   
	BBLogin.............................Open BB Login Window with scroll, reszie at 602x360    
	openBBWindow........................Open BB Window with scroll, reszie at 602x360   
		
	CheckField..........................Determine if string is valid based on character set and 
	CheckEmail..........................Check the validity of a string submitted as an e-mail
	CheckPickList.......................Check that a selection from a drop down menu has been made (.text property)
	CheckPickListValue..................Check that a selection from a drop down menu has been made (.value property)
	ValidatePassword....................Check that a string entered as a password fits certain criteria passed through by the user
	CompareStrings......................Compare two strings and return a true or false
	
	checkValidChars.....................Check whether all elements in a string are within a valid set and returning either true or false.
	checkMinLength......................Check whether or not a string is smaller than given minimum value returning a corresponding true or false value.
	checkMaxLength......................Check whether a string is greater than a given value returning a corresponding true or false value.
	checkNumericRange...................Check whether a given number lies within a given numeric range, returning a true or false value.
	checkLeapYear.......................Check whether or not a a given year is a leap year.
	checkDate...........................Checks that fields entered for a particular date are valid in terms of the number of days in a paritular month
	
	browserTime.........................Writes browser(client's) time
	browserDate.........................Writes browser(client's) date
	browserDateTime.....................Writes browser(client's) datetime
	browserDayDateTime..................Writes browser(client's) Day, Date Time
	browserDayDate......................Writes browser(client's) Day, Date
	
	getDayOfWeekByDate..................Get Day or Day abbrev from date string
	getDayOfWeekByDateParts.............Get Day or Day abbrev from date string parts
	monthStringToInt....................Converts month name to numerical representation
	monthIntToString....................Converts month numerical representation to month name

	alternateStyle......................Alternate background style for a multi-select input
	moveLRSelect........................Switchs multiple left-right select lists
	orderList...........................Set FormAction and OrderBy Column in hidden inputs and submits form
		
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/


/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Set FormAction and OrderBy Column in hidden inputs and submits form

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function orderList(objForm, intOrderByColumn, intFormOrderByAction){
	if (objForm.FormAction)			{objForm.FormAction.value		= intFormOrderByAction;}
	if (objForm.FormOrderByAction)	{objForm.FormOrderByAction.value= intFormOrderByAction;}
	if (objForm.OrderByColumn)		{objForm.OrderByColumn.value	= intOrderByColumn;}

	objForm.submit();
}


/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Boolean check if string starts with vowel to determine if it should be preceeded with a 'an' or 'a'

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function isVowel(strValue){
	var blnSuccess     = false;
	var intCtr 		   = 0;
	
	var arrEscapeWords = new Array(1);
	arrEscapeWords[0]  = "username";
	
	var strValidChars  = 'aeiou';
	var strFirstLetter = strValue.substring(0,1).toLowerCase();
	
	blnSuccess = checkValidChars(strFirstLetter,strValidChars)
		
	for(intCtr = 0; intCtr < arrEscapeWords.length; intCtr++){
		if (Trim(strValue.toLowerCase()) == Trim(arrEscapeWords[intCtr].toLowerCase())){blnSuccess = false;}
	}
	return blnSuccess;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Remove extra spaces from left and right sides of string

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function Trim(strValue){
	if(strValue.length <= 0){return '';}
	strValue = RTrim(strValue);
	strValue = LTrim(strValue);
	if(strValue == ''){return '';} else {return strValue;}
} 

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Remove extra spaces from right side of string

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function RTrim(strValue){
	
	var strSpace	   = String.fromCharCode(32);
	var strValueLength = strValue.length;
	var tmpValue 	   = '';

	if(strValueLength <= 0 ){return '';}

	var intCharCtr = strValueLength - 1;

	while(intCharCtr > -1){
		if(strValue.charAt(intCharCtr) == strSpace){}
		else{
			tmpValue = strValue.substring(0, intCharCtr + 1);
			break;
		}
		intCharCtr = intCharCtr - 1;
	} 
	return tmpValue;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Remove extra spaces from left side of string

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function LTrim(strValue){
	
	var strSpace 		= String.fromCharCode(32);
	var strValueLength 	= strValue.length;
	var tmpValue 		= '';
	var intCharCtr 		= 0;
	
	if(strValueLength <= 0 ){return '';}

	while (intCharCtr < strValueLength){
		if(strValue.charAt(intCharCtr) == strSpace){}
		else{
			tmpValue = strValue.substring(intCharCtr,strValueLength);
			break;
		}
		intCharCtr = intCharCtr + 1;
	}
	return tmpValue;
} 

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Remove All Name/Value Pair Parameters from Querystring Except One

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function RemoveQRYStringNameValuePairExcept(strQueryString, csvKeepParamName, blnEncodeValues){
	
	var strNewQueryString = '';
	var strParamValue	  = '';
	var pairs 			  = strQueryString.split("&"); // Split query at the amperstand
	var blnMatchFound
	
	if (csvKeepParamName.indexOf(',') == -1){		
		var arrKeepParams = new Array(csvKeepParamName);
	}else{
		var arrKeepParams = csvKeepParamName.split(",");
	}
	
	// Begin loop through the querystring
	for(var i = 0; i < pairs.length; i++) {
		
		var pos = pairs[i].indexOf('='); 	// Look for "name=value"		
		if (pos == -1) continue; 			// if not found, skip to next
		// Extract the name/value pair, Don't repeat target data And build new querystring
		//	target data will be appended to location upon second popup form
		
		for(var j = 0; j < arrKeepParams.length; j++) {
			if( pairs[i].substring(0,pos).toLowerCase() == arrKeepParams[j].toLowerCase() ) {blnMatchFound=true;break;} else {blnMatchFound=false;}
		}
		
		if (blnMatchFound==true)
		{
			if (blnEncodeValues == true) {strParamValue = escape(pairs[i].substring(pos+1));} else {strParamValue = pairs[i].substring(pos+1);}
			
			if (Trim(strNewQueryString) == ''){
				strNewQueryString += pairs[i].substring(0,pos)+'='+strParamValue;
			}
			else{		
				strNewQueryString += '&'+pairs[i].substring(0,pos)+'='+strParamValue;
			}
		}
	}
	return strNewQueryString;	
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Remove Name/Value Pair Parameters from Querystring

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function RemoveQRYStringNameValuePair(strQueryString, strRemoveParamName, blnEncodeValues){
	
	var strNewQueryString = '';
	var strParamValue	  = '';
	var pairs 			  = strQueryString.split("&"); // Split query at the amperstand
	
	// Begin loop through the querystring
	for(var i = 0; i < pairs.length; i++) {
		
		var pos = pairs[i].indexOf('='); 	// Look for "name=value"		
		if (pos == -1) continue; 			// if not found, skip to next
		// Extract the name/value pair, Don't repeat target data And build new querystring
		//	target data will be appended to location upon second popup form
		if (pairs[i].substring(0,pos) != strRemoveParamName)
		{
			if (blnEncodeValues == true) {strParamValue = escape(pairs[i].substring(pos+1));} else {strParamValue = pairs[i].substring(pos+1);}
			if (i==0){
				strNewQueryString += pairs[i].substring(0,pos)+'='+strParamValue;
			}
			else{		
				strNewQueryString += '&'+pairs[i].substring(0,pos)+'='+strParamValue;
			}
		}
	}
	return strNewQueryString;	
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Return Parent.Opener Querystring

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function getOpenerQueryString(strWindowOpener){
	if (strWindowOpener != ''){
		var objWindowOpener = eval(strWindowOpener);
		if(objWindowOpener){													//Parent URL And QueryString
			var strQueryString = objWindowOpener.location.search.substring(1);	// Get Query String
			if (strQueryString != '') {return strQueryString;} else {return '';}
		}else{return '';}
	}else{return '';}
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Return Parent.Opener URL

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function getOpenerURL(strWindowOpener){
	if (strWindowOpener != ''){
		var objWindowOpener = eval(strWindowOpener);
		if(objWindowOpener){
			var strOldURL = objWindowOpener.location.href;			
			if (objWindowOpener.location.href.indexOf('?') == -1){
				return objWindowOpener.location = objWindowOpener.location.href
			}else{
				return strOldURL.substring(0,strOldURL.indexOf('?'));
			}
		}else{return '';}
	}else{return '';}
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Build Date string based on date select input parts

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function buildDropdownDate(objMonthName, objDayName, objYearName){
	var strMonth	= objMonthName.options[objMonthName.selectedIndex].value;
	var strDay 		= objDayName.options[objDayName.selectedIndex].value;
	var strYear 	= objYearName.options[objYearName.selectedIndex].value;
	var strDate 	= strMonth + "/" + strDay + "/" + strYear;
	if(strDate == '//'){strDate = '';}
	return strDate
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Build time string based on time select input parts

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function buildDropdownTime(objHourName, objMinuteName, objAMPMName){
	var strHour		= objHourName.options[objHourName.selectedIndex].value;
	var strMinute 	= objMinuteName.options[objMinuteName.selectedIndex].value;
	var strAMPM 	= objAMPMName.options[objAMPMName.selectedIndex].value;
	var strTime 	= strHour + ":" + strMinute + " " + strAMPM;
	if(strTime == ': '){strTime = '';}
	return strTime
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Display tool-tip over any page element on event	
	DEFINITION: showtip(this,event,'<MESSAGE>')

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
if (!document.layers&&!document.all&&!document.getElementById){event="tooptip"}

function showtip(current,e,text){

	if (document.all||document.getElementById){
		thetitle=text.split('<br>')
		if (thetitle.length>1){
			thetitles=''
			for (i=0;i<thetitle.length;i++)
				{thetitles+=thetitle[i]}
			current.title=thetitles
		}else{current.title=text}
	}else if (document.layers){
		document.tooltip.document.write('<layer bgColor="white" style="border:1px solid black;font-size:12px;">'+text+'</layer>')
		document.tooltip.document.close()
		document.tooltip.left=e.pageX+5
		document.tooltip.top=e.pageY+5
		document.tooltip.visibility="show"
	}
}
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Hide tool-tip

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/	
function hidetip(){
	if (document.layers)
	document.tooltip.visibility="hidden"
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Print Page  Window

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function printPageWindow(){
	window.print(); 
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Print Page Frame

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function printPageFrame(strFrameObjRef){
	var objFrameObjRef = eval(strFrameObjRef);
	objFrameObjRef.focus();
	objFrameObjRef.print();
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Store inner text of element to clip board

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function ClipBoard(objHoldText,  objCopyText) {
	window.clipboardData.setData("text", objCopyText.innerText);
	//OR
	//objHoldText.innerText = objCopyText.innerText;
	//var objCopiedText = objHoldText.createTextRange();
	//objCopiedText.select();
	//objCopiedText.execCommand('copy');
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Submits form adding default functionality
	NOTES:		Intention was to use with showCursorWait function

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function submitForm(objForm){
	objForm.submit();
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Sets field emply if equals specified value

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function emptyField(fieldToBeEmptied,initialValue) {
	if (fieldToBeEmptied.value == initialValue) {
		fieldToBeEmptied.value = "";
	}
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Sets selected value for input type select based on specified value

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function setSelectOption(objFormDropDown, strValue){
	if(objFormDropDown){
		for (i=0; i <= objFormDropDown.options.length - 1 ; i++)
		{if (objFormDropDown.options[i].value == strValue)	
			{objFormDropDown.options[i].selected = true;} 
		}
	}
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Sets selected value for input type select based on specified value

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function setRadioOption(objFormRadio, strValue){
	for (var i=0; i <= objFormRadio.length - 1 ; i++){
		if (objFormRadio[i].value == strValue){objFormRadio[i].checked = true};
	} 
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Sets selected value for input type select based on specified value

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function setCheckOption(objFormCheckBox, strValue){
	var tmpValue
	
	for (var i=0; i <= objFormCheckBox.length - 1 ; i++)
		{objFormCheckBox[i].checked = false;} 
	
	if(objFormCheckBox && strValue != ''){
		if (strValue.split(',') != -1){
			var arrOptions = strValue.split(',');
		}else{
			var arrOptions = new Array[0];
			arrOptions[0] = strValue;
		}
				
		for(var j=0; j<arrOptions.length; j++){ 
			
			tmpValue = Trim(arrOptions[j])
			
			if(Trim(tmpValue) != ''){
				for (var i=0; i <= objFormCheckBox.length - 1 ; i++)
				{if (objFormCheckBox[i].value.indexOf(tmpValue) != -1)	
					{objFormCheckBox[i].checked = true;} 
				}
			}		
		}
	}
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Return csv list of checkbox values checked

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function GetCheckedValuesCSV(objCheckBox){
	
	var csvListOfSelectedItems = '';
	var intCheckedCount		   = 0;

	if (objCheckBox) {
		var formField = objCheckBox;
		
		if(formField.length){
			for (i = 0; i < formField.length; i++){
				if ((formField[i].checked) && (!(formField[i].disabled))){
					if (intCheckedCount == 0) {
						csvListOfSelectedItems += formField[i].value
						intCheckedCount += intCheckedCount + 1
					} else {
						csvListOfSelectedItems += "," + formField[i].value
						intCheckedCount += intCheckedCount + 1
					}
				}
			}
		}else{
			if (formField.checked){
				csvListOfSelectedItems += formField.value
			}
		}
	}	
	return csvListOfSelectedItems;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Change cursor to hand

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function cursorOn(targetID){
	targetID.style.cursor = "hand";
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Change cursor to default pointer

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function cursorOff(targetID){
	targetID.style.cursor = "pointer";
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Modify all elements on page so that cursor is hourglass
	NOTES:		May not work in NN

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function showCursorWait(){
	 for (var i=0;i<document.all.length;i++) { 
	 	document.all[i].style.cursor = "wait";
	 } 
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Modify all elements on page so that cursor is default pointer
	NOTES:		May not work in NN

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function showCursorArrow(){
	 for (var i=0;i<document.all.length;i++) { 
	 	document.all[i].style.cursor = "pointer";	 	
	 } 	
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DESCRIPTION: 
	WHEN CHECK ALL IS CLICKED, ALL ASSOCIATION CHECKBOXS WILL EQUAL 
	THE STATE OF THE CHECK ALL CHECKBOX
  
PARAMETERS:
	listCheckBox.....Single/Group of Checkbox object(s) that masterCheckBox
					 controls
	masterCheckBox...Select All / Unselect All Checkbox object
   
RETURNS:
	listCheckBox state equals masterCheckBox
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function checkAll(listCheckBox, masterCheckBox){

	if (listCheckBox){

		var formField = listCheckBox;

		if (formField.length) {
			for (i = 0; i < formField.length; i++){
				if(!formField[i].disabled){ 
					formField[i].checked = masterCheckBox.checked;
				}
			}
		}else{
			formField.checked = masterCheckBox.checked;
		}
	}
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DESCRIPTION:
	WHEN ALL ASSOCIATION CHECKBOXES ARE ALL IN THE SAME STATE THEN 
	THE CHECK ALL CHECK BOX IS IN THE SAME STATE.
  
PARAMETERS:
	listCheckBox.....Single/Group of Checkbox object(s) that masterCheckBox
					 controls
	masterCheckBox...Select All / Unselect All Checkbox object
   
RETURNS:
	masterCheckBox state equals listCheckBox if all either checked or not
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function AllChecked(listCheckBox, masterCheckBox){
	
	var blnAllChecked = true;

	if (listCheckBox) {
		var formField = listCheckBox;
	
		if(formField.length){
			for (i = 0; i < formField.length; i++){
				if ((!(formField[i].checked)) && (!(formField[i].disabled))){
					masterCheckBox.checked = false;
					blnAllChecked = false;
				}
			}
		}else{
			if (!(formField.checked)){
				masterCheckBox.checked = false;
				blnAllChecked = false;
			}
		}
	}	
	if (blnAllChecked == true){
		masterCheckBox.checked = true;
	}
}


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Validation Functions
// ====================
// Version 2.1 [9.29.00] 
//
// This file includes several javascript functions that facilitate client side validation.
// Includes date functions, password verification and string compare.
//
// Copyright SVMedia 2000. All rights reserved
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
// OpenFFPWindowFunction
// ===================
// Author:
//		Stephen Rojas
//  Purpose:
//		Opens a window for a new FFP (form flow process). This is a wizard like tools  that operates
// 		in a window with a very paritcular setup. The URL passed is where the FFP should start.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function openFFPWindow(URL){
	FFPWindow = window.open(URL, "FFPWindow", "scrollbars=0,resizable=0,height=300,width=500,left=200,top=200")			
	FFPWindow.focus();
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Close current window, refresh parent, and set focus to parent

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function closeWindow(){
	if(window.opener){
		window.opener.location = window.opener.location;
		window.opener.focus();
	}	
	window.close();
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Close window, set focus to parent

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/	
function closeWindowNoRefresh(){
	if(window.opener){window.opener.focus();}
	window.close();
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Close current window, refresh parent, and set focus to parent (Parent passed in object)

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/	
function closeWindowRefresh(strParent){
	var objParent = eval(strParent);
	var strURL = getOpenerURL(objParent) + '?' + getOpenerQueryString(objParent);
	if(objParent){
		objParent.location = strURL;
		objParent.focus();
	}	
	window.close();
}


/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Close current window, refresh parent, and set focus to parent (Parent passed in object)

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/	
function closeWindowRefreshWithQueryString(strParent, strURL){
	var objParent = eval(strParent);
	var strURL = getOpenerURL(objParent) + '?' + strURL
	if(objParent){
		objParent.location = strURL;
		objParent.focus();
	}	
	window.close();
}
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Open Service Window with scroll, reszie at 700x360

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function openServiceWindow(serviceURL) 
	{
	serviceWindow = window.open(serviceURL, "", "scrollbars,resizable,height=360,width=700")
	}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Open BB Login Window with scroll, reszie at 602x360

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function BBLogin() 
	{
	BBWindow = window.open("", "BBWindow", "scrollbars,resizable,height=360,width=620");
	}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	PURPOSE:	Open BB Window with scroll, reszie at 602x360

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function openBBWindow(serviceURL) 
	{
	BBwindow = window.open(serviceURL, "", "scrollbars,resizable,height=360,width=620")
	}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
// CheckField Function
// ===================
// Author:
//		Jim Coll
//  
// Purpose:
//		The purpose of the function is to determine whether a string submitted contains only
//		elements of the valid set as well as whether or not it is greater than the minimum 
//		permited length
//
// Variables required:
//		ValidString = a string variable which contains all valid elements used in the check
//		FieldName   = the string to be checked
//      FailMessage = a string variable containing the message to be used in case the entered 
//					  string is not valid
//		MinAvail    = the minimum number of elements that will be permitted in the passed string
//		MinMessage  = a string variable containing the message to be used in case the string is 
//                    shorter than the required length (this can be used to check if the string 
//					  empty by setting the minimum length to '0')   
//
//
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function CheckField( ValidString, FieldName, FailMessage, MinAvail, MinMessage ) {
 
    var allValid;
	
	allValid = true

	if ( FieldName.value.length < MinAvail ) {
			alert( MinMessage );
			FieldName.focus();
			return( false );
			}
	

//now check for valid characters in the field
  for ( i = 0;  i < FieldName.value.length;  i++ ) {
    ch = FieldName.value.charAt(i);
		for ( j = 0;  j < ValidString.length;  j++ ) {
      if ( ch == ValidString.charAt(j) ) {
				break;
      }
			if ( j == (ValidString.length - 1 ) ) {
        allValid = false;
        break;
			}
		}
	}	
	if ( !allValid ) {
	                      alert( FailMessage );
	                      FieldName.focus();
		                  return ( false );
		             }
                          else {return( true );	}
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//CheckField Function End -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -




// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
// CheckEmail Function
// ===================
// Author: 
//		Jim Coll
//
// Purpose:
//		The purpose of the function is to check the validity of a string submitted as an e-mail.
//		It checks for the 'myname@myplace.com' format, including no spaces, use of '@' and a 
//      .*** suffix
//      
// Variables required:
//		EmailFieldValue = a string variable containing the email to validate
//
// Modified:
// 		Jan 30 2002 by Stephen Rojas
//		Function now takes an optional field, EmailFieldName, which is used to give back more descriptive
//		alert messages.
//
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function CheckEmail( EmailFieldValue, EmailFieldName ) {
  if ( ( EmailFieldValue == '' ) || ( EmailFieldValue == ' ' ) ) {
		if (( EmailFieldName == '' ) || ( EmailFieldName == ' ' ) || !EmailFieldName ) {
			alert( "E-mail address is a required field." );			
		}else{
			alert( EmailFieldName + " is a required field." );
		}
		return( false );
	}

	var a=0
	var NewLen = EmailFieldValue.length;
	var strFieldName 
	
//check for spaces in email addresses

for ( a = 0;  a < NewLen;  a++ ) {
   ch = EmailFieldValue.charAt(a);
	if ( ch == " " ) {
		alert("E-mail addresses shouldn't have any spaces in them. \nTry it like this: myname@myplace.com" );
		return ( false );
	}
}	

   a=0;


	while ( ( a < NewLen ) && ( EmailFieldValue.charAt(a) != "@" ) ) {
		a++
	}
	if ( ( a >= NewLen ) || ( EmailFieldValue.charAt(a) != "@" ) ) {
		if (( EmailFieldName == '' ) || ( EmailFieldName == ' ' ) || !EmailFieldName ) {
			alert("Invalid E-mail address, please reenter.");		
		}else{
			alert("The e-mail entered for field " + EmailFieldName + " is invalid, please re-enter." );
		}
		return( false );	
	}
	else {
		a=a+2
	}
	while ( ( NewLen > a ) && ( EmailFieldValue.charAt(a) != "." ) ) {
		if ( EmailFieldValue.charAt(a) == "@" ) {
		if (( EmailFieldName == '' ) || ( EmailFieldName == ' ' ) || !EmailFieldName ) {
			alert("Invalid E-mail address, please reenter.");		
		}else{
			alert("The e-mail entered for field " + EmailFieldName + " is invalid, please re-enter." );
		}

			return(false);
		}
	a++
	}

	if( ( a >= NewLen -1 ) || ( EmailFieldValue.charAt(a) != "." ) ) {
				if (( EmailFieldName == '' ) || ( EmailFieldName == ' ' ) || !EmailFieldName ) {
			alert("Invalid E-mail address, please reenter.");		
		}else{
			alert("The e-mail entered for field " + EmailFieldName + " is invalid, please re-enter." );
		}
		return( false );
	} 
	else {
		return( true ); 
	}
}
///- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//CheckEmail Function End -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
// CheckPickList & CheckPickListValue Functions
// ============================================
// Author: 
//		Jim Coll
//
// Purpose:
//		The purpose of these functions is to check that a selection from a drop down menu has
//      been made. The CheckPickList function can be used on regular string variables defined 
//		within a given function. The CheckPickListValue function checks the .value property of 
//		the variable as opposed to the .text 
//      
// Variables required:
//		theField		 = the select box variable name 
//		strFieldDescript = a string variable containing a descriptive name for the field 
//
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function CheckPickList(theField,strFieldDescript){

if(theField.options[theField.selectedIndex].text.length>=1) 
  { return(true);}
  else{
   alert(strFieldDescript + ' is a required field.');
   return(false);}
}


function CheckPickListValue(theField,strFieldDescript){

if(theField.options[theField.selectedIndex].value.length>=1) 
  { return(true);}
  else{
   alert(strFieldDescript + ' is a required field.');
   theField.focus();
   return(false);}
}

///- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// CheckPickList & CheckPickListValue Functions End -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
// ValidatePassword Functions
// =============================================
// Author: 
//		Stephen Rojas [9.28.00]
//
// Purpose:
//		The purpose of this function is to check that a string entered as a password fits certain
//      criteria passed through by the user. The criteria the user can control includes minimum 
//		number of numbers, minimum number of letters, minimum and maximum length. The valid 
//      characters for the function are assumed to be all letters and numbers, and are entered as
//		the strPassword string at the beginning of the function
//      
// Variables required:
//		strCheck		 = string submitted to check 
//		minLength		 = minimum length allowed for the password  
//		maxLength		 = maximum length allowed for the password
//		minNumbers		 = minimum number of numbers required for a valid password
//		minLetters		 = minimum number of letters required for a valid password
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function ValidatePassword(strCheck, minLength, maxLength, minNumbers, minLetters){
	var strPassword = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
	var strNumbers = "1234568790";
	var strLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

	//check password length
	if (strCheck.value.length < minLength){
		alert("Password requires at least " + minLength + " characters");
		strCheck.focus()
		return false;
	}
	
	if (strCheck.value.length > maxLength){
		alert("Password requires only " + maxLength + " characters");
		strCheck.focus()
		return false;
	}
	

//check password characters
	allValid = true;
	for (i = 0; i < strCheck.value.length; i++){
		current = strCheck.value.charAt(i);
		for (j = 0; j < strPassword.length; j++){
			if (current == strPassword.charAt(j)){
				break;
			}
			if (j == (strPassword.length-1)){
				allValid = false;
				break;
			}
		}
	}
	if (!allValid){
		alert("Non-valid characters entred in the 'Password' field");
		strCheck.focus()
		return (false);
	}
	
//check minimal number of numbers
	numberCounter = 0;
	for (i = 0; i < strCheck.value.length; i++){
		currentN = strCheck.value.charAt(i);
		for (j = 0; j < strNumbers.length; j++){
			if (currentN == strNumbers.charAt(j)){
				numberCounter++;
				break;
			}
		}
	}
	if (numberCounter < minNumbers){
		alert(minNumbers + " numbers are required in the 'Password' field");
		strCheck.focus()
		return (false);
	}	
	
//check minimal number of letters
	letterCounter = 0;
	i=0;
	j=0;
	for (i = 0; i < strCheck.value.length; i++){
		currentL = strCheck.value.charAt(i);
		for (j = 0; j < strLetters.length; j++){
			if (currentL == strLetters.charAt(j)){
				letterCounter++;
				break;
			}
		}
	}
	if (letterCounter < minLetters){
		alert(minLetters + " letters are required in the 'Password' field!");
		strCheck.focus()
		return (false);
	}

return true; 
}
///- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// ValidatePassword Function End -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
// CompareStrings Function
// =============================================
// Author: 
//		Stephen Rojas [9.28.00]
//
// Purpose:
//		The purpose of this function is simply to compare two strings and return a true or false
//      result
//      
// Variables required:
//		string1		 = first string for comparison 
//		string2		 = second string for comparison
//
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function CompareStrings(string1, string2){
var equal=true;

	if (string1.value.length == string2.value.length){
		offset = string1.value.indexOf(string2.value)
		if (offset != 0){equal=false;}
	}
	else {equal=false;}
return (equal);
}

///- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// CompareString Function End -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
// CheckValidChars Function
// =============================================
// Author: 
//		Jim Coll
//
// Purpose:
//		The purpose of this function is simply to check whether all elements in a string are 
//      within a valid set and returning either true or false.
//      
// Variables required:
//		string1		 = string for comparison 
//		strValid	 = string containing all valid elements
//
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function checkValidChars(string1,strValid){
	var i
	for (i=0;i<=string1.length-1;i++) {
		if (strValid.search(string1.charAt(i)) == -1){
			return false;
		}
	}
	return true;
}

///- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// CheckValidChars Function End -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
// checkMinLength & checkMaxLength Functions 
// =============================================
// Author: 
//		Jim Coll
//
// Purpose:
//		The purpose of these functions is to check whether or not a string is smaller than 
//		given minimum value (checkMinLength) or whether or not a string is greater than a 
//		given value (checkMaxLength), and returning a corresponding true or false value.
//      
// Variables required:
//		string1		 = string for comparison 
//		intMinLength = integer value for minimum limit
//		intMaxLength = integer value for minimum limit
//
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function checkMinLength(string1,intMinLength){
	if (string1.length <= intMinLength-1) {
		return false;
	} else {
		return true;
	}
}	

function checkMaxLength(string1,intMaxLength){
	if (string1.length >= intMaxLength+1) {
		return false;
	} else {
		return true;
	}
}	

///- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// checkMinLength & checkMaxLength Functions End -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
// checkNumericRange Function 
// =============================================
// Author: 
//		Jim Coll
//
// Purpose:
//		The purpose of this function is to check whether a given number lies within a given  
//		numeric range, returning a true or false value.
//      
// Variables required:
//		chkNumber   = string for comparison 
//		low			= integer value for minimum limit
//		high        = integer value for minimum limit
//
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function checkNumericRange(chkNumber,low,high){
	if ((chkNumber >= low) && (chkNumber <= high)){
		return true;
	} else {
		return false;
	}
}

///- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// checkNumericRange Function End -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
// checkLeapYear Function 
// =============================================
// Author: 
//		Ed McLaughlin
//
// Purpose:
//		The purpose of this function is to check whether or not a a given year is a leap year.
//		The function is based on the fact that a year which is exactly divisble by four 
//		is a leap year. The exception to the rule is the first year of a century, 
//		or last year, depending on how you look at it. In that case if the year is exactly 
//		divisible by 400 it is also a leap year. So 2000 is a leap year, but 1900 wasn't.
//
// Variables required:
//		year   = year to be checked for leap year status
//
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function checkLeapYear(year){
	if (year%4 == 0){
		if(year%100 == 0) {		//century
			if(year%400 == 0) {
				return true;
			} else {
				return false;
			}
		}
		return true;
	} else {
		return false;
	}
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// checkLeapYear Function End -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
// checkDate Function 
// =============================================
// Author: 
//		Ed McLaughlin
//
// Purpose:
//		 Checks that fields entered for a particular date are valid in terms of the number of 
//		 days in a paritular month
//
// Variables required:
//		
//		 month			= the month portion of the date to be validated
//		 day			= the day portion of the date to be validated
//		 year			= the year portion of the date to be validated
//		 descriptioin	= name that describes the field for the date
//
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function checkDate(month, day, year, description){

   if(month.length == 1){
	   month="0" + month;
	 }


	switch(month) 
	{
		case '04':

			if (!checkNumericRange(day,1,30)){ 
				alert('The day part of ' + description + ' must be between 1 and 30.\n30 days in April') 
				return false; 
			}break;
		case '06':

			if (!checkNumericRange(day,1,30)){ 
				alert('The day part of ' + description + ' must be between 1 and 30.\n30 days in June') 
				return false; 
			}break;
			
		case '09':
	
			if (!checkNumericRange(day,1,30)){ 
				alert('The day part of ' + description + ' must be between 1 and 30.\n30 days in September') 
				return false; 
			}break;

		case '11':

			if (!checkNumericRange(day,1,30)){ 
				alert('The day part of ' + description + ' must be between 1 and 30.\n30 days in November') 
				return false; 
			}break;
		case '02':

			if (!checkNumericRange(day,1,29))
			    { 
				alert('The day part of ' + description + ' must be between 1 and 28.\n28 days in February (29 in a leap year).') 
				return false; 
				}
				
				
			if (day == '29') 
			    { 
				if (!checkLeapYear(year))
				    { 
					alert(year + ' is not a leap year.\n Febraury 29 is only valid in a leap year.') 
					return false; 
  				    }
			    }
     }
return(true);
}

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// checkLeapYear Function End -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
// Browser Time, Date and Date/Time Functions 
// =============================================
// Author: 
//		Stephen Rojas
//
// Purpose:
//		Functions write to the screen date or time or both combined from the browser, not the server i.e.
//		the user's local time
//      
// Variables required:
//
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function browserTime(){
	var minsArr=new Array(10);
	minsArr[0]="00";
	minsArr[1]="01";
	minsArr[2]="02";
	minsArr[3]="03";
	minsArr[4]="04";
	minsArr[5]="05";
	minsArr[6]="06";
	minsArr[7]="07";
	minsArr[8]="08";
	minsArr[9]="09";
	var time=new Date();
	var hour=time.getHours();
	var mins=time.getMinutes();
	var lmins
	if (mins < 10){
		lmins = minsArr[mins]
		mins = lmins
	}
	if (hour > 12){
		hour = hour-12;
		document.write(" " + hour + ":" + mins + " pm");
	}
	else{
		document.write(" " + hour + ":" + mins + " am");
	}
}

function browserDate(){
	var monthsArr=new Array(13);
	monthsArr[1]="January";
	monthsArr[2]="February";
	monthsArr[3]="March";
	monthsArr[4]="April";
	monthsArr[5]="May";
	monthsArr[6]="June";
	monthsArr[7]="July";
	monthsArr[8]="August";
	monthsArr[9]="September";
	monthsArr[10]="October";
	monthsArr[11]="November";
	monthsArr[12]="December";
	var time=new Date();
	var lmonth=monthsArr[time.getMonth() + 1];
	var date=time.getDate();
	var year=time.getYear();
	if (year<1900) year=1900 + time.getYear();
	else year=time.getYear();
	document.write(lmonth + " ");
	document.write(date + ", " + year);
}

function browserDay(){
	var dayArr=new Array(7);
	dayArr[0]="Sunday";
	dayArr[1]="Monday";
	dayArr[2]="Tuesday";
	dayArr[3]="Wednesday";
	dayArr[4]="Thursday";
	dayArr[5]="Friday";
	dayArr[6]="Saturday";

	var time=new Date();
	var day=time.getDay();
	var lday
	lday = dayArr[day]
	document.write(" " + lday);
}

function browserDateTime(){
browserDate()
browserTime()
}

function browserDayDateTime(){
browserDay()
document.write(", ")
browserDate()
browserTime()
}

function browserDayDate(){
browserDay()
document.write(", ")
browserDate()
}

function monthStringToInt(strMonth){
	var intMonth;
	var strUMonth;
	
	strUMonth = strMonth.toUpperCase()

	switch(strUMonth){
		
		case 'JANUARY':
			intMonth = 1;
		break;	
		case 'FEBRUARY':
			intMonth = 2;		
		break;
		case 'MARCH':
			intMonth = 3;		
		break;
		case 'APRIL':
			intMonth = 4;		
		break;
		case 'MAY':
			intMonth = 5;		
		break;
		case 'JUNE':
			intMonth = 6;		
		break;
		case 'JULY':
			intMonth = 7;		
		break;
		case 'AUGUST':
			intMonth = 8;		
		break;
		case 'SEPTEMBER':
			intMonth = 9;		
		break;
		case 'OCTOBER':
			intMonth = 10;		
		break;
		case 'NOVEMBER':
			intMonth = 11;		
		break;
		case 'DECEMBER':
			intMonth = 12;			
		break;
     }	
	
	return intMonth
}

function monthIntToString(intMonth){
	var strMonth
	var intTransMonth
	
	intTransMonth = ParseInt(intMonth)
	
	switch(intMonth){
		
		case 1:
			strMonth = 'January';
		break;
		case 2:
			strMonth = 'Febraury';		
		break;
		case 3:
			strMonth = 'March';		
		break;
		case 4:
			strMonth = 'April';		
		break;
		case 5:
			strMonth = 'May';		
		break;
		case 6:
			strMonth = 'June';	
		break;
		case 7:
			strMonth = 'July';		
		break;
		case 8:
			strMonth = 'August';
		break;
		case 9:
			strMonth = 'September';
		break;
		case 10:
			strMonth = 'October';
		break;
		case 11:
			strMonth = 'November';
		break;
		case 12:
			strMonth = 'December';
		break;
     }	
	
	return strMonth
}

function getDayOfWeekByDateParts(strMonth, strDay, strYear, blnAbbreviate){ 

	var days= new Array(7);
	
	if (blnAbbreviate == true){
		days[0]="Sun"; 	days[1]="Mon"; days[2]="Tue";
		days[3]="Wed"; 	days[4]="Thu"; days[5]="Fri";
		days[6]="Sat";
	}else{
		days[0]="Sunday"; 	 days[1]="Monday"; 	 days[2]="Tuesday";
		days[3]="Wednesday"; days[4]="Thursday"; days[5]="Friday";
		days[6]="Saturday";
	}
	
	var dteDate    = new Date(strYear, parseInt(strMonth) - 1, strDay, 00, 00, 00);
	var dteDayName = dteDate.getDay();
	
	return days[dteDayName];
}   

function getDayOfWeekByDate(strDate, blnAbbreviate){ 

	var arrayDate = strDate.split('/');
	var strMonth  = arrayDate[0];
	var strDay	  = arrayDate[1];
	var strYear	  = arrayDate[2];

	var days= new Array(7);
	
	if (blnAbbreviate == true){
		days[0]="Sun"; 	days[1]="Mon"; days[2]="Tue";
		days[3]="Wed"; 	days[4]="Thu"; days[5]="Fri";
		days[6]="Sat";
	}else{
		days[0]="Sunday"; 	 days[1]="Monday"; 	 days[2]="Tuesday";
		days[3]="Wednesday"; days[4]="Thursday"; days[5]="Friday";
		days[6]="Saturday";
	}
	
	var dteDate    = new Date(strYear, parseInt(strMonth) - 1, strDay, 00, 00, 00);
	var dteDayName = dteDate.getDay();
	
	return days[dteDayName];
}   



///- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Date, Time and Date/Time Functions End -
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DESCRIPTION: 
	ALTERNATE BACKGROUND STYLE FOR MULTIPLE SELECT
  
PARAMETERS:
	objSelectList.....MULTIPLE LIST OBJECT
   
RETURNS:
	ALTERNATING BACKGROUD STYLES FOR MULTIPLE SELECT LIST
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
	// Apply alternating option backgrounds
	function alternateStyle(objSelectList){ 
		for(var i=0; i<objSelectList.options.length; i++){ 
			if((objSelectList.options[i]) && (i % 2 == 0)) {
				objSelectList.options[i].style.backgroundColor = 'whitesmoke';				
			}else{
				objSelectList.options[i].style.backgroundColor = 'white';
			}
		}
	}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DESCRIPTION: 
	CONTROLS MULTIPLE LEFT RIGHT SELECT LIST
  
PARAMETERS:
	objSrcList.....OBJECT WITH LIST OF VALUES TO BE MOVED
	objDestList....OBJECT TO RECEIVE SELECTED LIST OF VALUES
	blnMoveAll.....IF TRUE ALL VALUES IN objSrcList WILL BE MOVED TO blnMoveAll
   
RETURNS:
	SELECTED LIST OF ITEMS MOVED TO OPPOSITE SELECT LIST 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
	function moveLRSelect(objSrcList, objDestList, blnMoveAll){
		// Do nothing if nothing is selected
		if ((objSrcList.selectedIndex == -1) && (blnMoveAll == false)){return;}
		  
		var newDestList		 = new Array(objDestList.options.length);
		var newDestListText  = new Array(objDestList.options.length);
		var newDestListValue = new Array(objDestList.options.length);
		
		var len = 0;
		for(len=0; len<objDestList.options.length; len++){
			if (objDestList.options[len] != null){
				newDestListText[len]  = objDestList.options[len].text;
				newDestListValue[len] = objDestList.options[len].value;
			}
		}
	
		for(var i=0; i<objSrcList.options.length; i++){ 
			if (objSrcList.options[i] != null && (objSrcList.options[i].selected == true || blnMoveAll)){
				// Statements to perform if option is selected
				// Incorporate into new list
				newDestListText[len]  = objSrcList.options[i].text;
				newDestListValue[len] = objSrcList.options[i].value;
				len++;
			} 
		}
		
		// Sort out the new destination lists
		var i, j;
		for (i = newDestListText.length - 1; i >= 0; i--){
			for (j = 0; j <= i; j++){
				if (newDestListText[j+1] < newDestListText[j]){
					var temp  = newDestListText[j];
					var temp2 = newDestListValue[j];
					newDestListText[j]  = newDestListText[j+1];
					newDestListValue[j] = newDestListValue[j+1];
					newDestListText[j+1]  = temp;
					newDestListValue[j+1] = temp2;
				}
			}
		}
		
		// CREATE DESTINATION LIST OPTIONS
		for (var j=0; j<newDestListText.length; j++){
			if(newDestListText[j] != null){
				newDestList[j] = new Option(newDestListText[j], newDestListValue[j]);
			}
		}
	
		// Populate the destination with the items from the new array
		for (var j=0; j<newDestList.length; j++){
			if(newDestList[j] != null){
				objDestList.options[j] = newDestList[j];
			}
		}
	
		// Erase source list selected elements
		for(i=objSrcList.options.length-1; i>=0; i--){ 
			if(objSrcList.options[i] != null && (objSrcList.options[i].selected == true || blnMoveAll)){
			   // Erase Source
			   objSrcList.options[i].value = "";
			   objSrcList.options[i].text  = "";
			   objSrcList.options[i]       = null;
			}
		}
		
	}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DESCRIPTION: 
  
PARAMETERS:
   
RETURNS:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function validateNumbers(objFormControl, strFieldName, blnIsRequired, intMinLen, intMaxLen, intReqLen, strType){

	var strNumbers = "1234567890";
	var strValidChars = strNumbers;
	
	var strMsg = "Some of the characters you entered are not valid characters.\nValid characters are any of the following:\n\n";		
	strMsg += "0-9\n\n";
	strMsg += "Please re-enter the " + strFieldName + ".";
			
	return validateField(objFormControl, strFieldName, blnIsRequired, strValidChars, strMsg, intMinLen, intMaxLen, intReqLen);
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DESCRIPTION: 
  
PARAMETERS:
   
RETURNS:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function validateSymbolsLettersAndSpaces(objFormControl, strFieldName, blnIsRequired, intMinLen, intMaxLen, intReqLen, strType){

	var strLetters	= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var strSpecialChars = "()-', ";

	var strValidChars = strLetters + strSpecialChars;
	var strMsg = "Some of the characters you entered are not valid characters.\nValid characters are any of the following:\n\n";		
	strMsg += "a-z, A-Z, spaces and the following special characters: \n\n" + strSpecialChars + "\n\n";
	strMsg += "Please re-enter the " + strFieldName + ".";

	return validateField(objFormControl, strFieldName, blnIsRequired, strValidChars, strMsg, intMinLen, intMaxLen, intReqLen);
}	

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DESCRIPTION: 
  
PARAMETERS:
   
RETURNS:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function validateSymbolsAndNumbers(objFormControl, strFieldName, blnIsRequired, intMinLen, intMaxLen, intReqLen, strType){

	var strNumbers	= "1234567890";
	
	var strValidChars = strNumbers 
	var strMsg = "Some of the characters you entered are not valid characters.\nValid characters are any of the following:\n\n";
	strMsg += "0-9, spaces and the following special characters: \n\n";

	switch (strType.toLowerCase()) {
		
		case 'phone' :
		
			var strSpecialChars = "()- ";
			strValidChars += strSpecialChars;
			strMsg += strSpecialChars + "\n\nPlease re-enter the " + strFieldName + ".";	
			break;
	}

	return validateField(objFormControl, strFieldName, blnIsRequired, strValidChars, strMsg, intMinLen, intMaxLen, intReqLen);
}	

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DESCRIPTION: 
  
PARAMETERS:
   
RETURNS:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function validateAlphaNumericSymbols(objFormControl, strFieldName, blnIsRequired, intMinLen, intMaxLen, intReqLen, strType){

	var strNumbers	= "1234567890";
	var strLetters	= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	
	var strValidChars = strLetters + strNumbers 
	var strMsg = "Some of the characters you entered are not valid characters.\nValid characters are any of the following:\n\n";
	strMsg += "a-z, A-Z, 0-9 and the following special characters: \n\n";

	switch (strType.toLowerCase()) {
		
		case 'email' :
		
			var strSpecialChars = "_.@";
			strValidChars += strSpecialChars;
			strMsg += strSpecialChars + "\n\nPlease re-enter the " + strFieldName + ".";
	
			break;
		
		case 'phone' :
		
			var strSpecialChars = "()-xX";
			strValidChars += strSpecialChars;
			strMsg += strSpecialChars + "\n\nPlease re-enter the " + strFieldName + ".";
	
			break;
	}

	return validateField(objFormControl, strFieldName, blnIsRequired, strValidChars, strMsg, intMinLen, intMaxLen, intReqLen);
}	

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DESCRIPTION: 
  
PARAMETERS:
   
RETURNS:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function validateAlphaNumericSymbolsSpaces(objFormControl, strFieldName, blnIsRequired, intMinLen, intMaxLen, intReqLen, strType){

	var strNumbers	  = "1234567890";
	var strLetters    = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";	
	var strValidChars = strLetters + strNumbers 
	
	var strMsg = "Some of the characters you entered are not valid characters.\nValid characters are any of the following:\n\n";
	strMsg += "a-z, A-Z, 0-9, spaces and the following special characters: \n\n";
	
	switch (strType.toLowerCase()) {
		
		case 'name' :
		
			var strSpecialChars = "()-', ";
			strValidChars += strSpecialChars;
			strMsg += strSpecialChars + "\n\nPlease re-enter the " + strFieldName + ".";
	
			break;
		
		
		case 'address' :
		
			var strSpecialChars = "/\\()-',#&.@ ";
			strValidChars += strSpecialChars;
			strMsg += strSpecialChars + "\n\nPlease re-enter the " + strFieldName + ".";
	
			break;
		
		case 'phone' :
		
			var strSpecialChars = "()-xX ";
			strValidChars += strSpecialChars;
			strMsg += strSpecialChars + "\n\nPlease re-enter the " + strFieldName + ".";
	
			break;
		
		case 'allsymbols' :
			
			var strSpecialChars = " ~`!@#$%^&*()-_+={}[]|\"':;<>,.?/\n"
			strValidChars += strSpecialChars;
			strMsg += strSpecialChars + "\n\nPlease re-enter the " + strFieldName + ".";
	
			break;
				
		default :
			
			strValidChars = '';
			strMsg += strSpecialChars + "\n\nPlease re-enter the " + strFieldName + ".";
	
			break;	
	}
	return validateField(objFormControl, strFieldName, blnIsRequired, strValidChars, strMsg, intMinLen, intMaxLen, intReqLen);
}	

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DESCRIPTION: 
  
PARAMETERS:
   
RETURNS:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function validateDropDown(objFormControl, strFieldName, blnIsRequired, strType){

	var strMinMsg = strFieldName + " is a required field. Please select an option.";

	if (blnIsRequired == true){
		if (objFormControl.options[objFormControl.selectedIndex].value.length == 0){
			alert (strMinMsg);
			return false;
		}
	}
	return true;	
}	

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DESCRIPTION: 
  
PARAMETERS:
   
RETURNS:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function validateField(objFormControl, strFieldName, blnIsRequired, strValidChars, strMsg, intMinLen, intMaxLen, intReqLen){
	
	var strReqMsg = "The " + strFieldName + " is a required field in this form.";
	
	var strReqLenMsg = "The required length of " + strFieldName + " is " + intReqLen + " character(s). ";
	strReqLenMsg += "The " + strFieldName + " you entered is " + parseInt(objFormControl.value.length) + " character(s).\n\n";
	strReqLenMsg += "Please edit your " + strFieldName + " to make it the appropiate length.";
	
	var strMinMsg = "The minimum length of " + strFieldName + " is " + intMinLen + " character(s). ";
	strMinMsg += "The " + strFieldName + " you entered is " + parseInt(parseInt(intMinLen) - objFormControl.value.length) + " character(s) too short.\n\n";
	strMinMsg += "Please edit your " + strFieldName + " to make it the appropiate length.";
	
	var strMaxMsg = "The maximum length of " + strFieldName + " is " + intMaxLen + " character(s). ";
	strMaxMsg += "The " + strFieldName + " you entered is " + parseInt(objFormControl.value.length - parseInt(intMaxLen)) + " character(s) too long.\n\n";
	strMaxMsg += "Please edit your " + strFieldName + " to make it the appropiate length.";
	
	if ((blnIsRequired == false) && (Trim(objFormControl.value) == '')) { return true; }

	if (blnIsRequired == true){
		if (Trim(objFormControl.value) == '') {alert(strReqMsg); return false;}
	}

	if (parseInt(intMinLen) > 0){
		if (objFormControl.value.length < intMinLen) {alert(strMinMsg); return false;}
	}
	
	if (parseInt(intMaxLen) > 0){
		if (objFormControl.value.length > intMaxLen) {alert(strMaxMsg); return false;}
	}

	if (parseInt(intReqLen) > 0){
		if (objFormControl.value.length != intReqLen) {alert(strReqLenMsg); return false;}
	}	
	
	if (Trim(strValidChars) != '' ){
		if (!(validateFieldChars(strValidChars, objFormControl, strMsg))){return false;}	
	}
	return true;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
DESCRIPTION: 
  
PARAMETERS:
   
RETURNS:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
function validateFieldChars(strValidString, objFormControl, strFailMessage) {
 
    var allValid = true;

  	for ( var i = 0;  i < objFormControl.value.length;  i++ ) {
    	var strChar = objFormControl.value.charAt(i);		
		for ( var j = 0;  j < strValidString.length;  j++ ) {      
	  		if ( strChar == strValidString.charAt(j) ) {
				break;
      		}			
			if ( j == (strValidString.length - 1 ) ) {
        		allValid = false;
        		break;
			}
		}
	}	
	if ( !allValid ) {
		alert( strFailMessage );
		objFormControl.focus();
		return false ;
	}
    return true;
}	
	
	
function checkStringIfNumber(strString){
	
	var strAllowedChars	= "1234567890"
	var allValid = true;

	for (var i = 0;i < strString.length;i++ ){
		ch = strString.charAt(i);

		for (var j = 0;j < strAllowedChars.length;j++){
			if(ch == strAllowedChars.charAt(j)){
				break;
			}
			
			if(j == (strAllowedChars.length - 1)){				
				allValid = false;
				break;
			}
		}	
	}
		
	if(!allValid){
		return(false);
	}else{
		return(true);
	}
	
}


