function isValidString(string) {
    var notallowed = "@'!~#$%^&*()/\\:?;<>|";
    for (var i=0; i< string.length; i++) {
       if (notallowed.indexOf(string.charAt(i)) != -1)
          return false;
    }
    return true;
}

function isValidSubsectionName(string) {    
    var notallowed = '"\\';
    for (var i=0; i< string.length; i++) {
       if (notallowed.indexOf(string.charAt(i)) != -1)
          return false;
    }
    return true;
}

function stripSpaces(x) {
    while (x.substring(0,1) == ' ') x = x.substring(1);
    while (x.substring(x.length-1,x.length) == ' ') x = x.substring(0,x.length-1);
    return x;
}

function checkCharacter(srcString, subString) {
    var srcLength = srcString.length;
    var subLength = subString.length;
  
    if ((srcLength == 0) || (subLength == 0)) {
        return false; 
    }
    var i = srcString.indexOf(subString);
    if (i == -1) {
        return false;
    }
    return true;
}



function validateSurveyVote() {
   var noOfBoxes = document.Survey.survey.length;
   var flag      = false;
 
   for (i = 0; i < noOfBoxes; i++ ) {
      if (document.Survey.survey[i].checked) {
          flag = true;
          break;
      }
   }
   if (!flag) {
       alert("Please select one of the answers.");
       return;
   } 
   document.Survey.submit();
}

function showResults() {                       
	var noOfBoxes = document.PopUpSurvey.survey.length;
  var flag      = false;
  
  for (i  = 0; i < noOfBoxes; i++ ) {
      if (document.PopUpSurvey.survey[i].checked) {
          flag = true;
          break;
      }
   }

   if (!flag) {
         alert("Please select one of the answers.");
         return;
   } 
                      
   str= document.PopUpSurvey.documentPath.value+'/popresult.jsp?SubscriberId=' + document.PopUpSurvey.subscriberId.value + '&SurveyAndAnswer=' + document.PopUpSurvey.surveyId.value + '-' + document.PopUpSurvey.answerValueId.value;
   windowFeatures = 'status=yes,screenY=80,top=80,resizable=yes,scrollbars=yes,height='+document.PopUpSurvey.height.value+',width='+document.PopUpSurvey.width.value;
   window.open(str,'SurveyResult'+document.PopUpSurvey.surveyId.value,windowFeatures);
   self.close();
}

function setAnswer(theAnswer) {	
	document.PopUpSurvey.answerValueId.value=theAnswer;			
}


function submitAdminForm() {
	if (document.AdminForm.EmailAddr.value == '') {
		alert("Please enter a valid email address.");
		return;
  }
	document.AdminForm.submit();
}
    
	function verifyInputNewsletter ()  {
		
		var returnflag = true;
		document.navigationForm.existingMediaFile.value = removeWhitespace(document.navigationForm.existingMediaFile.value);
		indexselected=document.navigationForm.vacCategory.selectedIndex;
		catselected=document.navigationForm.vacCategory.options[indexselected].text;
		
		firstimageindex=document.navigationForm.location1.selectedIndex;
		firstimageselected=document.navigationForm.location1.options[firstimageindex].text;
		
		secondimageindex=document.navigationForm.location2.selectedIndex;
		secondimageselected=document.navigationForm.location2.options[secondimageindex].text;

		thirdimageindex=document.navigationForm.location3.selectedIndex;
		thirdimageselected=document.navigationForm.location3.options[thirdimageindex].text;

                document.navigationForm.title.value    = stripSpaces(document.navigationForm.title.value);
                document.navigationForm.keywords.value = stripSpaces(document.navigationForm.keywords.value);



		
		if ((document.navigationForm.action.value == 'Add' || document.navigationForm.action.value == 'Update' || 
			document.navigationForm.action.value == 'Delete') && catselected=='Select Category') {
			alert("Please select a category.");
			document.navigationForm.vacCategory.focus();
			returnflag = false;
		}
		else
		if (document.navigationForm.title.value.length==0) {
			alert("Please enter a title.");
			document.navigationForm.title.focus();
			returnflag = false;
		}
                else 
                if (checkCharacter(document.navigationForm.title.value, '"')) {
                        alert("Please enter a valid title. (Double quotes are not allowed)");
                        document.navigationForm.title.focus();
                        returnflag = false; 
                }
		else
			if (document.navigationForm.author.value.length==0) {
				alert("Please enter an author/source name.");
				document.navigationForm.author.focus();
				returnflag = false;
			}		
			else
				if (document.navigationForm.publishDate.value.length==0) {
					alert("Please enter a publish date.");
					document.navigationForm.publishDate.focus();
					returnflag = false;
				}	
			else
				if (!isValidDate(document.navigationForm.publishDate.value)) {
					alert("Please enter a valid publish date.");
					document.navigationForm.publishDate.focus();
					returnflag = false;
				}
			else
				if (!isValidDate(document.navigationForm.startDate.value)) {
					alert("Please enter a valid start date.");
					document.navigationForm.startDate.focus();
					returnflag = false;
				}
			else
				if (!isValidDate(document.navigationForm.endDate.value)) {
					alert("Please enter a valid end date.");
					document.navigationForm.endDate.focus();
					returnflag = false;
				}
			else
				if (document.navigationForm.keywords.value.length==0) {
					alert("Please enter a keyword.");
					document.navigationForm.keywords.focus();
					returnflag = false;
				}		
				else
                                if (checkCharacter(document.navigationForm.keywords.value, '"')) {
                                       alert("Please enter a valid keyword. (Double quotes are not allowed)");
                                       document.navigationForm.keywords.focus();
                                       returnflag = false
                                }
                                else
	
					if (document.navigationForm.teaser.value.length==0) {
						alert("Please enter an article teaser.");
						document.navigationForm.teaser.focus();
						returnflag = false;
					}
					else
					if (document.navigationForm.synopsis.value.length==0) {
						alert("Please enter an article synopsis.");
						document.navigationForm.synopsis.focus();
						returnflag = false;
						}
					
						else
							if (document.navigationForm.body.value.length==0) {
								alert("Please enter an article body.");
								document.navigationForm.body.focus();
								returnflag = false;
							}
							else 	if (document.navigationForm.authorPublicEmail.value.length!=0 && !(emailCheckNewsletter(document.navigationForm.authorPublicEmail))) {
											document.navigationForm.authorPublicEmail.focus();
											returnflag = false;
										}
								else if (document.navigationForm.authorEmail.value.length!=0 && returnflag && !(emailCheckNewsletter(document.navigationForm.authorEmail))) {
											document.navigationForm.authorEmail.focus();
											returnflag = false;
										}
								
									
                if (returnflag) {
                    if (document.navigationForm.action.value == 'Add') {
                        document.navigationForm.title.value = prepareForDB(document.navigationForm.title.value);
                    }
                }

		return returnflag;
	}	
			
function emailCheckNewsletter(emailAddress) {
	var returnFlag = true;
	if (emailAddress.value.indexOf("@")<1) {
		alert("This email address seems wrong. \nPlease check the prefix and '@' sign.");
		returnFlag = false;
	}
	else
		if ((emailAddress.value.indexOf(".com")<5)&&(emailAddress.value.indexOf(".org")<5)&&(emailAddress.value.indexOf(".gov")<5)&&(emailAddress.value.indexOf(".net")<5)&&(emailAddress.value.indexOf(".mil")<5)&&(emailAddress.value.indexOf(".edu")<5)){
			alert("This email address seems wrong. \nPlease check the suffix for accuracy. \n(It should include a .com, .edu, .net, .org, .gov or .mil)");
			returnFlag = false;
		}
	return returnFlag;
}

function changeSection(theSectionId,clickedButton) {
	document.navigationForm.sectionId.value = theSectionId;
	document.navigationForm.action.value = "section";
	document.navigationForm.submit();			
}

function changeArticlesNewsletter(theArticleId,clickedButton) {
	if(theArticleId!="none"){
		document.navigationForm.articleId.value = theArticleId;
		document.navigationForm.action.value = "article";
		document.navigationForm.submit();
	}			
}	

function buttonTypeNewsletter(clickedButton) {		
	document.navigationForm.action.value = clickedButton;		
	if(clickedButton=="Delete"){
		if (confirm("Are you sure you want to delete this article?"))	 {	
			document.navigationForm.submit();
		}
	}
	else {
		if(verifyInputNewsletter()){
			document.navigationForm.submit();
		}
		else
			return;
	}
}

function PrintArticleNewsletter() {
  window.open(document.navigationForm.documentPath.value+'/printarticle.jsp?ArticleId='+
              document.navigationForm.articleId.value,"","menubar=yes,resizable=yes,width=450,height=450,titlebar=yes,toolbar=yes,scrollbars=yes");
}

function populate(numberPara, f){
	for (var i = 0; i < numberPara; i++) {
		eval("document.navigationForm.location1.options[i] = new Option(i+1)");
		if (numberPara > 1) {
			eval("document.navigationForm.location2.options[i] = new Option(i+1)");
			eval("document.navigationForm.location3.options[i] = new Option(i+1)");
		}
	}
	document.navigationForm.articleImage1.focus();
}

function findNumberOfPara(StrObj, f) {
	var numberPara = 0;
	var para = StrObj.match(/<P>/gi);
	var newlines = StrObj.match(/\n/gi);
	if (para) {
		for (var i = 0; i < para.length; i++) {
			numberPara++;
    }
	}
	/*if (newlines) {
		for (var i = 0; i < newlines.length; i++) {
			numberPara++;
    }
	}*/
	firstimageselected=document.navigationForm.location1.options.selectedIndex;
	if (firstimageselected > numberPara)
		firstimageselected = 0;
	secondimageselected=document.navigationForm.location2.options.selectedIndex;
	if (secondimageselected > numberPara)
		secondimageselected = 0;
	thirdimageselected=document.navigationForm.location3.options.selectedIndex;
	if (thirdimageselected > numberPara)
		thirdimageselected = 0;
	
	populate(numberPara,f);
	restoreImageSelections(firstimageselected,secondimageselected,thirdimageselected);
	
	return numberPara;
}

function restoreImageSelections(firstimageselected,secondimageselected,thirdimageselected) {

	document.navigationForm.location1.options.selectedIndex = firstimageselected;
	document.navigationForm.location2.options.selectedIndex = secondimageselected;
	document.navigationForm.location3.options.selectedIndex = thirdimageselected;
}

function isValidDate(dateStr) { 
	// Checks for the following valid date formats: 
	// MM/DD/YY MM/DD/YYYY MM-DD-YY MM-DD-YYYY 
	// Also separates date into month, day, and year variables 
	
	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/; 
	
	// To require a 4 digit year entry, use this line instead: 
	// var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/; 
	
	var matchArray = dateStr.match(datePat); // is the format ok? 
	if (matchArray == null) { 
		return false; 
	} 
	month = matchArray[1]; // parse date into variables 
	day = matchArray[3]; 
	year = matchArray[4]; 
	if (month < 1 || month > 12) { // check month range 
		return false; 
	} 
	if (day < 1 || day > 31) {
		return false; 
	} 
	if ((month==4 || month==6 || month==9 || month==11) && day==31) {
		return false 
	} 
	if (month == 2) { // check for february 29th 
		var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); 
		if (day>29 || (day==29 && !isleap)) { 
			return false; 
		} 
	} 
	return true; // date is valid 
} 

function submitButton(theClickedButton) {		
		document.access_admin_form.action.value = theClickedButton;	


		var indexselected=document.access_admin_form.administrator.selectedIndex;
		var catselected=document.access_admin_form.administrator.options[indexselected].value;
		//	alert(indexselected);

		if(theClickedButton=="Update"){
			if(catselected==0){
					alert("Please select Administrator.");
				return;
				}
			else {
				returnflag=verifyInputAccessAdministration();
				if(returnflag)
					document.access_admin_form.submit();

			}

		

		}
		else 
		if(theClickedButton=="Delete")	{

				if(catselected==0){
					alert("Please select Administrator.");
					return;
				}
				else
					document.access_admin_form.submit();


		}
		else
		if(theClickedButton=="Add")		{
			if(catselected==0){
					returnflag=verifyInputAccessAdministration();
			if(returnflag)
					document.access_admin_form.submit();
			}
			else return;
		}
}



