function verifyDate(){
	var lbooNullOrdDate,lstrOrdDayEnd,lstrOrdDayStart,lstrOrdMonthStart,lstrMsg;
	var lstrOrdMonthEnd,lstrOrdYearStart,lbooStartDateError,lbooEndDateError,lstrEndDateError;
	var lbooNullEmailDate,lbooEmailDateError,lstrEmailMonthStart,lstrEmailDayStart,lstrEmailYearStart;
	var lstrMsg = new String("");
	var larrMonths = new Array;
	larrMonths["Jan"]= "31";
	larrMonths["Feb"]= "28";
	larrMonths["Mar"]= "31";
 	larrMonths["Apr"]= "30";
	larrMonths["May"]= "31";
	larrMonths["Jun"]= "30";
	larrMonths["Jul"]= "31";
	larrMonths["Aug"]= "31";
	larrMonths["Sep"]= "30";
	larrMonths["Oct"]= "31";
	larrMonths["Nov"]= "30";
	larrMonths["Dec"]= "31";

	if(document.frmInvestorSelection.txtOrdCritDayStart.value + document.frmInvestorSelection.txtOrdCritYearStart.value + document.frmInvestorSelection.txtOrdCritDayEnd.value + document.frmInvestorSelection.txtOrdCritYearEnd.value == ""){
		lbooNullOrdDate = true;
		document.frmInvestorSelection.booOrderDate.checked = false;
		chkUndo(document.frmInvestorSelection.booOrderDate,"radOrderDate")
	}else{
		lbooNullOrdDate = false;
	}		
	if(document.frmInvestorSelection.booOrderDate.checked == true){
		lstrOrdMonthStart = document.frmInvestorSelection.selOrdCritMonthStart.value;
		lstrOrdMonthEnd = document.frmInvestorSelection.selOrdCritMonthEnd.value;
		lstrOrdDayStart = document.frmInvestorSelection.txtOrdCritDayStart.value;
		lstrOrdDayEnd = document.frmInvestorSelection.txtOrdCritDayEnd.value;
		lstrOrdYearStart = document.frmInvestorSelection.txtOrdCritYearStart.value;
		lstrOrdYearEnd = document.frmInvestorSelection.txtOrdCritYearEnd.value;
		
		
		if((lstrOrdDayStart == "" || lstrOrdDayStart > larrMonths[lstrOrdMonthStart]|| lstrOrdDayStart < "0")|| (lstrOrdYearStart == "" || lstrOrdYearStart.length < 4)||(lstrOrdMonthStart =="")){
			lbooStartDateError = 1;
		}
		if((lstrOrdDayEnd == "" || lstrOrdDayEnd > larrMonths[lstrOrdMonthEnd])||(lstrOrdYearEnd == "" || lstrOrdYearEnd.length < 4)||(lstrOrdMonthEnd =="")){
			lbooEndDateError = 1;
		}						
		if (lbooStartDateError ==1 || lbooEndDateError){
			alert("Please enter valid dates for the investor's order date query.");
			document.frmInvestorSelection.txtOrdCritDayStart.focus();
			return false;
		}			
/*		if(document.frmInvestorSelection.radOrderDate[0].checked == false && document.frmInvestorSelection.radOrderDate[1].checked == false){
			alert("Please specify whether investor has or has not ordered within specified dates.");
			document.frmInvestorSelection.radOrderDate[0].focus();
			return false;
		}			
*/
	}
	
	if(document.frmInvestorSelection.txtEmailCritDayStart.value + document.frmInvestorSelection.txtEmailCritYearStart.value == ""){
		lbooNullEmailDate = true;
		document.frmInvestorSelection.booEmailDateCriteria.checked = false;
		chkUndo(document.frmInvestorSelection.booOrderDate,"radOrderDate")
	}else{
		lbooNullEmailDate = false;
	}			
		
	if(document.frmInvestorSelection.booEmailDateCriteria.checked == true){
		lstrEmailMonthStart = document.frmInvestorSelection.selEmailCritMonthStart.value;
		lstrEmailDayStart = document.frmInvestorSelection.txtEmailCritDayStart.value;
		lstrEmailYearStart = document.frmInvestorSelection.txtEmailCritYearStart.value;
		if((lstrEmailDayStart == "" || lstrEmailDayStart > larrMonths[lstrEmailMonthStart] || lstrEmailDay < "0" )||(lstrEmailYearStart == "" || lstrEmailYearStart.length < 4)||(lstrEmailMonthStart =="")){
			lbooEmailDateError = 1;
		}
		if (lbooEmailDateError ==1){
			alert("Please enter valid dates for the investor's last email query.");
			document.frmInvestorSelection.txtEmailCritDayStart.focus();
			return false;
		}			
		if(document.frmInvestorSelection.radEmailDateCriteria[0].checked == false && document.frmInvestorSelection.radEmailDateCriteria[1].checked == false){
			alert("Please specify whether investor has or has not been emailed since specified date.");
			document.frmInvestorSelection.radEmailDateCriteria[0].focus();
			return false;
		}					
	
	}

//		return true;
}

