/////////////GLOBAL MISC METHODS///////////////////////////////////////
			function setDays(month, year, daysList){
				
				var objDate = new Date();
				
				if(month==''){
					month = objDate.getMonth;
				}
				if(year==''){
					month = objDate.getYear;
				}
				
				if(month==1){
					updateDaysList(daysList, 31);
				}
				else if(month==2){
					if(isLeapYear(year)){
						updateDaysList(daysList, 28);
					}
					else{
						updateDaysList(daysList, 29);
					}
				}
				else if(month==3){
					updateDaysList(daysList, 31);
				}
				else if(month==4){
					updateDaysList(daysList, 30);
				}
				else if(month==5){
					updateDaysList(daysList, 31);
				}
				else if(month==6){
					updateDaysList(daysList, 30);
				}
				else if(month==7){
					updateDaysList(daysList, 31);
				}
				else if(month==8){
					updateDaysList(daysList, 31);
				}
				else if(month==9){
					updateDaysList(daysList, 30);
				}
				else if(month==10){
					updateDaysList(daysList, 31);
				}
				else if(month==11){
					updateDaysList(daysList, 30);
				}
				else if(month==12){
					updateDaysList(daysList, 31);
				}
				
			}
			
			function isLeapYear(year)
			{
				if(((year % 4)==0) && ((year % 100)!=0) || ((year % 400) == 0))
					return (true);
				else
					return (false);
			}

			function updateDaysList(daysList, days){

				var i;
				var oOption;
				var oSelect = getEl(daysList);
				var listLength = oSelect.options.length;
				var hasBlank = false;
				var hasDD = false;
				var selectedIndex = oSelect.selectedIndex;
				
				for (i=0; i < listLength; i++){
					if (oSelect.options[0].text == ''){
						hasBlank = true;
					}
					else if (oSelect.options[0].text == 'DD'){
						hasDD = true;
					}

					oSelect.options.remove(0);
				}
				
				if (hasBlank){
					oOption = document.createElement("OPTION");
					oOption.text = '';
					oOption.value = '';
					oSelect.options.add(oOption);
				}
				else if (hasDD){
					oOption = document.createElement("OPTION");
					oOption.text = 'DD';
					oOption.value = '';
					oSelect.options.add(oOption);
				}
				
				for (i = 1; i < (days+1); i++) {
					oOption = document.createElement("OPTION");
					oOption.text = i;
					oOption.value = i;
					oSelect.options.add(oOption);
				}
				
				if (selectedIndex > (oSelect.length - 1)){
					oSelect.selectedIndex = 0;
				}
				else{
					oSelect.selectedIndex = selectedIndex;
				}
			
			}
			
			function toggleAll(frm){	
				for (var i=0;i<frm.elements.length;i++)
				{
					var e = frm.elements[i];
					if ((e.name != 'chkSelectAll') && (e.type=='checkbox'))
					{
						e.checked = frm.chkSelectAll.checked;
						if (e.onclick) e.onclick();
					}
				}
			}	
			
			function anySelected(frm){		
				for (var i=0;i<frm.elements.length;i++)
				{
					var e = frm.elements[i];
					if ((e.name != 'chkSelectAll') && (e.type=='checkbox'))
					{
						if(e.checked){
							return true;
						}
					}
				}
			}		
			
			function replaceSubstring(inputString, fromString, toString) {
			
				// Goes through the inputString and replaces every occurrence of fromString with toString
				var temp = inputString;
				if (fromString == "") {
					return inputString;
				}
				if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation)
					while (temp.indexOf(fromString) != -1) {
						var toTheLeft = temp.substring(0, temp.indexOf(fromString));
						var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
						temp = toTheLeft + toString + toTheRight;
					}
				} else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop
					var midStrings = new Array("~", "`", "_", "^", "#");
					var midStringLen = 1;
					var midString = "";
					// Find a string that doesn't exist in the inputString to be used
					// as an "inbetween" string
					while (midString == "") {
						for (var i=0; i < midStrings.length; i++) {
							var tempMidString = "";
							for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
							if (fromString.indexOf(tempMidString) == -1) {
							midString = tempMidString;
							i = midStrings.length + 1;
							}
						}
					} // Keep on going until we build an "inbetween" string that doesn't exist
					// Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string
					while (temp.indexOf(fromString) != -1) {
						var toTheLeft = temp.substring(0, temp.indexOf(fromString));
						var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
						temp = toTheLeft + midString + toTheRight;
					}
					// Next, replace the "inbetween" string with the "toString"
					while (temp.indexOf(midString) != -1) {
						var toTheLeft = temp.substring(0, temp.indexOf(midString));
						var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
						temp = toTheLeft + toString + toTheRight;
					}
				} // Ends the check to see if the string being replaced is part of the replacement string or not
				return temp; // Send the updated string back to the user
				
			}

			function encodeHtml(value) {

				value = value.replace(/&/g,'&amp;');
				value = value.replace(/"/g,'&quot;');
				value = value.replace(/</g,'&lt;');
				value = value.replace(/>/g,'&gt;');
				value = value.replace(/\n/g,'<br>');
				return value;
				
			} 

			function checkMaxLength(fld,size){
				if (fld.value.length >= size){
					fld.value = fld.value.substr(0,size-1);
				}
			}

			function getEl(id){
				return document.getElementById(id);
			}

			function getListValue(fldName){
				return getEl(fldName).options[getEl(fldName).selectedIndex].value;
			}
							
			function openHelp(Page){
				window.open('help/default.aspx?page=' + Page, '_blank', 'Height=650px, Width=600px, center=1, help=1, resizable=1, status=0, scrollbars=1');
			}
	
/////////////END GLOBAL MISC METHODS///////////////////////////////////