function verifyInputAccessAdministration ()  {
		var returnflag = true;		

               document.access_admin_form.firstname.value = stripSpaces(document.access_admin_form.firstname.value);
               document.access_admin_form.lastname.value = stripSpaces(document.access_admin_form.lastname.value);
               document.access_admin_form.username.value = stripSpaces(document.access_admin_form.username.value);
               document.access_admin_form.password.value = stripSpaces(document.access_admin_form.password.value);

		if (document.access_admin_form.firstname.value.length==0) {
			alert("Please enter a first name.");
			document.access_admin_form.firstname.focus();
			returnflag = false;
		}
		else
			if (document.access_admin_form.lastname.value.length==0) {
				alert("Please enter a last name.");
				document.access_admin_form.lastname.focus();
				returnflag = false;
			}
			else
				if (document.access_admin_form.username.value.length==0) {
					alert("Please enter a user name.");
					document.access_admin_form.username.focus();
					returnflag = false;
				}
				else
					if (document.access_admin_form.password.value.length==0) {
						alert("Please enter a password.");
						document.access_admin_form.password.focus();
						returnflag = false;
					}
					else
						if (document.access_admin_form.password.value.length > 8) {
							alert("Passwords must be 8 characters or less.  Please choose another password.");
							document.access_admin_form.password.focus();
							returnflag = false;
						}

                if (returnflag) {
                    if (checkCharacter(document.access_admin_form.firstname.value, '"')) {
			alert("Please enter a valid first name. (Double quotes are not allowed)");
			document.access_admin_form.firstname.focus();
                        returnflag = false;
                    } else 
                    if (checkCharacter(document.access_admin_form.lastname.value, '"')) {
			alert("Please enter a valid last name. (Double quotes are not allowed)");
			document.access_admin_form.lastname.focus();
                        returnflag = false;
                    } else
                   if (checkCharacter(document.access_admin_form.username.value, '"') ||
                        checkCharacter(document.access_admin_form.username.value, "'")) {
			alert("Please enter a valid user name. (Single quote and double quotes are not allowed)");
			document.access_admin_form.username.focus();
                        returnflag = false;
                    } else
                    if (checkCharacter(document.access_admin_form.password.value, '"') ||
                        checkCharacter(document.access_admin_form.password.value, "'")) {
			alert("Please enter a valid password. (Single quote and double quotes are not allowed)");
			document.access_admin_form.username.focus();
                        returnflag = false;
                    }
                 }


		return returnflag;
	}

function preFillFormAccessAdmin()  {

		var indexselected=document.access_admin_form.administrator.selectedIndex;
		var catselected=document.access_admin_form.administrator.options[indexselected].value;
		var test= "";

		//alert(catselected);
	if (indexselected == null || indexselected == 0 ) {
		//alert(document.access_admin_form.administrator.value);
		document.access_admin_form.firstname.value ="";
		document.access_admin_form.lastname.value = "";
		document.access_admin_form.username.value = "";
		document.access_admin_form.password.value = "";
		//document.access_admin_form.access.value = "";
		document.access_admin_form.Update.disabled=true;
		document.access_admin_form.Delete.disabled=true;
		document.access_admin_form.Add.disabled=false;
	//	document.access_admin_form.Add.style.color = "black";
	}
	else{
		document.access_admin_form.Update.disabled=false;
		document.access_admin_form.Delete.disabled=false;
		document.access_admin_form.Add.disabled=true;
	//	document.access_admin_form.Add.style.color = "white";
	}


	
	for (var i = 0; i < userNameArray.length; i++) {

		if(navigator.appName=='Netscape')
 				test= catselected;
		else
			test=document.access_admin_form.administrator.value ;
	

	if (test == userNameArray[i]) {

			document.access_admin_form.firstname.value = firstNameArray[i];
			document.access_admin_form.lastname.value = lastNameArray[i];

				if(navigator.appName=='Netscape'){
			
					document.access_admin_form.administrator.options[indexselected].selected=true;
							
				}
				else {
					document.access_admin_form.administrator.value = userNameArray[i];
					}
				document.access_admin_form.username.value = userNameArray[i];

				document.access_admin_form.password.value = passwordArray[i];

	//	document.access_admin_form.access.focus();
		if(navigator.appName=='Netscape'){

				
		//	alert("userLevelArray[i] = "+userLevelArray[i]-1);
		//	alert(document.access_admin_form.access.options);
		

			document.access_admin_form.access.options.selectedIndex= parseInt(userLevelArray[i])-1;
			//	alert(document.access_admin_form.access.selectedIndex);
			

			}
			else
	   			document.access_admin_form.access.value = userLevelArray[i];
		
			document.access_admin_form.updateadminusername.value=userNameArray[i];

			break;	
		}
	}
	return;
}

function selectSectionSectionAdmin() {
	//	alert(document.navigationForm.sectionId.value);
	if(document.navigationForm.sectionId.value==""){
		alert("Please select Section from Left Navigation.");
		return;
	}
	else{
		location = 'adminindex.jsp?form=2&parentId=' + document.navigationForm.sectionId.value;
		//alert(document.navigationForm.URL);			
	}
}
function createPopupWithName(windowName, windowX, windowY, height,width, src) {	
	var newWindow;
	newWindow=window.open(src, windowName,
                              "status,height="+height +
                              ",width=" + width +
                              ",screenX="+windowX+
                              ",screenY="+windowY+
                              ",top="+windowY+
                              ",left="+windowX+
                              ",resizable=yes,scrollbars=yes");
	newWindow.focus();	       
} 

function buttonTypeSectionAdmin(buttonTtype)  {
	var message ="Are you sure you want to delete this Section?";
	document.navigationForm.action.value=buttonTtype;
	if(buttonTtype=="Delete"){
		if(document.navigationForm.removeFlag.value=="true")
			message= "Child section exists for this section , are you sure you want to delete?";
		if (confirm(message)) {	
			document.navigationForm.submit();				
		}
	}
	else
		if(buttonTtype=="Update" || document.navigationForm.parentId.value > 0){
			 document.navigationForm.sectionname.value = stripSpaces(document.navigationForm.sectionname.value);
			if (document.navigationForm.sectionname.value.length==0) {
				alert("Please enter a section name.");
				document.navigationForm.sectionname.focus();					
			}
                        else 
				// modified by AVM on 26Dec00
				if (checkCharacter(document.navigationForm.sectionname.value,'"')) {

					if (document.navigationForm.parentId.value > 0) {
	                              		//display empty subsection name message                                            
        	                            	alert("Please enter a valid subsection name. (backslash and double quotes characters are not allowed).");
                	                        document.navigationForm.sectionname.focus();
					}
					else {
        					//display empty section name message                                            
                                    		alert("Please enter a valid section name. (@!~#$%^&*()/\\:?;<>| double quotes and single quote characters are not allowed).");
                                        	document.navigationForm.sectionname.focus();
                          		}
				}

                        else 
				if (document.navigationForm.parentId.value > 0 && (!isValidSubsectionName(document.navigationForm.sectionname.value))) {      

					//display invalid subsection name message
					alert("Please enter a valid subsection name. (backslash and double quotes characters are not allowed).");
					document.navigationForm.sectionname.focus();
				}
			else  
				if ((document.navigationForm.parentId.value=="0"|| document.navigationForm.parentId.value=="-1" || document.navigationForm.parentId.value=="-2") && (!isValidString(document.navigationForm.sectionname.value))) {      
					
					//display invalid section name message
					alert("Please enter a valid section name. (@!~#$%^&*()/\\:?;<>| double quotes and single quote characters are not allowed).");
					document.navigationForm.sectionname.focus();
                                }
				// end AVM modifications

			else
				if(!isValidDate(document.navigationForm.startDate.value)) {
					alert("Please enter a valid start date.");
					document.navigationForm.startDate.focus();
					returnflag = false;
				}
			else
				if(!isValidDate(document.navigationForm.endDate.value)) {
					alert("Please enter a valid end date.");
					document.navigationForm.endDate.focus();
					returnflag = false;
				}
			else
				document.navigationForm.submit();								
		}
		else {
			if(verifyInputSectionAdminForm())
				document.navigationForm.submit();				
		}
}

function LimitAttachSectionAdmin(form, file) {
	extArray = new Array(".gif");
	flag = false;
	if (!file) return false;
	while (file.indexOf("\\") != -1) {
		file = file.slice(file.indexOf("\\") + 1);
	}
	ext = file.slice(file.indexOf(".")).toLowerCase();
	for (var i = 0; i < extArray.length; i++) {
		if (extArray[i] == ext) {
			 flag = true;
		}
	}		
	
	if (!flag) {
		alert("Please only upload files that end in types:  " 
		+ (extArray.join("  ")) + "\nPlease select a new "
		+ "file to upload and submit again.");
		return false;
	}
	else {	
		return true;
	}
}



function verifyInputSectionAdminForm ()  {
		var returnflag = true;
                document.navigationForm.sectionname.value = stripSpaces(document.navigationForm.sectionname.value);
		if (document.navigationForm.sectionname.value.length==0) {
			alert("Please enter a section name.");
			document.navigationForm.sectionname.focus();
			returnflag = false;
	
		}
		else
                        if (checkCharacter(document.navigationForm.sectionname.value,'"')) {


				// modified by AVM on 26Dec00
				if (document.navigationForm.parentId.value > 0) {
	                        	//display empty subsection name message                                            
        	                        alert("Please enter a valid subsection name. (backslash and double quotes characters are not allowed).");
                	        }
			    	else {
        				//display empty section name message                                            
                                    	alert("Please enter a valid section name. (@!~#$%^&*()/\\:?;<>| double quotes and single quote characters are not allowed).");
                            	}

                   		document.navigationForm.sectionname.focus();
				returnflag = false;

                        }
                else 

                        if ((document.navigationForm.parentId.value=="0"|| document.navigationForm.parentId.value=="-1" || document.navigationForm.parentId.value=="-2") && (!isValidString(document.navigationForm.sectionname.value))) {
				alert("Please enter a valid section name. (@!~#$%^&*()/\\:?;<>| double quotes and single quote characters are not allowed).");
                        	document.navigationForm.sectionname.focus();
                        	returnflag = false;
                        }
		else
                        if ((document.navigationForm.parentId.value > 0) && (!isValidSubsectionName(document.navigationForm.sectionname.value))) {
				alert("Please enter a valid subsection name. (backslash and double quotes characters are not allowed).");
                        	document.navigationForm.sectionname.focus();
                        	returnflag = false;
                        }

			// end AVM modifications


		       else

			if (document.navigationForm.categoryflag!=null && document.navigationForm.categoryflag.checked==false && document.navigationForm.content.value.length==0) {
				alert("Please enter the content.");
				document.navigationForm.content.focus();
				returnflag = false;	
			}
			else
				if ((isNaN(document.navigationForm.maxViewOrder.value) || isNaN(document.navigationForm.vieworder.value)) ||
						parseInt(document.navigationForm.maxViewOrder.value)<parseInt(document.navigationForm.vieworder.value)) {
					alert("Please enter a View Order Less then Max View Order.");
					document.navigationForm.vieworder.value=document.navigationForm.maxViewOrder.value;
					document.navigationForm.vieworder.focus();
					returnflag = false;
				}
				else
					if(document.navigationForm.parentId.value=="0"|| document.navigationForm.parentId.value=="-1"){	
						if (document.navigationForm.NormalOff.value.length==0) {
							alert("Please select a normal off image.");
							document.navigationForm.NormalOff.focus();
							returnflag = false;
						}
						else
							if (document.navigationForm.NormalOn.value.length==0) {
								alert("Please select a normal on image.");
								document.navigationForm.NormalOn.focus();
								returnflag = false;
							}
							else
								if (document.navigationForm.categoryflag!=null && document.navigationForm.categoryflag.checked==true && document.navigationForm.NewOn.value.length==0) {
									alert("Please select a new on image.");
									document.navigationForm.NewOn.focus();
									returnflag = false;
								}
								else
									if (document.navigationForm.categoryflag!=null && document.navigationForm.categoryflag.checked==true && document.navigationForm.NewOff.value.length==0) {
										alert("Please select a new off image.");
										document.navigationForm.NewOff.focus();
										returnflag = false;
									}
									else
										if(!isValidDate(document.navigationForm.startDate.value)) {
											alert("Please enter a valid start date.");
											document.navigationForm.startDate.focus();
											returnflag = false;
										}
									else
										if(!isValidDate(document.navigationForm.endDate.value)) {
											alert("Please enter a valid end date.");
											document.navigationForm.endDate.focus();
											returnflag = false;
										}
									else
										if(!LimitAttachSectionAdmin(document.navigationForm,document.navigationForm.NormalOff.value)){
											returnflag=false;
											document.navigationForm.NormalOff.focus();
										}
										else
											if(!LimitAttachSectionAdmin(document.navigationForm,document.navigationForm.NormalOn.value)){
												returnflag=false;
												document.navigationForm.NormalOn.focus();
											}
											else
												if(document.navigationForm.categoryflag!=null && document.navigationForm.categoryflag.checked==true)  {
													if (!LimitAttachSectionAdmin(document.navigationForm,document.navigationForm.NewOn.value)){
														returnflag=false;
														document.navigationForm.NewOn.focus();
													}
													else
														if(document.navigationForm.categoryflag!=null && document.navigationForm.categoryflag.checked && !LimitAttachSectionAdmin(document.navigationForm,document.navigationForm.NewOff.value)){
															returnflag=false;
															document.navigationForm.NewOff.focus();
														}
												}
										}
		return returnflag;
		}



function emailAdminFillArticleDropDown() {
	var iCtr = 1;
	document.Email_Form.Article.options.length = 0;
	newOpt=new Option;
	newOpt.value=0;
	newOpt.text="None";
	newOpt.selected=true;
	document.Email_Form.Article.options[0]=newOpt;
		
	for (i=0;i<articleInfoArray.length;i++) {
		if (document.Email_Form.Category.options[document.Email_Form.Category.selectedIndex].value==articleInfoArray[i][1]) {					
			newOpt=new Option;
			newOpt.value=articleInfoArray[i][0];
			newOpt.text=articleInfoArray[i][2];
			document.Email_Form.Article.options[iCtr]=newOpt;
			iCtr++;
		}
	}
	document.Email_Form.Article.selectedIndex = 0
}