function mcmdHelp_onclick(vstrHelpFile,vstrLanguage) {
	var lstrHelpFile = "Help_" + vstrHelpFile +"_" + vstrLanguage + ".htm"
	newWindow = window.open(lstrHelpFile, "Help",'toolbar=no,titlebar=no,location=no,directories=no,scrollbars=yes,status=yes,menubar=no,resizable=yes');
	newWindow.focus();
}

function chkUndo(vbooCheckBox,vbooIdParam){
	if (vbooCheckBox.checked == false) {
		for (x = 0; x < document.frmInvestorSelection.length; x++) {
			if (document.frmInvestorSelection[x].name== vbooIdParam) {
				document.frmInvestorSelection[x].checked = false;
				document.frmInvestorSelection[x].selectedIndex = -1;
			}
  		}
   	}
}
function chkBoo(vchkCriteria,vbooCheckBox){
	if (vchkCriteria.checked == true){
		for (x = 0; x < document.frmInvestorSelection.length; x++) {
			if (document.frmInvestorSelection[x].name== vbooCheckBox) {
				document.frmInvestorSelection[x].checked = true;
			}
  		}

	}	
}
function clearText(vbooCheckBox,vtxtTextBox,vbooSubstring){
//	document.write("vtxtTextBox = " + vtxtTextBox + " vbooSubstring = " + vbooSubstring);
		for (x = 0; x < document.frmInvestorSelection.length; x++) {
		if (vbooCheckBox.checked == false) {
			if(vbooSubstring == "1"){
				if(document.frmInvestorSelection[x].name.indexOf(vtxtTextBox)>=0){
					document.frmInvestorSelection[x].oldvalue = document.frmInvestorSelection[x].value;
					document.frmInvestorSelection[x].value = "";
				}	
			}else{
				if (document.frmInvestorSelection[x].name == vtxtTextBox) {
					document.frmInvestorSelection[x].value = "";
				}
			}	
  		}else{
  				if(document.frmInvestorSelection[x].oldvalue){
  					document.frmInvestorSelection[x].value = document.frmInvestorSelection[x].oldvalue;
   				}
   		}		
   	}
}	
function selectActivate(robjSelect, rstrKey) {

// PARAMETERS:
//		robjSelect	 -> Object Reference to the list box
//		rstrKey			 -> The value in the list box that should be selected
	var rstrArray
	
	//select objects with multiple values are separated by ^* instead of the comma(,) that IIS
	//uses so that any names with commas wouldn't get messed up when the values are split
	if (rstrKey.indexOf("^*") >=0){
		rstrArray = rstrKey.split("^*");
	}else{
		rstrArray = "";
    }
	for (x = 0; x < robjSelect.length; x++) {
		if (robjSelect[x].type == "radio") {
			if (robjSelect[x].value == rstrKey) {
				robjSelect[x].checked = true;
			}
		}
		else {
			if (!(rstrArray == "")){
				for (var lintI=0; lintI <= rstrArray.length; lintI++){
					if (robjSelect.options[x].value == rstrArray[lintI]) {
						robjSelect.options[x].selected = true;
					}
				}		
			}else{	
				if (robjSelect.options[x].value == rstrKey) {
					robjSelect.selectedIndex = x;
				}
			}
		}
	}

} // selectActivate


function clearAll(vstrFormName){
	/*
		unfortunately using a reset button won't set the page elements to null if the user has
		preexisting values - when the page reloads, asp fills in the controls with the values in
		the database, which we don't want if the user chooses "Clear Search Criteria"
	*/	
	
	
	for (x = 0; x < vstrFormName.length; x++) {
		if (vstrFormName[x].type == "checkbox" ||document.frmInvestorSelection[x].type == "radio") {
			vstrFormName[x].checked = false;
//			document.write("name = "+ vstrFormName[x].name);
//			document.write("name = "+ vstrFormName[x].status);
		}else if(vstrFormName[x].type == "text") {
			vstrFormName[x].value = "";
		}else if(vstrFormName[x].type == ("select-multiple" ||"select-one")){
			vstrFormName[x].selectedIndex = -1;
		}
	}
}



function disableIt(vbooIdParam){
	
	for (x = 0; x < document.frmInvestorSelection.length; x++) {
			if (document.frmInvestorSelection[x].name== vbooIdParam) {
				document.frmInvestorSelection[x].checked = false;
				document.frmInvestorSelection[x].selectedIndex = -1;
				document.frmInvestorSelection[x].disabled = true;
			}
  		}
}

function chkRadio(vstrValueToMatch){
	for (x = 0; x < document.frmInvestorSelection.length; x++) {
		if (document.frmInvestorSelection[x].value== vstrValueToMatch) {
			document.frmInvestorSelection[x].checked = true;
		}
  	}

}

function pause(numberMillis) {
        var now = new Date();
        var exitTime = now.getTime() + numberMillis;
        while (true) {
            now = new Date();
            if (now.getTime() > exitTime)
                return;
        }
    }

function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also
   // removes consecutive spaces and replaces it with one space.
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function