function surveyAdminFillArticleDropDown() {
	var iCtr = 1;
	document.Survey_Form.Article.options.length = 0;
	newOpt=new Option;
	newOpt.value=0;
	newOpt.text="None";
	document.Survey_Form.Article.options[0]=newOpt;
	if (document.Survey_Form.Category.options[document.Survey_Form.Category.selectedIndex].value=='0'){
		//alert("In the select");
		document.Survey_Form.Article.options[0].selected=true;
	}
	for (i=0;i<articleInfoArray.length;i++) {
		if (document.Survey_Form.Category.options[document.Survey_Form.Category.selectedIndex].value==articleInfoArray[i][3]) {					
			newOpt=new Option;
			newOpt.value=articleInfoArray[i][0];
			newOpt.text=articleInfoArray[i][4];
			if (newOpt.value==selectedArticleId) {
				newOpt.selected = true;
			}			
			document.Survey_Form.Article.options[iCtr]=newOpt;
			iCtr++;
		}
	}
}

function removeOnPageOptionSurvey() {
	var theEndDate;
	var theStartDate;
	
	document.Survey_Form.displaytype.options.length = 0;	
	newOpt=new Option;		
	newOpt.value=1;
	newOpt.text="Pop-Up On Entry";
	if (displayTypeForSurvey==newOpt.value) {newOpt.selected = true;}		
	document.Survey_Form.displaytype.options[0]=newOpt;
	theStartDate = todaysDate;
	theEndDate = "01/01/9999";
		
	newOpt=new Option;
	newOpt.value=2;
	newOpt.text="Pop-Up On Exit";
	if (displayTypeForSurvey==newOpt.value) {newOpt.selected = true;}		
	document.Survey_Form.displaytype.options[1]=newOpt;		
		
	if (document.Survey_Form.Article !=null && document.Survey_Form.Article.selectedIndex>=0 && document.Survey_Form.Article.options[document.Survey_Form.Article.selectedIndex].value > 0) { //article is selected
		if (document.Survey_Form.Survey.options[document.Survey_Form.Survey.selectedIndex].value > 0){	// survey selected
			theEndDate = surveyEndDate;
			theStartDate = surveyStartDate;
		}
		else {
			for(var i=0;i<articleInfoArray.length;i++){ 
				if (articleInfoArray[i][0]==document.Survey_Form.Article.options[document.Survey_Form.Article.selectedIndex].value){	// for article start/end date getting set						
					if (document.Survey_Form.Survey !=null && document.Survey_Form.Survey.options[document.Survey_Form.Survey.selectedIndex].value > 0) { //survey is selected
						theEndDate = surveyEndDate;
						theStartDate = surveyStartDate;
					}
					else { // use article date
						theStartDate = articleInfoArray[i][1];
						theEndDate = articleInfoArray[i][2];
					}
				}
			}
		}
	}	
	else  { // no article selected
		newOpt=new Option;
		newOpt.value=3;
		newOpt.text="On Page";
		if (displayTypeForSurvey==newOpt.value || displayTypeForSurvey==0) {newOpt.selected = true;}
		document.Survey_Form.displaytype.options[2]=newOpt;
			
		if (document.Survey_Form.Survey !=null && document.Survey_Form.Survey.options[document.Survey_Form.Survey.selectedIndex].value > 0) { //survey is selected
			theEndDate = surveyEndDate;
			theStartDate = surveyStartDate;
		}
		else {
			theStartDate = todaysDate;
			theEndDate = "01/01/9999";
		}			
	}	
				
	document.Survey_Form.startDate.value = theStartDate;
	document.Survey_Form.endDate.value = theEndDate;
}
	
function getYear(theDate) {
	// date comes in as MM-DD-YYYY
	var x = theDate.indexOf("-"); // startDate stuff
	var month = theDate.substring(0,x);
	var temp = theDate.substring(x+1,theDate.length);
	x = temp.indexOf("-"); 
	var day = temp.substring(0,x);
	var year = temp.substring(x+1,temp.length);
	return year;
}
	
function getMonth(theDate) {
	// date comes in as MM-DD-YYYY
	var x = theDate.indexOf("-"); // startDate stuff
	var month = theDate.substring(0,x);
	return month;
}
	
function getDay(theDate) {
	// date comes in as MM-DD-YYYY
	var x = theDate.indexOf("-"); // startDate stuff
	var temp = theDate.substring(x+1,theDate.length);
	x = temp.indexOf("-"); 
	var day = temp.substring(0,x);
	return day;
}
	
function prepareForDB(field) {
	field = field.replace(/\'/g,"''");
	return field;
}
	
function surveyAdminChangeArticles(theSectionId,clickedButton) {
	document.Survey_Form.sectionId.value = theSectionId;
	surveyAdminSubmitButton(clickedButton);				
}

function surveyAdminChangeSurveys(theSurveyId1,clickedButton) {
	document.Survey_Form.surveyId.value = theSurveyId1;
	surveyAdminSubmitButton(clickedButton);
}

function surveyAdminSubmitButton(theClickedButton) {
	if(surveyAdminVerifyInput(theClickedButton)) {
		if (theClickedButton == 'Add' || theClickedButton == 'Update' ) {
			document.Survey_Form.title.value = prepareForDB(document.Survey_Form.title.value);
			document.Survey_Form.question.value = prepareForDB(document.Survey_Form.question.value);
			document.Survey_Form.answer1.value = prepareForDB(document.Survey_Form.answer1.value);
			document.Survey_Form.answer2.value = prepareForDB(document.Survey_Form.answer2.value);
			document.Survey_Form.answer3.value = prepareForDB(document.Survey_Form.answer3.value);
			document.Survey_Form.answer4.value = prepareForDB(document.Survey_Form.answer4.value);
			document.Survey_Form.answer5.value = prepareForDB(document.Survey_Form.answer5.value);
			document.Survey_Form.answer6.value = prepareForDB(document.Survey_Form.answer6.value);
			document.Survey_Form.answer7.value = prepareForDB(document.Survey_Form.answer7.value);
			document.Survey_Form.answer8.value = prepareForDB(document.Survey_Form.answer8.value);
		}
		document.Survey_Form.eventSource.value = theClickedButton;
		document.Survey_Form.submit();
	}
}

function surveyAdminVerifyInput (theClickedButton)  {		
		var returnflag = true;	
		var theStartDate;
		var theEndDate;	
		if (theClickedButton == 'Add' || theClickedButton == 'Update' ) {
			if(theClickedButton == 'Update') {
				if(document.Survey_Form.Survey.options[document.Survey_Form.Survey.selectedIndex].value == 'NULL') {
					alert("Please select a survey to update.");
					document.Survey_Form.Survey.focus();				
					return false;
				}
			}
			if(theClickedButton == 'Add') {
				if(document.Survey_Form.Survey.options[document.Survey_Form.Survey.selectedIndex].value >0) {
					alert("Please select 'Add New Survey' from drop down to add a new survey.");
					document.Survey_Form.Survey.focus();				
					return false;
				}
			}
			
			document.Survey_Form.startDate.value = removeWhitespace(document.Survey_Form.startDate.value);
			document.Survey_Form.endDate.value = removeWhitespace(document.Survey_Form.endDate.value);
			
			// If the start date is not provided and the survey is associated to an article, the
			// start date will match the start date of the article.  If the survey is not associated with
      // an article, the start date will default to today's date.  
      
			if (document.Survey_Form.startDate.value.length==0) {
				if (document.Survey_Form.Article.options[document.Survey_Form.Article.selectedIndex].value > 0){	// article selected
					for (i=0;i<articleInfoArray.length;i++) {
						if (document.Survey_Form.Article.options[document.Survey_Form.Article.selectedIndex].value==articleInfoArray[i][0]) {					
							theStartDate = articleInfoArray[i][1];
						}
					}
				}
				else {
					theStartDate = todaysDate;
				}
				document.Survey_Form.startDate.value = theStartDate;
			}
			
			// If the end date is not provided and the survey is associated to an article, the
			// end date will match the end date of the article.  If the survey is not associated 
			// with an article, the end date will default to a 1/1/9999
			
			if (document.Survey_Form.endDate.value.length==0) {
				if (document.Survey_Form.Article.options[document.Survey_Form.Article.selectedIndex].value > 0){	// article selected
					for (i=0;i<articleInfoArray.length;i++) {
						if (document.Survey_Form.Article.options[document.Survey_Form.Article.selectedIndex].value==articleInfoArray[i][0]) {					
							theEndDate = articleInfoArray[i][2];
						}
					}
				}
				else {
					theEndDate = "01/01/9999";
				}
				document.Survey_Form.endDate.value = theEndDate;
			}

                        document.Survey_Form.title.value    = stripSpaces(document.Survey_Form.title.value);
                        document.Survey_Form.question.value = stripSpaces(document.Survey_Form.question.value);
                        document.Survey_Form.answer1.value  = stripSpaces(document.Survey_Form.answer1.value);
                        document.Survey_Form.answer2.value  = stripSpaces(document.Survey_Form.answer2.value);
                        document.Survey_Form.answer3.value  = stripSpaces(document.Survey_Form.answer3.value);
                        document.Survey_Form.answer4.value  = stripSpaces(document.Survey_Form.answer4.value);
                        document.Survey_Form.answer5.value  = stripSpaces(document.Survey_Form.answer5.value);
                        document.Survey_Form.answer6.value  = stripSpaces(document.Survey_Form.answer6.value);
                        document.Survey_Form.answer7.value  = stripSpaces(document.Survey_Form.answer7.value);
                        document.Survey_Form.answer8.value  = stripSpaces(document.Survey_Form.answer8.value);

			
			if(document.Survey_Form.title.value.length==0) {
				alert("Please enter a Title for the survey.");
				document.Survey_Form.title.focus();				
				return false;
			}

                        if (checkCharacter(document.Survey_Form.title.value, '"')) {
		   	    alert("Please enter a valid title. (Double quotes are not allowed)");
			    document.Survey_Form.title.focus();
                            return false;
                        }


			if(document.Survey_Form.question.value.length==0) {
				alert("Please enter a question for the survey.");
				document.Survey_Form.question.focus();				
				return false;
			}

                        if (checkCharacter(document.Survey_Form.question.value, '"')) {
		   	    alert("Please enter a valid question. (Double quotes are not allowed)");
			    document.Survey_Form.question.focus();
                            return false;
                        }


			if(document.Survey_Form.answer1.value.length==0 || document.Survey_Form.answer2.value.length==0) {
				alert("Please enter atleast two answers for the the survey.");
				if(document.Survey_Form.answer1.value.length==0) {
					document.Survey_Form.answer1.focus();
				} 
				else {
					document.Survey_Form.answer2.focus();
				}				
				return false;
			}	

                        if (checkCharacter(document.Survey_Form.answer1.value, '"') ||
                            checkCharacter(document.Survey_Form.answer2.value,'"') ||
                            checkCharacter(document.Survey_Form.answer3.value,'"') ||
                            checkCharacter(document.Survey_Form.answer4.value,'"') ||
                            checkCharacter(document.Survey_Form.answer5.value,'"') ||
                            checkCharacter(document.Survey_Form.answer6.value,'"') ||
                            checkCharacter(document.Survey_Form.answer7.value,'"') ||
                            checkCharacter(document.Survey_Form.answer8.value,'"')) {
		   	    alert("Please enter valid answer(s). (Double quotes are not allowed)");
                            return false;
                        }

			
			if(!isValidDate(document.Survey_Form.startDate.value)) {
				alert("Please enter a valid start date.");
				document.Survey_Form.startDate.focus();				
				return false;
			}
			
			if(!isValidDate(document.Survey_Form.endDate.value)) {
				alert("Please enter a valid end date.");
				document.Survey_Form.endDate.focus();				
				return false;
			}
			
			if(isNaN(document.Survey_Form.displaytype.options[document.Survey_Form.displaytype.selectedIndex].value)) {
				alert("Please enter a valid display type.");
				document.Survey_Form.displaytype.focus();				
				return false;
			}
			
			if(document.Survey_Form.Category.value == '0' && (document.Survey_Form.displaytype.value == '4' || document.Survey_Form.displaytype.value == '5')) {
				alert("Display type should be On Page or Pop-Up On Entry or Pop-Up On Exit.");
				document.Survey_Form.displaytype.focus();				
				return false;
			}

			if(document.Survey_Form.Category.value == '0' && document.Survey_Form.Article.value != '0') {
				alert("No Article should be selected for OnHomepage/OnEntry/OnExit surveys.");
				document.Survey_Form.Article.focus();				
				return false;
			}
		} 
		
		else if (theClickedButton == 'Delete') {			
			if(document.Survey_Form.Survey.value == 'NULL') {
				alert("Please select a survey to delete.");
				document.Survey_Form.Survey.focus();				
				return false;
			}
			else if(!confirm("Are you sure?")) {
				return false;			
			}
		}
		return true;	
}
	
	
function verifyInputUnsubscribe ()  {
	var returnflag = true;
	if (document.unsubscribe_form.password.value.length==0) {
		alert("Please enter your password.");
		document.unsubscribe_form.password.focus();
		returnflag = false;
	}
	return returnflag;
}
	
function verifyInputLogin ()  {
	var returnflag = true;
	if (document.login_form.login.value.length==0) {
		alert("Please enter your login.");
		document.login_form.login.focus();
		returnflag = false;
	}
	else
		if (document.login_form.password.value.length==0) {
			alert("Please enter your password.");
			document.login_form.password.focus();
			returnflag = false;
		}
	return returnflag;
}
	
function verifyInputLoginError ()  {
		var returnflag = true;
		if (document.passwordform.password.value.length==0) {
			alert("Please enter your password.");
			document.passwordform.password.focus();
			returnflag = false;
		}
		return returnflag;
	}
	
function verifyInputPassword ()  {
		var returnflag = true;
		if (document.passwordform.email.value.length==0) {
			alert("Please enter your email address.");
			document.passwordform.email.focus();
			returnflag = false;
		}
		return returnflag;
	}

// Change Management: This function has been replaced with a new version. Date: 12-15-2000
/* function verifyInputSubscriber ()  {
		var returnflag = true;
		if (document.subscriberForm.firstname.value.length==0) {
			alert("Please enter your first name.");
			document.subscriberForm.firstname.focus();
			returnflag = false;
		}
		else
			if (document.subscriberForm.lastname.value.length==0) {
				alert("Please enter your last name.");
				document.subscriberForm.lastname.focus();
				returnflag = false;
			}
			else
				if (document.subscriberForm.state.selectedIndex.value=="") {
					alert("Please select a state.");
					document.subscriberForm.state.focus();
					returnflag = false;
				}		
				else
					if (document.subscriberForm.zip.value.length==0) {
						alert("Please enter your zip code.");
						document.subscriberForm.zip.focus();
						returnflag = false;
					}								
					else
						if (zipCheckSubscriber(document.subscriberForm.zip)) {
							document.subscriberForm.zip.focus();
							returnflag = false;
						}		
						else
							if (document.subscriberForm.email.value.length==0) {
								alert("Please enter your email address.");
								document.subscriberForm.email.focus();
								returnflag = false;
							}			
							else
								if (emailCheckSubscriber(document.subscriberForm.email)) {
									document.subscriberForm.email.focus();
									returnflag = false;
								}			
								else
								if (document.subscriberForm.email.value!=document.subscriberForm.confirmemail.value) {
									alert("The e-mail addresses you have entered do not match.");
									document.subscriberForm.email.focus();
									returnflag = false;
								}
								else
									if (document.subscriberForm.password.value.length==0) {
										alert("Please enter your password.");
										document.subscriberForm.password.focus();
										returnflag = false;
									}			
									else
										if (document.subscriberForm.password.value.length > 8) {
											alert("Please limit your password to 8 characters or less.");
											document.subscriberForm.password.focus();
											returnflag = false;
										}			
									else
										if (document.subscriberForm.confirmPassword.value.length==0) {
											alert("Please confirm your password.");									
											document.subscriberForm.confirmPassword.focus();
											returnflag = false;
										}						
										else
											if (document.subscriberForm.password.value != document.subscriberForm.confirmPassword.value) {
												alert("The passwords you have entered do not match.");									
												document.subscriberForm.confirmPassword.focus();
												returnflag = false;
											}	
											else
												if (document.subscriberForm.question.selectedIndex.value=="") {
													alert("Please enter a hint question.");
													document.subscriberForm.question.focus();
													returnflag = false;
												}			
												else
													if (document.subscriberForm.answer.value.length==0) {
														alert("Please enter your hint answer.");
														document.subscriberForm.answer.focus();
														returnflag = false;
													}	
															else
																if (document.subscriberForm.preference1.selectedIndex == 0 && document.subscriberForm.preference2.selectedIndex != 0) {
																	alert("In order to select a second favorite category you must select a favorite category first.");
																	document.subscriberForm.preference1.focus();
																	returnflag = false;
																}	
															else
																if (document.subscriberForm.preference1.selectedIndex != 0 &&
																	document.subscriberForm.preference1.options[document.subscriberForm.preference1.selectedIndex].value == 
																	document.subscriberForm.preference2.options[document.subscriberForm.preference2.selectedIndex].value) {
																	alert("Your favorite and second favorite categories are the same.\nPlease change one.");
																	document.subscriberForm.preference1.focus();
																	returnflag = false;
																}	
																else
																	if (document.subscriberForm.category.selectedIndex.value=="") {
																		alert("Please select a category.");
																		document.subscriberForm.category.focus();
																		returnflag = false;
																	}		
			
		return returnflag;
	} */
	function verifyInputSubscriber ()  {
		
		var returnflag = true;
		document.subscriberForm.firstname.value = 	stripSpaces(document.subscriberForm.firstname.value);
		document.subscriberForm.lastname.value = 	stripSpaces(document.subscriberForm.lastname.value);
		document.subscriberForm.zip.value = 		stripSpaces(document.subscriberForm.zip.value);
		document.subscriberForm.email.value = 		stripSpaces(document.subscriberForm.email.value);
		document.subscriberForm.password.value = 	stripSpaces(document.subscriberForm.password.value);
		document.subscriberForm.confirmPassword.value = stripSpaces(document.subscriberForm.confirmPassword.value);
		document.subscriberForm.answer.value = 		stripSpaces(document.subscriberForm.answer.value);
		document.subscriberForm.address1.value = 	stripSpaces(document.subscriberForm.address1.value);
		document.subscriberForm.address2.value = 	stripSpaces(document.subscriberForm.address2.value);
		document.subscriberForm.city.value = 		stripSpaces(document.subscriberForm.city.value);

		if (document.subscriberForm.firstname.value.length==0) {
			alert("Please enter your first name.");
			document.subscriberForm.firstname.focus();
			returnflag = false;

		} else 
			if (checkCharacter(document.subscriberForm.firstname.value,'"')) { 
				alert("Please enter a valid first name. (Double quotes are not allowed)");
				document.subscriberForm.firstname.focus();
				returnflag = false;
		
			} else
				if (document.subscriberForm.lastname.value.length==0) {
					alert("Please enter your last name.");
					document.subscriberForm.lastname.focus();
					returnflag = false;
				}
				else	
					if (checkCharacter(document.subscriberForm.lastname.value,'"')) { 
						alert("Please enter a valid last name. (Double quotes are not allowed)");
						document.subscriberForm.lastname.focus();
						returnflag = false;
		
					}
				else if (checkCharacter(document.subscriberForm.address1.value,'"')) { 
					alert("Please enter a valid address. (Double quotes are not allowed)");
					document.subscriberForm.address1.focus();
					returnflag = false;
		
				} else if (checkCharacter(document.subscriberForm.address2.value,'"')) { 
					alert("Please enter a valid address. (Double quotes are not allowed)");
					document.subscriberForm.address2.focus();
					returnflag = false;
		
				} else if (checkCharacter(document.subscriberForm.city.value,'"')) { 
					alert("Please enter a valid city. (Double quotes are not allowed)");
					document.subscriberForm.city.focus();
					returnflag = false;
		
				} else 

				if (document.subscriberForm.state.options[document.subscriberForm.state.selectedIndex].value=="") {
					alert("Please select a state.");
					document.subscriberForm.state.focus();
					returnflag = false;
				}		
				else
					if (document.subscriberForm.zip.value.length==0) {
						alert("Please enter your zip code.");
						document.subscriberForm.zip.focus();
						returnflag = false;
					}								
					else
						if (zipCheckSubscriber(document.subscriberForm.zip)) {
							document.subscriberForm.zip.focus();
							returnflag = false;
						}		
						else
							if (document.subscriberForm.email.value.length==0) {
								alert("Please enter your email address.");
								document.subscriberForm.email.focus();
								returnflag = false;
							}			
							else if (checkCharacter(document.subscriberForm.email.value,'"')) { 
									alert("Please enter a valid email address. (Double quotes are not allowed)");
									document.subscriberForm.email.focus();
									returnflag = false;
								} else if (emailCheckSubscriber(document.subscriberForm.email)) {
									document.subscriberForm.email.focus();
									returnflag = false;
								}			
								else if (document.subscriberForm.confirmemail.value.length==0) {
									alert("Please confirm your email address.");
									document.subscriberForm.confirmemail.focus();
									returnflag = false;
								} else 	if (checkCharacter(document.subscriberForm.confirmemail.value,'"')) { 
									alert("Please enter a valid email address. (Double quotes are not allowed)");
									document.subscriberForm.confirmemail.focus();
									returnflag = false;
								} else 	
								if (document.subscriberForm.email.value!=document.subscriberForm.confirmemail.value) {
									alert("The e-mail addresses you have entered do not match.");
									document.subscriberForm.email.focus();
									returnflag = false;
								}
								else
									if (document.subscriberForm.password.value.length==0) {
										alert("Please enter your password.");
										document.subscriberForm.password.focus();
										returnflag = false;
									}			
									else
										if (document.subscriberForm.password.value.length > 8) {
											alert("Please limit your password to 8 characters or less.");
											document.subscriberForm.password.focus();
											returnflag = false;
										}			
									else
										if (document.subscriberForm.confirmPassword.value.length==0) {
											alert("Please confirm your password.");									
											document.subscriberForm.confirmPassword.focus();
											returnflag = false;
										}						
										else
											if (document.subscriberForm.password.value != document.subscriberForm.confirmPassword.value) {
												alert("The passwords you have entered do not match.");									
												document.subscriberForm.confirmPassword.focus();
												returnflag = false;
											}	
											else
												if (document.subscriberForm.question.options[document.subscriberForm.question.selectedIndex].value=="") {
													alert("Please enter a hint question.");
													document.subscriberForm.question.focus();
													returnflag = false;
												}			
												else
													if (document.subscriberForm.answer.value.length==0) {
														alert("Please enter your hint answer.");
														document.subscriberForm.answer.focus();
														returnflag = false;
													} else	
														if (checkCharacter(document.subscriberForm.answer.value,'"')) { 
															alert("Please enter a valid answer. (Double quotes are not allowed)");
															document.subscriberForm.answer.focus();
															returnflag = false;
		
															}
															else
																if (document.subscriberForm.preference1.selectedIndex == 0 && document.subscriberForm.preference2.selectedIndex != 0) {
																	alert("In order to select a second favorite category you must select a favorite category first.");
																	document.subscriberForm.preference1.focus();
																	returnflag = false;
																}	
															else
																if (document.subscriberForm.preference1.selectedIndex != 0 &&
																	document.subscriberForm.preference1.options[document.subscriberForm.preference1.selectedIndex].value == 
																	document.subscriberForm.preference2.options[document.subscriberForm.preference2.selectedIndex].value) {
																	alert("Your favorite and second favorite categories are the same.\nPlease change one.");
																	document.subscriberForm.preference1.focus();
																	returnflag = false;
																}	
																else
																	if (document.subscriberForm.category.options[document.subscriberForm.category.selectedIndex].value=="") {
																		alert("Please select a category.");
																		document.subscriberForm.category.focus();
																		returnflag = false;
																	}		
			
		return returnflag;
	}
	function verifyInputLiteSubscriber ()  {
		
		var returnflag = true;
		document.subscriberForm.firstname.value = 	stripSpaces(document.subscriberForm.firstname.value);
		document.subscriberForm.lastname.value = 	stripSpaces(document.subscriberForm.lastname.value);
		document.subscriberForm.zip.value = 		stripSpaces(document.subscriberForm.zip.value);
		document.subscriberForm.email.value = 		stripSpaces(document.subscriberForm.email.value);
//		document.subscriberForm.password.value = 	stripSpaces(document.subscriberForm.password.value);
//		document.subscriberForm.confirmPassword.value = stripSpaces(document.subscriberForm.confirmPassword.value);
//		document.subscriberForm.answer.value = 		stripSpaces(document.subscriberForm.answer.value);
//		document.subscriberForm.address1.value = 	stripSpaces(document.subscriberForm.address1.value);
//		document.subscriberForm.address2.value = 	stripSpaces(document.subscriberForm.address2.value);
//		document.subscriberForm.city.value = 		stripSpaces(document.subscriberForm.city.value);

		if (document.subscriberForm.firstname.value.length==0) {
			alert("Please enter your first name.");
			document.subscriberForm.firstname.focus();
			returnflag = false;

		} else 
			if (checkCharacter(document.subscriberForm.firstname.value,'"')) { 
				alert("Please enter a valid first name. (Double quotes are not allowed)");
				document.subscriberForm.firstname.focus();
				returnflag = false;
		
			} else
				if (document.subscriberForm.lastname.value.length==0) {
					alert("Please enter your last name.");
					document.subscriberForm.lastname.focus();
					returnflag = false;
				}
				else	
					if (checkCharacter(document.subscriberForm.lastname.value,'"')) 
					{ 
						alert("Please enter a valid last name. (Double quotes are not allowed)");
						document.subscriberForm.lastname.focus();
						returnflag = false;		
					}
				else
					if (document.subscriberForm.zip.value.length != 0 && document.subscriberForm.zip.value != "NA" ) {
						if (zipCheckSubscriber(document.subscriberForm.zip)) {
							document.subscriberForm.zip.focus();
							returnflag = false;
						}		
					}	

				else
					if (document.subscriberForm.email.value.length==0) {
						alert("Please enter your email address.");
						document.subscriberForm.email.focus();
						returnflag = false;
					}			
					else if (checkCharacter(document.subscriberForm.email.value,'"')) { 
							alert("Please enter a valid email address. (Double quotes are not allowed)");
							document.subscriberForm.email.focus();
							returnflag = false;
						}
//Email addresses validated on the server
						 //else if (emailCheckSubscriber(document.subscriberForm.email)) {
//							document.subscriberForm.email.focus();
//							returnflag = false;
//						}			
						else if (document.subscriberForm.confirmemail.value.length==0) {
							alert("Please confirm your email address.");
							document.subscriberForm.confirmemail.focus();
							returnflag = false;
						} else 	if (checkCharacter(document.subscriberForm.confirmemail.value,'"')) { 
							alert("Please enter a valid email address. (Double quotes are not allowed)");
							document.subscriberForm.confirmemail.focus();
							returnflag = false;
						} else 	
						if (document.subscriberForm.email.value!=document.subscriberForm.confirmemail.value) {
							alert("The e-mail addresses you have entered do not match.");
							document.subscriberForm.email.focus();
							returnflag = false;
						}

									

						else
							if (document.subscriberForm.preference1.selectedIndex == 0 && document.subscriberForm.preference2.selectedIndex != 0) {
								alert("In order to select a second favorite category you must select a favorite category first.");
								document.subscriberForm.preference1.focus();
								returnflag = false;
							}	
						else
							if (document.subscriberForm.preference1.selectedIndex != 0 &&
								document.subscriberForm.preference1.options[document.subscriberForm.preference1.selectedIndex].value == 
								document.subscriberForm.preference2.options[document.subscriberForm.preference2.selectedIndex].value) {
								alert("Your favorite and second favorite categories are the same.\nPlease change one.");
								document.subscriberForm.preference1.focus();
								returnflag = false;
							}	
							else
								if (document.subscriberForm.category.options[document.subscriberForm.category.selectedIndex].value=="") {
									alert("Please select a category.");
									document.subscriberForm.category.focus();
									returnflag = false;
								}		

		return returnflag;
	}	
	function zipCheckSubscriber(zipCode) {
		var returnFlag = false;
		if (isNaN(zipCode.value.substring(0,4))) {
			alert("The zip code you have entered is not numeric.");
			returnFlag = true;
		}
		else
			if (isNaN(zipCode.value.substring(6,9))) {
				alert("The zip code you have entered is not numeric.");
				returnFlag = true;
			}
			else		
				if (zipCode.value.length!=5 && zipCode.value.length!=10) {
					alert("Zip code must be entered as xxxxx or xxxxx-xxxx.");
					returnFlag = true;
				}
				else
					if (zipCode.value.length==10 && zipCode.value.indexOf("-")!=5) {
						alert("The zip code you entered is incorrect.");
						returnFlag = true;
					}
		return returnFlag;
	}


function openWindow(url) {
    window.open(url,"","screenY=80,screenX=80, left=80,top=80,location=yes,resizable=yes,scrollbars=yes,menubar=yes,status=yes,toolbar=yes,personalbar=yes");
}


function SendToFriend() {
  
    if (document.articleform.EmailList.value == "") {
        alert('Please enter Email address.');
        document.articleform.EmailList.focus();
        return;
    }
//Email addresses validated on the server
    /*if (emailCheckSubscriber(document.articleform.EmailList)) {
        document.articleform.EmailList.focus();
        return;
    }*/

    document.articleform.TypeFlag.value = 'MailTo';
    document.articleform.submit();
}

function PrintArticle() {
  window.open(document.articleform.documentPath.value+'/printarticle.jsp?ArticleId='+
              document.articleform.ArticleId.value,"","menubar=yes,resizable=yes,width=550,height=550,titlebar=yes,toolbar=yes,scrollbars=yes");
}


function RateArticle() {
    noOfBoxes = document.articleform.Rating.length;
    flag      = false;
  
    for (i  = 0; i < noOfBoxes; i++ ) {
        if (document.articleform.Rating[i].checked) {
            flag = true;
            break;
        }
    }
    if (!flag) {
        alert('Please select one of the ratings.');
    } else {
        document.articleform.TypeFlag.value = 'Rating';
        document.articleform.submit();
    }
}

//Modified by Mizba Tawa on 01/15/01 - Code drop from Paragon 

function emailCheckSubscriber(emailAddress) {
   var returnFlag = false;

   var validSuffixes = new Array(".com",".edu",".net",".org",".gov",".mil",".tv");
   var isFound = false;

   var atSignPos = emailAddress.value.indexOf("@");
   if (atSignPos < 0) {
	alert("This email address seems wrong.\nPlease make sure that the email address has the @ symbol.");
	returnFlag = true;
   } 

   else if (atSignPos == 0) {
      alert("This email address seems wrong.\nPlease make sure that the email address does not start with the @ symbol.");
	returnFlag = true;
   } 

   else if (emailAddress.value.substring(atSignPos+1) == emailAddress.value.length-1) {
   	// email suffix is invalid
      alert('This email address seems wrong.\nPlease check that you have included the correct suffix (such as ".com" or ".net").');
      returnFlag = true;
   } 

   else if (emailAddress.value.substr(atSignPos-1,1) == "." ) {
	alert("This email address seems wrong.\nEmail address may not have '.' right before or after the @ symbol.");
	returnFlag = true;
   }
   else if (emailAddress.value.indexOf(" ") > -1) {
	alert('This email address seems wrong. \nPlease remove any spaces from the address.');
	returnFlag = true;
   }
   else {  
      var addressPart = emailAddress.value.substring(atSignPos+1);
      if (addressPart.indexOf("@") > -1) {
	   // second or more existence of @ symbol is invalid
	   alert("This email address seems wrong.\nPlease make sure that the email address does not have more than one @ symbol.");
	   returnFlag = true;
      }

      else if (emailAddress.value.substr(atSignPos+1,1) == "." ) {
	   alert("This email address seems wrong.\nEmail address may not have '.' right before or after the @ symbol.");
	   returnFlag = true;
      }
      else {
         //validate suffixes
         for (var i=0; i < validSuffixes.length; i++) {
	      if (addressPart.indexOf( validSuffixes[i] ) > -1) {
	         isFound = true;
	         break;
	      }
         }
         if (!isFound) {
	      // email suffix is invalid
	      alert('This email address seems wrong.\nPlease check that you have included the correct suffix (such as ".com" or ".net").');
	      returnFlag = true;
         }
       }
    }  

/*  OLD CODE:  Modified on 1/15/01 to cover other scenarios
   if (emailAddress.value.indexOf("@")<3) {
	alert("This email address seems wrong. \nPlease check the prefix and '@' sign.");
	returnFlag = true;
   } 
	else 
		if (emailAddress.value.indexOf(".")<5)
	   	{
			alert('This email address seems wrong. \nPlease check that you have included the correct suffix (such as ".com" or ".net").');
	   		returnFlag = true;
       	}
		else
			if (emailAddress.value.indexOf(" ") > -1)
			{
				alert('This email address seems wrong. \nPlease remove any spaces from the address.');
		   		returnFlag = true;
	       	}
*/

   return returnFlag;
}


function SubscriberReportShowAll (theClickedButton) {
    setStatus(document.subscriberReport.zip, false);
    setStatus(document.subscriberReport.state, false);
    setStatus(document.subscriberReport.preference, false);

    setStatus(document.subscriberReport.startdate_month, false);
    setStatus(document.subscriberReport.startdate_day, false);
    setStatus(document.subscriberReport.startdate_year, false);
    setStatus(document.subscriberReport.enddate_month, false);
    setStatus(document.subscriberReport.enddate_day, false);
    setStatus(document.subscriberReport.enddate_year, false);


		document.subscriberReport.zip.options[0].selected = true;
		document.subscriberReport.state.options[0].selected = true;
		document.subscriberReport.preference.options[0].selected = true;
    document.subscriberReport.startdate_month[0].selected = true;
    document.subscriberReport.startdate_day[0].selected = true;
    document.subscriberReport.startdate_year[0].selected = true;
    document.subscriberReport.enddate_month[0].selected = true;
    document.subscriberReport.enddate_day[0].selected = true;
    document.subscriberReport.enddate_year[0].selected = true;

    if (verifyFormFields()) {
    	document.subscriberReport.eventSource.value = theClickedButton;
        document.subscriberReport.submit();
    }
}

function setStatus(fieldName, flag) {
    for (i = 0 ; i < fieldName.length; i++) {
        fieldName.options[i].selected = flag;
     }
}

  
function validateDate(month, day, year) {
    var count = 0;
            
    if (month != '') {
       count++;
    }
           
    if (day != '') {
        count++;
    }
           
    if (year != '') {
        count++;
    }
 
    if (count == 0 || count == 3) {
        return true;
    } else {
        return false;
    }
}

 
          
 
function formDate() {
    var subRepForm = document.subscriberReport;
    if (validateDate(
                     subRepForm.startdate_month.options[subRepForm.startdate_month.selectedIndex].value,
                     subRepForm.startdate_day.options[subRepForm.startdate_day.selectedIndex].value,
                     subRepForm.startdate_year.options[subRepForm.startdate_year.selectedIndex].value
                     )) {
         document.subscriberReport.startDate.value =
                     subRepForm.startdate_month.options[subRepForm.startdate_month.selectedIndex].value + "/" +
                     subRepForm.startdate_day.options[subRepForm.startdate_day.selectedIndex].value + "/" +
                     subRepForm.startdate_year.options[subRepForm.startdate_year.selectedIndex].value;
    } else {
        alert('Please select a from date.');
        return false;
    }

    if (validateDate(
                     subRepForm.enddate_month.options[subRepForm.enddate_month.selectedIndex].value,
                     subRepForm.enddate_day.options[subRepForm.enddate_day.selectedIndex].value,
                     subRepForm.enddate_year.options[subRepForm.enddate_year.selectedIndex].value
                     )) {
	document.subscriberReport.endDate.value =
                     subRepForm.enddate_month.options[subRepForm.enddate_month.selectedIndex].value + "/" +
                     subRepForm.enddate_day.options[subRepForm.enddate_day.selectedIndex].value + "/" +
                     subRepForm.enddate_year.options[subRepForm.enddate_year.selectedIndex].value;
    } else {
        alert('Please select a to date.');
        return false;
    }

           
    var dateValue = document.subscriberReport.startDate.value;
  
    if (dateValue.length == 2) {
         document.subscriberReport.startDate.value = '';
    }

    dateValue = document.subscriberReport.endDate.value;
    if (dateValue.length == 2) {
         document.subscriberReport.endDate.value = '';
    }

    return true;
}

function submitUser(user, flag) {
    document.subscriberReport.userId.value = user;
    document.subscriberReport.activatedFlag.value = flag;
    formDate();
    document.subscriberReport.eventSource.value = "userStatusChangeButton";
    document.subscriberReport.submit();
}

function isSelected (fieldName) {
    selectedFlag = false;
    for (i = 0 ; i < fieldName.length; i++) {
         if (fieldName.options[i].selected) {
             selectedFlag = true;
             break;
         }
     }
     return selectedFlag;
 }

function verifyFormFields(theClickedButton) {
      if (!formDate()) {
         return false;
     }
     if (!isSelected(document.subscriberReport.zip)) {
         alert('Please select a zipcode .');
				 document.subscriberReport.zip.focus();
         return false;
     }

    if (!isSelected(document.subscriberReport.state)) {
         alert('Please select a statecode .');
				 document.subscriberReport.state.focus();
         return false;
     }

    if (!isSelected(document.subscriberReport.preference)) {
         alert('Please select a preference .');
				 document.subscriberReport.preference.focus();
         return false;
     }
     document.subscriberReport.eventSource.value = theClickedButton;
     document.subscriberReport.activatedFlag.value = false;
     return true;

}

function verifyInputSectionAdmin ()  {
		var returnflag = true;
		if (document.navigationForm.sectionname.value.length==0) {
			alert("Please enter a section name.");
			document.navigationForm.sectionname.focus();
			returnflag = false;
	
		}
	dateAdding();
	//	else
		//	if (document.navigationForm.filetype.value.length==0) {
		//		alert("Please select a file type.");
		//		document.navigationForm.filetype.focus();
		//		returnflag = false;
	//		}
		return returnflag;
	}


	function dateAdding()  {
		document.navigationForm.startDate.value= document.navigationForm.startmonth.value + "/"+ document.navigationForm.startday.value + "/" + document.navigationForm.startyear.value;
		document.navigationForm.endDate.value= document.navigationForm.endmonth.value + "/" + document.navigationForm.endday.value + "/" + document.navigationForm.endyear.value;
		alert(document.navigationForm.startDate.value);

}
	
	
function setLogoIdAndAction(logoId,logoAction,newFilePathValue,existingFilePathValue,url,existingUrl) {
		document.logo_admin.hiddenLogoId.value = logoId;		
		document.logo_admin.hiddenLogoAction.value = logoAction;

		//newFilePathValue = removeWhitespace(newFilePathValue);
		//url = removeWhitespace(url);

		var tmpLogoFilePath = stripSpaces(newFilePathValue);
		url = stripSpaces(url);

		if (tmpLogoFilePath.length > 0) {
			document.logo_admin.hiddenFilePath.value = tmpLogoFilePath;
			document.logo_admin.hiddenFileStatus.value = "filePath";
			if (tmpLogoFilePath.indexOf(":\\") < 0) {
				document.logo_admin.hiddenFilePathType.value = "virtualPath";
			}
		}
		else {
			document.logo_admin.hiddenFilePath.value = existingFilePathValue;
			document.logo_admin.hiddenFileStatus.value = "existingPath";
		}			
		if (url.length > 0) {
			document.logo_admin.hiddenUrl.value = url;
		}
		else {
			document.logo_admin.hiddenUrl.value = existingUrl;
		}
		
	}
	
	
/*
     Modified on 12/15 to check for single quote and double quotes 

	function verifyLogoAdministration() {
		var returnValue = true;
		if (document.logo_admin.hiddenLogoAction.value == 'insert') {	
			document.logo_admin.filePath0.value = removeWhitespace(document.logo_admin.filePath0.value);
			if (document.logo_admin.filePath0.value.length == 0) {	
				alert("You cannot add an empty logo path.");
				returnValue = false;
			}
		}
		
		if (document.logo_admin.hiddenUrl.value.length == 0) {
			alert("You cannot add an empty URL.");
			returnValue = false;	
		}		
		else if (document.logo_admin.hiddenUrl.value.indexOf("http://") < 0) {
				document.logo_admin.hiddenUrl.value = "http://" + document.logo_admin.hiddenUrl.value;
		}	
		else if (document.logo_admin.hiddenLogoAction.value == 'delete') {	
			if(!confirm("Are you sure you want to delete this logo?")) {
				returnValue = false;			
			}
		}
		return returnValue;
	}


*/


	function verifyLogoAdministration() {
		var returnValue = true;

		if (document.logo_admin.hiddenLogoAction.value == 'delete') {	
			if(!confirm("Are you sure you want to delete this logo?")) {
				returnValue = false;			
			}
                        return returnValue;
		}
                 
		if (document.logo_admin.hiddenLogoAction.value == 'insert') {	
			//document.logo_admin.filePath0.value = removeWhitespace(document.logo_admin.filePath0.value);
			//if (document.logo_admin.filePath0.value.length == 0) {	

                        var tmpLogoFilePath = stripSpaces(document.logo_admin.filePath0.value);
			if (tmpLogoFilePath.length == 0) {	
				alert("You cannot add an empty logo path.");
				returnValue = false;
			} 
		}

		
		if (document.logo_admin.hiddenUrl.value.length == 0) {
			alert("You cannot add an empty URL.");
			returnValue = false;	
		} else if (checkCharacter(document.logo_admin.hiddenUrl.value,"'") ||
                           checkCharacter(document.logo_admin.hiddenUrl.value,'"')) {
                        alert("Please specify a valid URL. (Single and Double quotes are not allowed)");		
                        returnValue = false;
                } else if (document.logo_admin.hiddenUrl.value.indexOf("http://") < 0) {
				document.logo_admin.hiddenUrl.value = "http://" + document.logo_admin.hiddenUrl.value;
		}	
		return returnValue;
	}






function verifyInputAccessAdmin ()  {
		var returnflag = true;
		if (document.access_admin_form.username.value.length==0) {
			alert("Please enter your user name.");
			document.access_admin_form.username.focus();
			returnflag = false;
		}
		else
			if (document.access_admin_form.password.value.length==0) {
				alert("Please enter your password.");
				document.access_admin_form.password.focus();
				returnflag = false;
			}
		return returnflag;
	}

function buttonType(typeId,type)  {
	
	document.feedback_admin_form.feedbackId.value =typeId;
	document.feedback_admin_form.feedbacktype.value = stripSpaces(type);
	//document.feedback_admin_form.feedbacktype.value = removeWhitespace(type);
	//document.feedback_admin_form.feedbacktype.value = removeAllWhiteSpace(document.feedback_admin_form.feedbacktype.value);
	document.feedback_admin_form.action.value="Update";

        if (checkCharacter(document.feedback_admin_form.feedbacktype.value,"'")) {
            alert("Please specify a valid feedback type. (Single quote and double quotes are not allowed)");
            return;
        }
        if (checkCharacter(document.feedback_admin_form.feedbacktype.value,'"')) {
            alert("Please specify a valid feedback type. (Single quote and double quotes are not allowed)");
            return;
        }


	if (document.feedback_admin_form.feedbacktype.value.length==0) {
		alert("You cannot add an empty Feedback Type.");
	}
	else {
		var temp1 = document.feedback_admin_form.feedbacktype.value +"";
		var tempStr = temp1.substring(0,1);
		tempStr = tempStr.toUpperCase();
		var restStr = temp1.substring(1,temp1.length);
		document.feedback_admin_form.feedbacktype.value = tempStr + restStr;
		document.feedback_admin_form.submit();	
	}
		
}
 
function addType() {
	document.feedback_admin_form.type.value = stripSpaces(document.feedback_admin_form.type.value);

	//document.feedback_admin_form.type.value = removeWhitespace(document.feedback_admin_form.type.value);
	//document.feedback_admin_form.type.value = removeAllWhitespace(document.feedback_admin_form.type.value);

	if (document.feedback_admin_form.type.value.length==0) {
		alert("You cannot add an empty Feedback Type.");
                return;
	}

        if (checkCharacter(document.feedback_admin_form.type.value,"'")) {
            alert("Please specify a valid feedback type. (Single quote and double quotes are not allowed)");
            return;
        }

        if (checkCharacter(document.feedback_admin_form.type.value,'"')) {
            alert("Please specify a valid feedback type. (Single quote and double quotes are not allowed)");
            return;
        }
	

	var temp1 = document.feedback_admin_form.type.value +"";
	var tempStr = temp1.substring(0,1);
	tempStr = tempStr.toUpperCase();
	var restStr = temp1.substring(1,temp1.length);
	document.feedback_admin_form.type.value = tempStr + restStr;
	
	document.feedback_admin_form.action.value="Add Type";
	document.feedback_admin_form.submit();	
		
}

function buttonTypeId(typeId)  {
	
	document.feedback_admin_form.feedbackId.value =typeId;


		if (confirm("Are you sure you want to delete this Feedback type?")) {	
					
			document.feedback_admin_form.action.value="Delete";
			document.feedback_admin_form.submit();				

//	return true;	
		}
}

function changeArticles(theSectionId,clickedButton) {
	document.Email_Form.sectionId.value = theSectionId;
	submitEmailButton(clickedButton);
			
}

function submitEmailButton(theClickedButton) 
{
        if (theClickedButton == 'AddArticle') {
            if (document.Email_Form.Category.selectedIndex == 0 &&
                document.Email_Form.Article.selectedIndex == 0) {
                alert("Please select a category and an article.");
                return false;
            } else if (document.Email_Form.Category.selectedIndex == 0) {
                alert("Please select a category.");
                return false;
            } else if (document.Email_Form.Article.selectedIndex == 0) {
                alert("Please select an article.");
                return false;
            }
            document.Email_Form.eventSource.value = theClickedButton;
            document.Email_Form.submit();

        } else if (theClickedButton == 'BroadCastAdmin') {

		document.Email_Form.eventSource.value = theClickedButton;
		document.Email_Form.submit();

	} else {
		if(verifyInput()) {
			document.Email_Form.eventSource.value = theClickedButton;
			document.Email_Form.submit();
		}
	}
	return true;
}


function enableButton() {
		
	document.Email_Form.year.disabled=false;
	document.Email_Form.month.disabled=false;
	document.Email_Form.day.disabled=false;
	document.Email_Form.hour.disabled=false;
	document.Email_Form.minute.disabled=false;
	document.Email_Form.batchcount.disabled=false;
	document.Email_Form.broadcastname.disabled=false;
	document.Email_Form.intervalfield.disabled=false;		
}
function disableButton() {
		
	document.Email_Form.year.disabled=true;
	document.Email_Form.month.disabled=true;
	document.Email_Form.day.disabled=true;
	document.Email_Form.hour.disabled=true;
	document.Email_Form.minute.disabled=true;
	document.Email_Form.batchcount.disabled=true;
	document.Email_Form.broadcastname.disabled=true;
}

 
/*function verifyInput ()  {	
	if (document.Email_Form.schedule[1].checked && document.Email_Form.broadcastname.value.length==0) {
		alert("Please enter the Broadcast title.");
		document.Email_Form.broadcastname.focus();
		return false;
	}
	if (document.Email_Form.subject.value.length==0 ) {
		alert("Please enter the Email subject.");
		document.Email_Form.subject.focus();
		return false;
	}
	if (document.Email_Form.message.value.length>=4000 ) {
		alert("Message body should not exceed 4000 characters.");
		document.Email_Form.message.focus();
		return false;
	}
	
  if (!isSelected(document.Email_Form.state)) {
          alert("Please select one or more states.");
          document.Email_Form.state.focus();
          return false;
  }
  if (!isSelected(document.Email_Form.zipcodes)) {
          alert("Please select one or more zip codes.");
          document.Email_Form.zipcodes.focus();
          return false;
  }
  if (!isSelected(document.Email_Form.preferences)) {
          alert("Please select one or more subscriber preferences.");
          document.Email_Form.preferences.focus();
          return false;
  }
  if (!isSelected(document.Email_Form.usercategories)) {
          alert("Please select one or more user categories.");
          document.Email_Form.usercategories.focus();
          return false;
  }
    
  	document.Email_Form.batchcount.value = removeWhitespace(document.Email_Form.batchcount.value);	
	if (document.Email_Form.schedule[1].checked && (document.Email_Form.batchcount.value.length==0 || isNaN(document.Email_Form.batchcount.value) || parseInt(document.Email_Form.batchcount.value)<=0)) {
		alert("Please enter a valid Batch Count for the schedule.");
		document.Email_Form.batchcount.focus();
		return false;
	}
	
		
	if (document.Email_Form.schedule[1].checked) {
		var monthScaled = todaysMonth -1; // dropdown is on a scale from 0-11	

		indexyear=document.Email_Form.year.selectedIndex;
		yearselected=document.Email_Form.year.options[indexyear].text;

		indexmonth=document.Email_Form.month.selectedIndex;
		monthselected=document.Email_Form.month.options[indexmonth].text;

		indexday=document.Email_Form.day.selectedIndex;
		dayselected=document.Email_Form.day.options[indexday].text;

		indexhour=document.Email_Form.hour.selectedIndex;
		hourselected=document.Email_Form.hour.options[indexhour].text;

		indexminute=document.Email_Form.minute.selectedIndex;
		minuteselected=document.Email_Form.minute.options[indexminute].text;

		if (todaysYear>yearselected) {
			alert ("You are attempting to send an email broadcast in the past. Please enter a valid date/time.");
			document.Email_Form.year.focus();
			return false;
		}
		if (todaysYear==yearselected && monthScaled>monthselected) {
			alert ("You are attempting to send an email broadcast in the past. Please enter a valid date/time.");
			document.Email_Form.month.focus();
			return false;
		}
		if (todaysYear==yearselected && monthScaled==monthselected && todaysDay>dayselected) {
			alert ("You are attempting to send an email broadcast in the past. Please enter a valid date/time.");
			document.Email_Form.day.focus();
			return false;
		}
		if (todaysYear==yearselected && monthScaled==monthselected && todaysDay>dayselected && currHour>hourselected) {
			alert ("You are attempting to send an email broadcast in the past. Please enter a valid date/time.");
			document.Email_Form.hour.focus();
			return false;
		}
		if (todaysYear==yearselected && monthScaled==monthselected && todaysDay>dayselected && currHour>hourselected && currMin>minuteselected) {
			alert ("You are attempting to send an email broadcast in the past. Please enter a valid date/time.");
			document.Email_Form.minute.focus();
			return false;
		}
	}

	return true;
} */
function verifyInput ()  {	
	document.Email_Form.subject.value = 	stripSpaces(document.Email_Form.subject.value);
	document.Email_Form.message.value = 	stripSpaces(document.Email_Form.message.value);
	document.Email_Form.batchcount.value = 	stripSpaces(document.Email_Form.batchcount.value);
	document.Email_Form.broadcastname.value = stripSpaces(document.Email_Form.broadcastname.value);
	if (document.Email_Form.schedule[1].checked && document.Email_Form.broadcastname.value.length==0) {
		alert("Please enter the Broadcast title.");
		document.Email_Form.broadcastname.focus();
		return false;
	}
	if (document.Email_Form.subject.value.length==0 ) {
		alert("Please enter the Email subject.");
		document.Email_Form.subject.focus();
		return false;
	}
	if (checkCharacter(document.Email_Form.subject.value,'"'))  {
		alert("No double quotes allowed in Email subject.");
		document.Email_Form.subject.focus();
		return false;
	}
	if (checkCharacter(document.Email_Form.message.value,'"'))  {
		alert("No double quotes allowed in Email message.");
		document.Email_Form.message.focus();
		return false;
	}
	if (document.Email_Form.message.value.length>=4000 ) {
		alert("Message body should not exceed 4000 characters.");
		document.Email_Form.message.focus();
		return false;
	}
	if (document.Email_Form.message.value.length==0 ) {
		alert("Message text must be entered.");
		document.Email_Form.message.focus();
		return false;
	}
	
	
	
  if (!isSelected(document.Email_Form.state)) {
          alert("Please select one or more states.");
          document.Email_Form.state.focus();
          return false;
  }
  if (!isSelected(document.Email_Form.zipcodes)) {
          alert("Please select one or more zip codes.");
          document.Email_Form.zipcodes.focus();
          return false;
  }
  if (!isSelected(document.Email_Form.preferences)) {
          alert("Please select one or more subscriber preferences.");
          document.Email_Form.preferences.focus();
          return false;
  }
  if (!isSelected(document.Email_Form.usercategories)) {
          alert("Please select one or more user categories.");
          document.Email_Form.usercategories.focus();
          return false;
  }
    
  	document.Email_Form.batchcount.value = removeWhitespace(document.Email_Form.batchcount.value);
	if (document.Email_Form.schedule[1].checked && (document.Email_Form.batchcount.value.length==0 || isNaN(document.Email_Form.batchcount.value) || parseInt(document.Email_Form.batchcount.value)<=0)) {
		alert("Please enter a valid Batch Count for the schedule.");
		document.Email_Form.batchcount.focus();
		return false;
	}
	
	if (document.Email_Form.schedule[1].checked) {
		var monthScaled = todaysMonth -1; // dropdown is on a scale from 0-11	

		indexyear=document.Email_Form.year.selectedIndex;
		yearselected=document.Email_Form.year.options[indexyear].text;

		indexmonth=document.Email_Form.month.selectedIndex;
		monthselected=document.Email_Form.month.options[indexmonth].text;

		indexday=document.Email_Form.day.selectedIndex;
		dayselected=document.Email_Form.day.options[indexday].text;

		indexhour=document.Email_Form.hour.selectedIndex;
		hourselected=document.Email_Form.hour.options[indexhour].text;

		indexminute=document.Email_Form.minute.selectedIndex;
		minuteselected=document.Email_Form.minute.options[indexminute].text;
		
		if (todaysYear>yearselected) {
			alert ("You are attempting to send an email broadcast in the past. Please enter a valid date/time.");
			document.Email_Form.year.focus();
			return false;
		}
		if (todaysYear==yearselected && monthScaled>monthselected) {
			alert ("You are attempting to send an email broadcast in the past. Please enter a valid date/time.");
			document.Email_Form.month.focus();
			return false;
		}
		if (todaysYear==yearselected && monthScaled==monthselected && todaysDay>dayselected) {
			alert ("You are attempting to send an email broadcast in the past. Please enter a valid date/time.");
			document.Email_Form.day.focus();
			return false;
		}
		if (todaysYear==yearselected && monthScaled==monthselected && todaysDay>dayselected && currHour>hourselected) {
			alert ("You are attempting to send an email broadcast in the past. Please enter a valid date/time.");
			document.Email_Form.hour.focus();
			return false;
		}
		if (todaysYear==yearselected && monthScaled==monthselected && todaysDay>dayselected && currHour>hourselected && currMin>minuteselected) {
			alert ("You are attempting to send an email broadcast in the past. Please enter a valid date/time.");
			document.Email_Form.minute.focus();
			return false;
		}
		
		if (checkCharacter(document.Email_Form.broadcastname.value,'"') || checkCharacter(document.Email_Form.broadcastname.value,"'"))  {
			alert("Please enter a valid broadcast title.  Single quote and double quotes are not allowed.");
			document.Email_Form.message.focus();
			return false;
		}
		
			
	}

	document.Email_Form.intervalfield.value = removeWhitespace(document.Email_Form.intervalfield.value);
	if (document.Email_Form.schedule[1].checked && !isNumeric(document.Email_Form.intervalfield.value))  {
		alert("Please enter numeric value for Batch interval field.  If unsure, leave it to 1.");
		document.Email_Form.intervalfield.focus();
		return false;
	}
	
	return true;
}
function changeDetails(theBroadcastId,clickedButton) {

	document.BroadAdmin_Form.broadcastId.value = theBroadcastId;
	submitBroadcastButton(clickedButton);
			
}
function submitBroadcastButton(theClickedButton) {
	if(verifyInputButton(theClickedButton)) {
		document.BroadAdmin_Form.eventSource.value = theClickedButton;
		document.BroadAdmin_Form.submit();
	}
}

function verifyInputButton (theClickedButton)  {
		
	if(theClickedButton=='Update' || theClickedButton=='Delete') {
		if (document.BroadAdmin_Form.Category.options[document.BroadAdmin_Form.Category.selectedIndex].value.length==0) { 
			alert("No Broadcasts to Update or Delete.");
			document.BroadAdmin_Form.Category.focus();
			return false;
		}
	}
	
	if(theClickedButton=='Delete') {
		if (!confirm("Are you sure you wish to delete this broadcast?")) {
			return false;

		}
                 return true;
	}
	
	if(theClickedButton!='OnClick') {
		document.BroadAdmin_Form.year.value = removeWhitespace(document.BroadAdmin_Form.year.value);		
		if(document.BroadAdmin_Form.year.value.length==0 || isNaN(document.BroadAdmin_Form.year.value)) {
			alert("Please enter a valid year.");
			document.BroadAdmin_Form.year.focus();
			return false;
		}
				
		document.BroadAdmin_Form.month.value = removeWhitespace(document.BroadAdmin_Form.month.value);		
		if(document.BroadAdmin_Form.month.value.length==0 || isNaN(document.BroadAdmin_Form.month.value)) {
			alert("Please enter a valid month.");
			document.BroadAdmin_Form.month.focus();
			return false;
		}
	
		document.BroadAdmin_Form.day.value = removeWhitespace(document.BroadAdmin_Form.day.value);			
		if(document.BroadAdmin_Form.day.value.length==0 || isNaN(document.BroadAdmin_Form.day.value)) {
			alert("Please enter a valid day.");
			document.BroadAdmin_Form.day.focus();
			return false;
		}

		document.BroadAdmin_Form.hour.value = removeWhitespace(document.BroadAdmin_Form.hour.value);			
		if(document.BroadAdmin_Form.hour.value.length==0 || isNaN(document.BroadAdmin_Form.hour.value)) {
			alert("Please enter a valid hour.");
			document.BroadAdmin_Form.hour.focus();
			return false;
		}
				
		document.BroadAdmin_Form.minute.value = removeWhitespace(document.BroadAdmin_Form.minute.value);			
		if(document.BroadAdmin_Form.minute.value.length==0 || isNaN(document.BroadAdmin_Form.minute.value)) {
			alert("Please enter a valid minute.");
			document.BroadAdmin_Form.minute.focus();
			return false;
		}
	
		var todaysMonthGlobal = parseInt(todaysDateGlobal.substring(0,todaysDateGlobal.indexOf("-")));
		var tempStr = todaysDateGlobal.substring(todaysDateGlobal.indexOf("-")+1,todaysDateGlobal.length);
		var todaysDayGlobal = parseInt(tempStr.substring(0,tempStr.indexOf("-")));
		var todaysYearGlobal = parseInt(tempStr.substring(tempStr.indexOf("-")+1,tempStr.length));
	
		if (todaysYearGlobal>document.BroadAdmin_Form.year.value || 
			 (todaysYearGlobal==document.BroadAdmin_Form.year.value && todaysMonthGlobal>document.BroadAdmin_Form.month.value) || 
			 (todaysYearGlobal==document.BroadAdmin_Form.year.value && todaysMonthGlobal==document.BroadAdmin_Form.month.value && todaysDayGlobal>document.BroadAdmin_Form.day.value) || 
			 (todaysYearGlobal==document.BroadAdmin_Form.year.value && todaysMonthGlobal==document.BroadAdmin_Form.month.value && todaysDayGlobal==document.BroadAdmin_Form.day.value && currHour>document.BroadAdmin_Form.hour.value) ||
			 (todaysYearGlobal==document.BroadAdmin_Form.year.value && todaysMonthGlobal==document.BroadAdmin_Form.month.value && todaysDayGlobal==document.BroadAdmin_Form.day.value && currHour==document.BroadAdmin_Form.hour.value && currMin>document.BroadAdmin_Form.minute.value)) {
			alert("You are attempting to broadcast a message in the past, please edit date.");
			document.BroadAdmin_Form.year.focus();
			return false;
		}
	}
	return true;
}


function ArticleReportShowAll () {
	document.articleReport.author.options[0].selected = true;
	document.articleReport.category.options[0].selected = true;
	document.articleReport.publishDate.options[0].selected = true;
	document.articleReport.articleFields.options[0].selected = true;
	document.articleReport.startMonth.options[0].selected = true;
	document.articleReport.endMonth.options[0].selected = true;
	document.articleReport.submit();
}


function verifyArticleReport () {
	var boolAuthorSelected = false;
	var boolCategorySelected = false;
	var boolPubDateSelected = false;
	var boolFieldsSelected = false;	
	for (i=0;i<document.articleReport.author.length;i++) {
		if (document.articleReport.author.options[i].selected) {
			boolAuthorSelected = true;
		}
	}
	if (!boolAuthorSelected) {
		alert("Please select an author.");
		document.articleReport.author.focus();	
		return false;	
	}
	for (i=0;i<document.articleReport.category.length;i++) {
		if (document.articleReport.category.options[i].selected) {
			boolCategorySelected = true;
		}
	}
	if (!boolCategorySelected) {
		alert("Please select a category.");
		document.articleReport.category.focus();	
		return false;	
	}

	if (document.articleReport.whichdate[0].checked) {
	
	for (i=0;i<document.articleReport.publishDate.length;i++) {
		if (document.articleReport.publishDate.options[i].selected) {
			
			boolPubDateSelected = true;
		}
	}
	}
	
	if (boolPubDateSelected) { //boolPubDateSelected
		document.articleReport.endDay.options[0].selected = true;
		document.articleReport.startDay.options[0].selected = true;
	}
	for (i=0;i<document.articleReport.articleFields.length;i++) {
		if (document.articleReport.articleFields.options[i].selected) {
			boolFieldsSelected = true;
		}
	}
	if (!true) {
		alert("Please select an article field.");
		document.articleReport.articleFields.focus();	
		return false;	
	}
}

function removeWhitespace(fieldValue)	{
		var returnString = "";	
		returnString = fieldValue;
		if (returnString.charAt(0) == " ")	{
			while(returnString.charAt(0) == " ")	{
				returnString = returnString.substring(1,fieldValue.length);
			}
		}
		return returnString;
	}

function removeAllWhitespace(fieldValue)	{
		var returnString = "";	
		returnString = fieldValue;
		if (returnString.length>0 && returnString.charAt((returnString.length)-1) == " ")	{
			while(returnString.charAt((returnString.length)-1) == " ")	{
				if (returnString.length>2) {
					returnString = returnString.substring(0,(returnString.length)-2);
				}
				else {
					returnString = returnString.substring(0,(returnString.length)-1);
				}
			}
		}
		return returnString;
	}

	function setSubscriberTypeIdAndAction(subscriberTypeId,subscriberTypeAction,field) {
		field = stripSpaces(field);
		//field = removeWhitespace(field);
		document.user_category.hiddenSubscriberTypeId.value = subscriberTypeId;		
		document.user_category.hiddenSubscriberTypeAction.value = subscriberTypeAction;
		//document.user_category.hiddenSubscriberTypeName.value = removeAllWhitespace(field);
		document.user_category.hiddenSubscriberTypeName.value = field;
                if (checkCharacter(field,"'") && subscriberTypeAction != 'delete') {
                    alert("Please specify a valid subscriber type. (Single quote and double quotes are not allowed)");
                    return;
                }
                if (checkCharacter(field,'"') && subscriberTypeAction != 'delete') {
                    alert("Please specify a valid subscriber type. (Single quote and double quotes are not allowed)");
                    return;
                }

		if (field.length == 0 && subscriberTypeAction != 'delete') {	
			alert("You cannot add an empty subscriber type.");
		}
		else {
			if (document.user_category.hiddenSubscriberTypeAction.value == 'delete') {	
				if (confirm("Are you sure you want to delete this category?")) {	
					document.user_category.submit();	
				}
			}
			else
				document.user_category.submit();	
		}
	}
	
	function verifyUserCategory() {
		var returnValue = true;
		if (document.user_category.hiddenSubscriberTypeAction.value == 'insert') {	
			if (document.user_category.subscriberTypeName0.value.length == 0) {	
				alert("You cannot add an empty subscriber type.");
				returnValue = false;
			}
		}
		
		return returnValue;
	}
// Change Management: This function has been replaced with a new version. Date: 12-15-2000 	
/* function verifyInputFeedback ()  {
	var returnflag = true;
	if (false) {
		alert("Please enter your first name.");
		document.feedbackForm.firstname.focus();
		returnflag = false;
	}
	else
		if (false) {
			alert("Please enter your last name.");
			document.feedbackForm.lastname.focus();
			returnflag = false;
		}
		else
			if (document.feedbackForm.email.value.length==0) {
				alert("Please enter your email address.");
				document.feedbackForm.email.focus();
				returnflag = false;
			}			
			else
				if (emailCheckFeedback(document.feedbackForm.email)) {
					document.feedbackForm.email.focus();
					returnflag = false;
				}		
				else
					if (document.feedbackForm.message.value.length==0) {
						alert("Please provide a question and/or comment.");
						document.feedbackForm.message.focus();
						returnflag = false;
					}		
	return returnflag;
} */

function verifyInputFeedback ()  {
	var returnflag = true;
	
	document.feedbackForm.email.value = 	stripSpaces(document.feedbackForm.email.value);
	document.feedbackForm.message.value = 	stripSpaces(document.feedbackForm.message.value);
	document.feedbackForm.firstname.value = stripSpaces(document.feedbackForm.firstname.value);
	document.feedbackForm.lastname.value = 	stripSpaces(document.feedbackForm.lastname.value);
	if (false) {
		alert("Please enter your first name.");
		document.feedbackForm.firstname.focus();
		returnflag = false;
	}
	else
		if (false) {
			alert("Please enter your last name.");
			document.feedbackForm.lastname.focus();
			returnflag = false;
		}
		else
			if (document.feedbackForm.email.value.length==0) {
				alert("Please enter your email address.");
				document.feedbackForm.email.focus();
				returnflag = false;
			}			
			else 
				if (document.feedbackForm.category.options[document.feedbackForm.category.selectedIndex].value=="") {
				alert("No category selected.");
				document.feedbackForm.category.focus();
				returnflag = false;
			} 
	/*		else
			Email validated on server		
				if (emailCheckFeedback(document.feedbackForm.email)) {
					document.feedbackForm.email.focus();
					returnflag = false;
				}*/		
				else
					if (document.feedbackForm.message.value.length==0) {
						alert("Please provide a question and/or comment.");
						document.feedbackForm.message.focus();
						returnflag = false;
					}	
					
	return returnflag;
}

function emailCheckFeedback(emailAddress) {
	var returnFlag = false;
	if (emailAddress.value.indexOf("@")<1) {
		alert("This email address seems wrong. \nPlease check the prefix and '@' sign.");
		returnFlag = true;
	}
	else
		if ((emailAddress.value.indexOf(".com")<5)&&(emailAddress.value.indexOf(".org")<5)&&(emailAddress.value.indexOf(".gov")<5)&&(emailAddress.value.indexOf(".net")<5)&&(emailAddress.value.indexOf(".mil")<5)&&(emailAddress.value.indexOf(".edu")<5)){
			alert("This email address seems wrong. \nPlease check the suffix for accuracy. \n(It should include a .com, .edu, .net, .org, .gov or .mil)");
			returnFlag = true;
		}
	return returnFlag;
}
	
function verifySearch() {
		var returnflag = true;
                document.search.searchvalue.value = stripSpaces(document.search.searchvalue.value);
//		document.search.searchvalue.value = removeWhitespace(document.search.searchvalue.value);	// remove leading spaces
//		document.search.searchvalue.value = removeAllWhitespace(document.search.searchvalue.value);	 // remove trailing spaces
		//var searchValue = removeWhitespace(document.search.searchvalue.value);	
		var searchValue = document.search.searchvalue.value;	
		var searchValueLower = searchValue.toLowerCase();
		var dateFrom;
		var dateTo;
		var dateCompare;
		var x = -1;
		if (document.search.hiddensearchtype.value == "issuedate") {
			if(searchValue.lastIndexOf("or") > 0 || searchValue.lastIndexOf("and") > 0) { // boolean search
				document.search.hiddenDateFrom.value = searchValue;
				document.search.hiddenDateSearchType.value = "boolean";
			}
			else if(searchValue.lastIndexOf(" - ") > 5) {		// two dates
				document.search.hiddenDateSearchType.value = "multiple";
				dateFrom = searchValue.slice(0,searchValue.lastIndexOf(" - "));
				dateTo = searchValue.slice(searchValue.lastIndexOf(" - ") + 3,searchValue.length);
				if (!verifyDateSearch(dateTo) && !verifyDateSearch(dateTo)) {
					alert("Date ranges must be entered as MM/DD/YYYY - MM/DD/YYYY.");
					document.search.searchvalue.focus();
					returnflag = false;
				}
				else {
					document.search.hiddenDateFrom.value = dateFrom;
					document.search.hiddenDateTo.value = dateTo;
				}
			}
			else if(searchValue.indexOf("<") == 0 || searchValue.indexOf(">") == 0) { // greater/less than date
				if (searchValue.indexOf("<") == 0) {
					document.search.hiddenDateSearchType.value = "lessThan";
				}
				if (searchValue.indexOf(">") == 0) {
					document.search.hiddenDateSearchType.value = "greaterThan";
				}
				dateCompare	= removeWhitespace(searchValue.slice(1,searchValue.length));
				searchValueLower = dateCompare.toLowerCase();
				if (searchValueLower.indexOf("jan") >= 0 || searchValueLower.indexOf("feb") >= 0 || searchValueLower.indexOf("mar") >= 0 || searchValueLower.indexOf("apr") >= 0 || searchValueLower.indexOf("may") >= 0 || searchValueLower.indexOf("jun") >= 0 || searchValueLower.indexOf("jul") >= 0 || searchValueLower.indexOf("aug") >= 0 || searchValueLower.indexOf("sep") >= 0 || searchValueLower.indexOf("oct") >= 0 || searchValueLower.indexOf("nov") >= 0 || searchValueLower.indexOf("dec") >= 0) {
					var monthNumber = 0;
					var y = searchValueLower.indexOf(" ");
					var g = searchValueLower.indexOf(",");
					var dy = searchValueLower.substring(y+1,g);
					var yr = searchValueLower.substring(g+1,searchValueLower.length)
					if (y>=0 && g>=0 && !isNaN(dy) && !isNaN(yr)) {
						monthNumber = getMonthNumberSearch(searchValueLower.substring(0,y));
						document.search.hiddenDateFrom.value = monthNumber + "-" + dy + "-" + yr;
						//alert(document.search.hiddenDateFrom.value);
					}
					else {
						alert("Date must be entered as MM/DD/YYYY or Month Year.");
						document.search.searchvalue.focus();
						returnflag = false;
					}
				}
				else {	
					if (!verifyDateSearch(dateCompare)) { 
						alert("Date must be entered as MM/DD/YYYY or Month Year.");
						document.search.searchvalue.focus();
						returnflag = false;
					}			
					else {
						document.search.hiddenDateFrom.value = dateCompare;
					}
				}
			}
			else { //one date
				if (searchValueLower.indexOf("jan") >= 0 || searchValueLower.indexOf("feb") >= 0 || searchValueLower.indexOf("mar") >= 0 || searchValueLower.indexOf("apr") >= 0 || searchValueLower.indexOf("may") >= 0 || searchValueLower.indexOf("jun") >= 0 || searchValueLower.indexOf("jul") >= 0 || searchValueLower.indexOf("aug") >= 0 || searchValueLower.indexOf("sep") >= 0 || searchValueLower.indexOf("oct") >= 0 || searchValueLower.indexOf("nov") >= 0 || searchValueLower.indexOf("dec") >= 0) {
					document.search.hiddenDateSearchType.value = "written";			
					x = searchValueLower.indexOf(" ");						
					if (searchValueLower.indexOf(",") >= 0) {	
						x = searchValueLower.indexOf(",");
					}
					if (x<0) { 
						alert("Date must be entered as MM/DD/YYYY or Month Year.");
						document.search.searchvalue.focus();
						returnflag = false;
					}		
					else {
						document.search.hiddenDateMonth.value = getMonthNumberSearch(searchValueLower.substring(0,x));	
						document.search.hiddenDateYear.value = removeWhitespace(searchValueLower.substring(x+1,searchValueLower.length));	
					}
				}
				
				else {
					document.search.hiddenDateSearchType.value = "single";
	 				if (!verifyDateSearch(searchValue)) { 
						alert("Date must be entered as MM/DD/YYYY or Month Year.");
						document.search.searchvalue.focus();
						returnflag = false;
					}		
					else {
						document.search.hiddenDateFrom.value = searchValue;
					}
				}
			}
		}
		else
			if (document.search.searchvalue.value.length == 0) {
				alert("Please enter a search string.");
				document.search.searchvalue.focus();
				returnflag = false;
			}
			
		return returnflag;
	}		
	
	function getMonthNumberSearch(monthName) {
		if (monthName.indexOf("jan")>=0)	
			return 1;
		else if (monthName.indexOf("feb")>=0)	
			return 2;
		else if (monthName.indexOf("mar")>=0)	
			return 3;
		else if (monthName.indexOf("apr")>=0)	
			return 4;
		else if (monthName.indexOf("may")>=0)	
			return 5;
		else if (monthName.indexOf("jun")>=0)	
			return 6;
		else if (monthName.indexOf("jul")>=0)	
			return 7;
		else if (monthName.indexOf("aug")>=0)	
			return 8;
		else if (monthName.indexOf("sep")>=0)	
			return 9;
		else if (monthName.indexOf("oct")>=0)	
			return 10;
		else if (monthName.indexOf("nov")>=0)	
			return 11;
		else if (monthName.indexOf("dec")>=0)	
			return 12;
		else 	
			return 0;
	}

	
	function setHiddenSearchType(index) {
		document.search.hiddensearchtype.value = index;
		return;
	}
	
	function verifyDateSearch(dateStringValue) {
		var inDateString = new String(dateStringValue);	//new string w/ date
		var delimiterCharacter;                          //splits up string
		var indexCtr;																									  //false if indexed
		var	indexAbs;																									  //date is NaN
						
		if ( inDateString.indexOf ('/') > 0 ) {      //based on delimiter
			delimiterCharacter = '/';					//of "/" or "-"
		}
		else {																													  //and returns false
			if ( inDateString.indexOf ('-') > 0 )	{	//if any other
				delimiterCharacter = '-';
			}
			else {
				return false;
			}
		}
		
		var	indexedDate = inDateString.split(delimiterCharacter);	//date string w/
																																  //[0]=mm  [1]=dd  [2]=yy	
		if ( indexedDate.length !=  3 )								//false if no dd or yy
			return false;
		
		for  (indexCtr = 0; indexCtr < indexedDate.length; indexCtr++)	{
			indexAbs = Math.abs(indexedDate[indexCtr]);
			if (isNaN(indexAbs) || indexAbs == 0)
				return false;
		}
		
		if (indexedDate[2].length != 4) {
			return false;
		}
		
		if (indexedDate[0] > 12 || indexedDate[1] > 31 || indexedDate[1] < 0) {
			return false;
		}			
							 
		return true;																									  //otherwise date is ok		
	}
	
	
function MakeNewWindow(it, num,wid) {	
	var src, newWindow;
	src="help.jsp?helpId=" + it;			
	newWindow=window.open(src,"","status,height=" + num + ",width=" + wid + ",screenY=40,top=40,resizable,scrollbars=YES");
	newWindow.focus();	       
}

function MakeNewWindow2(it, num, wid) {	
	var src, newWindow;
	src="help.jsp?helpId=" + it;			
	newWindow=window.open(src,"","status,height=" + num + ",width=" + wid + ",screenY=40,top=40,resizable");
	newWindow.focus();	       
}
function MM_preloadImages() { //v2.0
  if (document.images) {
    var imgFiles = MM_preloadImages.arguments;
    if (document.preloadArray==null) document.preloadArray = new Array();
    var i = document.preloadArray.length;
    with (document) for (var j=0; j<imgFiles.length; j++) if (imgFiles[j].charAt(0)!="#"){
      preloadArray[i] = new Image;
      preloadArray[i++].src = imgFiles[j];
  } }
}

function MM_swapImgRestore() { //v2.0
  if (document.MM_swapImgData != null)
    for (var i=0; i<(document.MM_swapImgData.length-1); i+=2)
      document.MM_swapImgData[i].src = document.MM_swapImgData[i+1];
}

function MM_swapImage() { //v2.0
  var i,j=0,objStr,obj,swapArray=new Array,oldArray=document.MM_swapImgData;
  for (i=0; i < (MM_swapImage.arguments.length-2); i+=3) {
    objStr = MM_swapImage.arguments[(navigator.appName == 'Netscape')?i:i+1];
    if ((objStr.indexOf('document.layers[')==0 && document.layers==null) ||
        (objStr.indexOf('document.all[')   ==0 && document.all   ==null))
      objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length);
    obj = eval(objStr);
    if (obj != null) {
      swapArray[j++] = obj;
      swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.src:oldArray[j];
      obj.src = MM_swapImage.arguments[i+2];
  } }
  document.MM_swapImgData = swapArray; //used for restore
}

function createPopup(question,height,width,target) {	
	var src, newWindow;
	src=target;;			
	newWindow=window.open(src,"","status,height=" + height + ",width=" + width + ",screenY=80,top=80,resizable,scrollbars");
	newWindow.focus();	       
}
function isNumeric(sText)
{
	var VALIDCHARS = "0123456789";
	var oneChar;
	var returnBoolean = true;

	for (i = 0; i < sText.length && returnBoolean == true; i++)
	{
		oneChar = sText.charAt(i);
		if (VALIDCHARS.indexOf(oneChar) == -1)
		{
			returnBoolean = false;
		}
	}
	return returnBoolean;
}