//::pop-up window (complete settings)
//ex -> onClick="PopWin('./pageurl.aspx','WindowName','500','300','no','no','no','no','no','no');return false"
var win = null;
function PopWin(mypage,myname,w,h,scroll,resize,toolbar,loc,status,menubar){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+resize+',toolbar='+toolbar+',location='+loc+',status='+status+',menubar='+menubar;
	win = window.open(mypage,myname,settings)
	if(win.window.focus){win.window.focus();}
}

//::Help Doc 
function Help(){ 
     PopWin('statics/webhelp/index.html','Help','781','450','yes','yes','no','no','no','yes');
}

//::Help Window
function HelpWindow(strSection){
	PopWin('statics/help/Help_General.aspx?section=' + strSection,'WinHelp','781','400','yes','yes','no','no','no','yes');
}

//::Limit TextArea Length
//ex.	onKeyDown="LimitTextarea(this,255);" onKeyUp="LimitTextarea(this,255);"
function LimitTextarea(fld,lmt) {
	if (fld.value.length > lmt) {
		fld.value = fld.value.substring(0, lmt);
	}
}

//::My Reports Timer
function MyReportsTimer(){
	myReportsTimeout = setTimeout("document.location.href='myreports.aspx';", 120*1000);
}

//::My Reports Details Timer
function MyReportsDetailsTimer(){
	myReportsTimeout = setTimeout("document.location.reload(true);", 120*1000);
}

//::Kill My Reports Timer
function KillMyReportsTimer(){
	clearTimeout(myReportsTimeout);
}

//::Reload Peer Groups
function ReloadPeerGroups(){
	objForm = document.Form1;
	if (objForm.lbInstitutions.disabled == true) {
		document.location.href = 'peergroups.aspx?data=1';
	}
}

//::( ) Only Function
function OpenParenOnly(e){
	var key;
	var keychar;

	if (window.event)
	   key = window.event.keyCode;
	else if (e)
	   key = e.which;
	else
	   return true;
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();

	// control keys
	if ((key==null) || (key==0) || (key==8) || 
		(key==9) || (key==13) || (key==27) )
	   return true;

	// alphas and numbers
	else if ((("(").indexOf(keychar) > -1))
	   return true;
	else
	   return false;
}

//::( ) Only Function
function CloseParenOnly(e){
	var key;
	var keychar;

	if (window.event)
	   key = window.event.keyCode;
	else if (e)
	   key = e.which;
	else
	   return true;
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();

	// control keys
	if ((key==null) || (key==0) || (key==8) || 
		(key==9) || (key==13) || (key==27) )
	   return true;

	// alphas and numbers
	else if (((")").indexOf(keychar) > -1))
	   return true;
	else
	   return false;
}


//::Alphanumeric Only Function
function AlphanumericOnly(e){
	var key;
	var keychar;

	if (window.event)
	   key = window.event.keyCode;
	else if (e)
	   key = e.which;
	else
	   return true;
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();

	// control keys
	if ((key==null) || (key==0) || (key==8) || 
		(key==9) || (key==13) || (key==27) )
	   return true;

	// alphas and numbers
	else if ((("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 -_.").indexOf(keychar) > -1))
	   return true;
	else
	   return false;
}
//Example: onKeyPress="return AlphanumericOnly(event)"

//::Confirm New Analysis
function ConfirmNewAnalysis(){
	if (confirm("Are you sure you want to start a New Analysis?\n\n(Note: Starting a new analysis will clear all of your current unsaved selections.)")) {
		return true;
	}
	else{
		return false;
	}
}

//::Confirm Switching app type
function ConfirmSwitchAppType(){
	if (confirm("Are you sure you want to switch application types and start a New Analysis?\n\n(Note: Starting a new analysis will clear all of your current unsaved selections.)")) {
		return true;
	}
	else{
		return false;
	}
}

//::Control Info Button
function ControlInfoButton(){
	objForm = document.Form1;
	if (objForm.lbInstitutions.selectedIndex >= 0) {
		objForm.btnInfo.disabled = false;
	}
	else {
		objForm.btnInfo.disabled = true;
	}
}

//::Control Market Share Button
function ControlMarketShare(strListBox){
	objForm = document.Form1;
	intRecords = 0;

	switch (strListBox) {
		case "lbInstitutions":
			if (objForm.lbInstitutions.selectedIndex > -1) {
				for (i = 0; i < objForm.lbInstitutions.length; i++) {
					if (objForm.lbInstitutions.options[i].selected == true) {
						strSavedName = objForm.lbInstitutions.options[i].text;
						strSavedName = strSavedName.substr(strSavedName.indexOf(" (")+2,(strSavedName.indexOf(" recs)")-strSavedName.indexOf(" ("))-2);
						intCurRec	 = parseFloat(strSavedName);
						intRecords	 = intRecords + intCurRec;
					}
				}
			}
			break;
			
		case "lbCorporateGroup":
			if (objForm.lbCorporateGroup.selectedIndex > -1) {
				strSavedName = objForm.lbCorporateGroup.options[objForm.lbCorporateGroup.selectedIndex].text;
				strSavedName = strSavedName.substr(strSavedName.indexOf(" (")+2,(strSavedName.indexOf(" recs)")-strSavedName.indexOf(" ("))-2);
				intRecords	 = parseFloat(strSavedName);
			}
			break;
	}

	/*if (intRecords > 50000) {
		objForm.btnMarketExpressAll.disabled = true;
	}
	else {
		objForm.btnMarketExpressAll.disabled = false;
	}*/
}

//::Submit Quick Find
function SubmitQuickFind(){
	objForm = document.Form1;
	if (event.keyCode == 13) {
		if (CheckExistingElement('btnBackTop')) objForm.btnBackTop.disabled = true;
		if (CheckExistingElement('btnBack')) objForm.btnBack.disabled = true;
		if (CheckExistingElement('btnNextTop')) objForm.btnNextTop.disabled = true;
		if (CheckExistingElement('btnNext')) objForm.btnNext.disabled = true;
		//__doPostBack('btnGo','');
	}
}

//::Display Calculating Window
function DisplayCalculatingWindow(){
	objForm = document.Form1;
	if (objForm.chkFilteredTotals.checked == true) {
		document.getElementById('CalculatingWindow').style.display = "block";
	}
}

//::Select All Function
function SelectAll(fld){
	document.getElementById(fld).focus();
	document.getElementById(fld).select();
}

//::Check if form element exists
function CheckExistingElement(elementName){
	for(var i=0; i<document.forms[0].elements.length; i++){
		if(document.forms[0].elements[i].name == elementName){
			return true;
		}
	}
}

//::Full Trim Function
function FTrim(str){
	if(str.length < 1){
		return "";
	}
	str = RTrim(str);
	str = LTrim(str);
	if(str == ""){
		return "";
	}
	else{
		return str;
	}
}

//::Right Trim Function
function RTrim(str){
	var w_space = String.fromCharCode(32);
	var v_length = str.length;
	var strTemp = "";
	if(v_length < 0){
		return "";
	}
	var iTemp = v_length -1;
	while(iTemp > -1){
		if(str.charAt(iTemp) == w_space){
		}
		else{
			strTemp = str.substring(0,iTemp +1);
		break;
		}
		iTemp = iTemp-1;
	}
	return strTemp;
}

//::Left Trim Function
function LTrim(str){
	var w_space = String.fromCharCode(32);
	if(v_length < 1){
		return "";
	}
	var v_length = str.length;
	var strTemp = "";
	var iTemp = 0;
	while(iTemp < v_length){
		if(str.charAt(iTemp) == w_space){
		}
		else{
			strTemp = str.substring(iTemp,v_length);
		break;
		}
		iTemp = iTemp + 1;
	}
	return strTemp;
}

//::Trim String Function
function Trim(str){
	str = str.replace(/\s+/,'');
	str = str.replace(/\s+$/,'');
	return str;
}

//::IsNumeric Function
function IsNumeric(val){
	for (i=0; i<val.length; i++){
		if (isNaN(val.charAt(i))){
			return false;
		}
	}
	return true;
}

//::check if radio or checkbox items are selected
function CheckSelected(arr){
	if(arr.length > 0){
		for(var index = 0; index < arr.length; index++){
			if(arr[index].checked){
				return true;
				break;
			}
		}
	}
	else{
		if(arr.checked){
			return true;
		}
		else{
			return false;
		}
	}
}

//::Valid Alphanumeric
function ValidAlphanumeric(str){
	var invalidChar = "";
	arrItems = str.split("")

	for(var i=0; i<arrItems.length; i++){
		if (("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 -_.").indexOf(arrItems[i]) == -1) {
			invalidChar = arrItems[i];
			break;
		}
	}

	if (invalidChar == "" && str != "") {
		return true;
	}
	else{
		return false;
	}
}

//::Valid E-Mail
function ValidEmail(str){
	AccPos = str.indexOf('@');
	AccStr = str.substr(0,AccPos);
	AccLen = AccStr.length;
	DomPos = str.lastIndexOf('.');
	DomStr = str.substr(AccPos+1,(DomPos-AccPos)-1);
	DomLen = DomStr.length;
	ExtPos = DomPos + 1;
	ExtLen = str.length - ExtPos;
	ExtStr = str.substr(ExtPos,ExtLen);
	if(	   (AccPos != -1)
		&& (DomPos != -1)
		&& (AccLen >= 2)
		&& (DomLen >= 2)
		&& (ExtLen >= 2)
		&& (ExtLen <= 3)){
		return true;
	}
	else{return false}
}

//::Valid Phone
function ValidPhone(PhoneArea,PhonePre,PhoneSuf){
	if ((Trim(PhoneArea) == "") || 
		(Trim(PhonePre) == "") ||
		(Trim(PhoneSuf) == "") ||
		(PhoneArea.length != 3) || 
		(PhonePre.length != 3) ||
		(PhoneSuf.length != 4)){
		return false;
	}else{
		if (IsNumeric(PhoneArea) &&
			IsNumeric(PhonePre) &&
			IsNumeric(PhoneSuf) &&
			(PhoneArea.length == 3) && 
			(PhonePre.length == 3) &&
			(PhoneSuf.length == 4)){
			return true;
		}
	}
}

//::Valid Telephone
function ValidTelephone(str){
	str = Trim(str);
	str = str.replace("(","");
	str = str.replace(")","");
	str = str.replace(".","");
	str = str.replace(".","");
	str = str.replace("-","");
	str = str.replace("-","");
	str = str.replace(" ","");
	strLen = str.length;
	if((strLen == 10 || strLen == 7) && IsNumeric(str)){
		return true;
	}
	else{
		return false;
	}
}

//::Valid Password
function ValidPassword(p1,p2){
	if (p1 != "" && p2 != ""){
		if (p1 == p2) {
			return true;
		}else{
			return false;
		}
	}else{
		return false;
	}
}

//::Validate Registration Form
function ValidateRegistration() {
	missinginfo = "";
	var objForm = document.Form1;

	if (objForm.tbFirstName.value == "") {
		missinginfo += "\n     *  First Name";
	}
	if (objForm.tbLastName.value == "") {
		missinginfo += "\n     *  Last Name";
	}
	if (objForm.tbTitle.value == "") {
		missinginfo += "\n     *  Title";
	}
	if (!ValidEmail(objForm.tbEmail.value)) {
		missinginfo += "\n     *  E-Mail Address";
	}
	if (!ValidTelephone(objForm.tbPhone.value)) {
		missinginfo += "\n     *  Phone";
	}
	if (!ValidTelephone(objForm.tbFax.value)) {
		missinginfo += "\n     *  Fax";
	}
	if (objForm.tbInstitution.value == "") {
		missinginfo += "\n     *  Institution Name";
	}
	if (objForm.tbAddress.value == "") {
		missinginfo += "\n     *  Address";
	}
	if (objForm.tbCity.value == "") {
		missinginfo += "\n     *  City";
	}
	if (objForm.tbState.value == "") {
		missinginfo += "\n     *  State";
	}
	if (objForm.tbZip.value == "") {
		missinginfo += "\n     *  Zip Code";
	}
	if (objForm.tbUsername.value == "") {
		missinginfo += "\n     *  Username";
	}
	if (!ValidPassword(objForm.tbPassword.value,objForm.tbConfirmPassword.value)) {
		missinginfo += "\n     *  Password";
	}
	if (!CheckSelected(objForm.chkRememberLogin)) {
		missinginfo += "\n     *  Terms and Conditions";
	}

	if (missinginfo != "") {
		missinginfo = "The following information was entered incorrectly:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else return true;
}

//::Validate Login Form
function ValidateLogin() {
	missinginfo = "";
	var objForm = document.Form1;

	if (objForm.tbUsername.value == "") {
		missinginfo += "\n     *  Username";
	}
	if (objForm.tbPassword.value == "") {
		missinginfo += "\n     *  Password";
	}

	if (missinginfo != "") {
		missinginfo = "The following information was entered incorrectly:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else return true;
}

//::Validate Password Reminder Form
function ValidatePasswordReminder() {
	missinginfo = "";
	var objForm = document.Form1;

	if (!ValidEmail(objForm.tbEmail.value)) {
		missinginfo += "\n     *  E-Mail Address";
	}

	if (missinginfo != "") {
		missinginfo = "The following information was entered incorrectly:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else return true;
}

//::Validate My Settings Form
function ValidateMySettings() {
	missinginfo = "";
	var objForm = document.Form1;

	if (objForm.tbFirstName.value == "") {
		missinginfo += "\n     *  First Name";
	}
	if (objForm.tbLastName.value == "") {
		missinginfo += "\n     *  Last Name";
	}
	if (objForm.tbTitle.value == "") {
		missinginfo += "\n     *  Title";
	}
	if (!ValidEmail(objForm.tbEmail.value)) {
		missinginfo += "\n     *  E-Mail Address";
	}
	if (!ValidTelephone(objForm.tbPhone.value)) {
		missinginfo += "\n     *  Phone";
	}
	if (!ValidTelephone(objForm.tbFax.value)) {
		missinginfo += "\n     *  Fax";
	}
	if (objForm.tbInstitution.value == "") {
		missinginfo += "\n     *  Institution Name";
	}
	if (objForm.tbAddress.value == "") {
		missinginfo += "\n     *  Address";
	}
	if (objForm.tbCity.value == "") {
		missinginfo += "\n     *  City";
	}
	if (objForm.tbState.value == "") {
		missinginfo += "\n     *  State";
	}
	if (objForm.tbZip.value == "") {
		missinginfo += "\n     *  Zip Code";
	}
	if (objForm.tbUsername.value == "") {
		missinginfo += "\n     *  Username";
	}
	if (objForm.tbPassword.value != "") {
		if (!ValidPassword(objForm.tbPassword.value,objForm.tbConfirmPassword.value)) {
			missinginfo += "\n     *  Password";
		}
	}

	if (missinginfo != "") {
		missinginfo = "The following information was entered incorrectly:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else return true;
}

//::Validate Comparator Form
function ValidateComparator() {
	missinginfo = "";
	var objForm = document.Form1;

	if (objForm.lbInstitutions.value == "" && 
		objForm.lbCorporateGroup.value == "") {

		missinginfo += "\n     *  Please select a single comparator or create a Corporate Group";
		missinginfo += "\n\n               - or -\n";
		missinginfo += "\n     *  Please select a Corporate Group";
	}

	if (missinginfo != "") {
		missinginfo = "The following information was entered incorrectly:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else return true;
}

//::Validate Corporate Group Name Form
function ValidateCorporateGroupName() {
	missinginfo = "";
	var objForm = document.Form1;
	var objList = objForm.lbCorporateGroup;
	var objName = objForm.tbCreateCorporateGroup.value;

	if (objForm.lbInstitutions.value == "") {
		missinginfo += "\n     *  Please select at least one institution to create a Corporate Group";
	}

	if (!ValidAlphanumeric(objForm.tbCreateCorporateGroup.value)) {
		missinginfo += "\n     *  Please enter a Corporate Group Name (Alphanumeric Only)";
	}

	if (missinginfo != "") {
		missinginfo = "The following information was entered incorrectly:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else {
//		for (i = 0; i < objList.length; i++) {
//			strSavedName = objList.options[i].text;
//			strSavedName = strSavedName.substr(0,strSavedName.indexOf(" ("));
//			strSavedName = FTrim(strSavedName);
//			strGroupName = FTrim(objName);
//
//			if (strSavedName.toUpperCase() == strGroupName.toUpperCase()) {
//				if (confirm("\"" + strGroupName + "\" already exists.\n\nClick OK to overwrite this entry...")) {
//					return true;
//				}
//				else{
//					return false;
//				}
//				break;
//			}
//		}
		return true;
	}
}

//::Validate GSA Form
function ValidateGSA() {
	missinginfo = "";
	var objForm = document.Form1;

//	if (objForm.lbGsaList.value == "") {
//		missinginfo += "\n     *  Saved GSA / Comply GSA";
//	}

	if (missinginfo != "") {
		missinginfo = "Please correct the following:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else return true;
}

//::Validate GSA Name Form
function ValidateGSAName() {
	missinginfo = "";
	var objForm = document.Form1;
	var objName = objForm.tbGsaName.value;

	if (!ValidAlphanumeric(objName)) {
		missinginfo += "\n     *  Please enter a GSA Name (Alphanumeric Only)";
	}

	if (FTrim(objName).length>40) {
		missinginfo += "\n     *  GSA Name is too long, please enter 40 characters or less.";
	}

	if (missinginfo != "") {
		missinginfo = "The following information was entered incorrectly:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else {
//		for (i = 0; i < objList.length; i++) {
//			strSavedName = objList.options[i].text;
//			strSavedName = strSavedName.substr(0);
//			strSavedName = FTrim(strSavedName);
//			strGroupName = FTrim(objName);
//
//			if (strSavedName.toUpperCase() == strGroupName.toUpperCase()) {
//				if (confirm("\"" + strGroupName + "\" already exists.\n\nClick OK to overwrite this entry...")) {
//					return true;
//				}
//				else{
//					return false;
//				}
//				break;
//			}
//		}
		return true;
	}
}

//::Select List Function
//	ex. document.FORMNAME.LISTBOXNAME
function SelectList(lst) {
	for (i = 0; i < lst.length; i++) {
		lst.options[i].selected = true;
	}
}

function ValidateListHasSelection(lst, msg){
    var hasselection = false;
    for (i = 0; i < lst.length; i++) {
		if ( lst.options[i].selected == true ){
		    hasselection = true;
		    break;
        }
	}
	
	if ( !hasselection )
	    alert( msg );
	    
	return hasselection;
}

//::Select List Function
//	ex. (document.FORMNAME.LISTBOXNAME,'ITEMVALUE')
function SelectListItem(lst,item) {
	for (i = 0; i < lst.length; i++) {
		if(lst.options[i].value == item){
			lst.options[i].selected = true;
		}
	}
}

//::Confirm Submit
function ConfirmSubmit(msg){
	if (confirm(msg)) {
		return true;
	}else{return false;}
}

//::Check Top Peers
function CheckTopPeers(){
	var objForm = document.Form1;
	var lstPeerGroup = objForm.lbPeerGroup;
	var lstStatus = false;
	var intMaxPeers = 3;
	var j = 0;

	//check for top peers
	for (i = 0; i < lstPeerGroup.length; i++) {
		strPeerGroupItem = escape(lstPeerGroup.options[i].text);
		if(strPeerGroupItem.substr(0,6) == "%BB%20"){
			j++;
			if ((j > 0) && (j <= intMaxPeers)) {
				lstStatus = true;
			}
		}
	}

	//display message if no top peers have been set
	if (lstStatus == false) {
		msg = "Click OK to have the system automatically" +
			  "\nset the Top Peers based on volume." +
			  "\n\n                          - or -\n\n" +
			  "Click Cancel to manually set your Top Peers.";
		if (confirm(msg)) {
			return true;
		}
		else{
			return false;
		}
	}
	else{
		return true;
	}
}

//::Validate Top Peers Form
function ValidateTopPeers() {
	var objForm = document.Form1;
	var lstSelectStatus = false;
	if ( objForm.tbTopPeerCount.value.length == 0 | !IsNumeric(objForm.tbTopPeerCount.value) ){
	    alert('Enter a numeric value for the top peer count.');
	return false;
	}
}

//::Validate Peer Groups Form
function ValidatePeerGroups() {
	var objForm = document.Form1;
	var lstPeerGroup = objForm.lbPeerGroup;
	var lstSavedGroup = objForm.lbSavedGroup;
	var lstSelectStatus = false;

	//check for existing peers or saved groups
	if ((lstPeerGroup.length == 0) && (lstSavedGroup.value == "")) {
		msg = "You must either add peers to the \'Peer Groups\' list." +
			  "\n\n                          - or -\n\n";
		if (lstSavedGroup.length > 0) {
			msg = msg + "You must select a group from the \'Saved Groups\' list.";
		}
		else{
			msg = msg + "You must create a group for the \'Saved Groups\' list.";
		}	  
		alert(msg);
		return false;
	}
	else{
		//check for selected items in saved groups
		for (i = 0; i < lstSavedGroup.length; i++) {
			if(lstSavedGroup.options[i].selected == true){
				lstSelectStatus = true;
			}
		}

		//check top peers
		if (lstSelectStatus == false) {
			return CheckTopPeers();
		}
	}
}

//::Validate Peer Groups: Corporate Group Name Form
function ValidatePeerGroupsCorporateGroupName() {
	missinginfo = "";
	var objForm = document.Form1;
	var objList = objForm.lbCorporateGroup;
	var objName = objForm.tbCreateCorporateGroup.value;

	if (objForm.lbInstitutions.value == "") {
		missinginfo += "\n     *  Please select at least one institution to create a Corporate Group";
	}

	if (!ValidAlphanumeric(objForm.tbCreateCorporateGroup.value)) {
		missinginfo += "\n     *  Please enter a Corporate Group Name";
	}

	if (missinginfo != "") {
		missinginfo = "The following information was entered incorrectly:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else {
//		for (i = 0; i < objList.length; i++) {
//			strSavedName = objList.options[i].text;
//			strSavedName = strSavedName = strSavedName.substr(0,strSavedName.indexOf(" ("));
//			strSavedName = FTrim(strSavedName);
//			strGroupName = FTrim(objName);
//
//			if (strSavedName.toUpperCase() == strGroupName.toUpperCase()) {
//				if (confirm("\"" + strGroupName + "\" already exists.\n\nClick OK to overwrite this entry...")) {
//					return true;
//				}
//				else{
//					return false;
//				}
//				break;
//			}
//		}
		return true;
	}
}

//::Validate Peer Group Name Form
function ValidatePeerGroupName() {
	missinginfo = "";
	var objForm = document.Form1;
	var objList = objForm.lbSavedGroup;
	var objName = objForm.tbSaveGroup.value;

	//if (objForm.lbPeerGroup.value == "") {
	//	missinginfo += "\n     *  Please select at least one Institution and/or Corporate Group to create a Peer Group";
	//}

	if (!ValidAlphanumeric(objForm.tbSaveGroup.value)) {
		missinginfo += "\n     *  Please enter a Peer Group Name (Alphanumeric Only)";
	}

	if (missinginfo != "") {
		missinginfo = "The following information was entered incorrectly:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else {
//		for (i = 0; i < objList.length; i++) {
//			strSavedName = objList.options[i].text;
//			strSavedName = strSavedName = strSavedName.substr(0);
//			strSavedName = FTrim(strSavedName);
//			strGroupName = FTrim(objName);
//
//			if (strSavedName.toUpperCase() == strGroupName.toUpperCase()) {
//				if (confirm("\"" + strGroupName + "\" already exists.\n\nClick OK to overwrite this entry...")) {
//					return CheckTopPeers();
//				}
//				else{
//					return false;
//				}
//				break;
//			}
//		}
		return CheckTopPeers();
	}
}

//::Validate Top Peer Form
function ValidateTopPeer() {
	missinginfo = "";
	var objForm = document.Form1;

	if (objForm.lbPeerGroup.value == "") {
		missinginfo += "\n     *  Please select at least one Institution and/or Corporate Group";
	}

	if (missinginfo != "") {
		missinginfo = "The following information was entered incorrectly:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else return true;
}

//::Validate LAR Filter Form
function ValidateFilter() {
	missinginfo = "";
	var objForm = document.Form1;

	if (objForm.lbSavedFilter.value == "") {
		missinginfo += "\n     *  Please select a Saved LAR Filter";
	}

	if (missinginfo != "") {
		missinginfo = "Please correct the following:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else return true;
}

//::Validate LAR Filter Condition Form
function ValidateFilterCondition() {
	missinginfo = "";
	var objForm = document.Form1;

	if (objForm.cboField.value == "") {
		missinginfo += "\n     *  Please select a Condition Type";
	}
	if (objForm.cboMatchType.value == "") {
		missinginfo += "\n     *  Please select a Condition Operator";
	}
	//if (objForm.txtValue.value == "") {
		//missinginfo += "\n     *  Please enter a value for the Condition";
	//}

	if (missinginfo != "") {
		missinginfo = "Please correct the following:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else return true;
}

//::Validate LAR Filter Name Form
function ValidateFilterName() {
	missinginfo = "";
	var objForm = document.Form1;
	var objList = objForm.lbSavedFilter;
	var objName = objForm.txtFilterName.value;

	if (!ValidAlphanumeric(objForm.txtFilterName.value)) {
		missinginfo += "\n     *  Please enter a Filter Name (Alphanumeric Only)";
	}

	if (missinginfo != "") {
		missinginfo = "Please correct the following:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else {
//		for (i = 0; i < objList.length; i++) {
//			strSavedName = objList.options[i].text;
//			strSavedName = strSavedName.substr(0);
//			strSavedName = FTrim(strSavedName);
//			strGroupName = FTrim(objName);
//
//			if (strSavedName.toUpperCase() == strGroupName.toUpperCase()) {
//				if (confirm("\"" + strGroupName + "\" already exists.\n\nClick OK to overwrite this entry...")) {
//					return true;
//				}
//				else{
//					return false;
//				}
//				break;
//			}
//		}
		return true;
	}
}

//::Validate Demographic Filter Form
//function ValidateDemographicFilter() {
//	missinginfo = "";
//	var objForm = document.Form1;

//	if (objForm.lbSavedFilter.value == "") {
//		missinginfo += "\n     *  Please select a Saved Demographic Filter";
//	}

//	if (missinginfo != "") {
//		missinginfo = "Please correct the following:\n" +
//		missinginfo + "\n\nPlease re-enter the information and try again...";
//		alert(missinginfo);
//		return false;
//	}
//	else return true;
//}

//::Validate Demographic Filter Condition Form
//function ValidateDemographicFilterCondition() {
//	missinginfo = "";
//	var objForm = document.Form1;

//	if (objForm.cboConditionType.value == "") {
//		missinginfo += "\n     *  Please select a Condition Type";
//	}
//	if (objForm.ddlConditionOperator.value == "") {
//		missinginfo += "\n     *  Please select a Condition Operator";
//	}
//	if (objForm.tbConditionValue.value == "") {
//		missinginfo += "\n     *  Please enter a value for the Condition";
//	}

//	if (missinginfo != "") {
//		missinginfo = "Please correct the following:\n" +
//		missinginfo + "\n\nPlease re-enter the information and try again...";
//		alert(missinginfo);
//		return false;
//	}
//	else return true;
//}

////::Validate Demographic Filter Name Form
//function ValidateDemographicFilterName() {
//	missinginfo = "";
//	var objForm = document.Form1;
//	var objList = objForm.lbSavedFilter;
//	var objName = objForm.tbName.value;

//	if (!ValidAlphanumeric(objForm.tbName.value)) {
//		missinginfo += "\n     *  Please enter a Filter Name (Alphanumeric Only)";
//	}

//	if (missinginfo != "") {
//		missinginfo = "Please correct the following:\n" +
//		missinginfo + "\n\nPlease re-enter the information and try again...";
//		alert(missinginfo);
//		return false;
//	}
//	else {
////		for (i = 0; i < objList.length; i++) {
////			strSavedName = objList.options[i].text;
////			strSavedName = strSavedName.substr(0);
////			strSavedName = FTrim(strSavedName);
////			strGroupName = FTrim(objName);
////
////			if (strSavedName.toUpperCase() == strGroupName.toUpperCase()) {
////				if (confirm("\"" + strGroupName + "\" already exists.\n\nClick OK to overwrite this entry...")) {
////					return true;
////				}
////				else{
////					return false;
////				}
////				break;
////			}
////		}
//		return true;
//	}
//}

//::Validate Reports Selection Form
function ValidateReportsSelection() {
	missinginfo = "";
	var objForm = document.Form1;

//	if (objForm.lbSavedReportGroup.value == "") {
//		missinginfo += "\n     *  Please select a Saved Reports Group";
//	}

//	if (objForm.chkCompratorOnly.checked == false &&
//		objForm.chkTopPeers.checked == false &&
//		objForm.chkTopPeersCombined.checked == false &&
//		objForm.chkAllPeersCombined.checked == false) {
//		missinginfo += "\n     *  Please select a Report Type";
//	}

    if ( objForm.tbSessionName != null ){
	    if (!ValidAlphanumeric(objForm.tbSessionName.value)) {
		    missinginfo += "\n     *  Please enter a Session Name (Alphanumeric Only)";
	    }
	}

	if (missinginfo != "") {
		missinginfo = "Please correct the following:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else return true;
}

//::Validate Reports Selection Form
function ValidateSummary() {
	missinginfo = "";
	var objForm = document.Form1;

    if ( objForm.tbSessionName != null ){
	    if (!ValidAlphanumeric(objForm.tbSessionName.value)) {
		    missinginfo += "\n     *  Please enter a Session Name (Alphanumeric Only)";
	    }
	}

	if (missinginfo != "") {
		missinginfo = "Please correct the following:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else return true;
}

//::Validate Reports Selection Name Form
function ValidateReportsSelectionName() {
	missinginfo = "";
	var objForm = document.Form1;
	var objList = objForm.lbSavedReportGroup;
	var objName = objForm.tbName.value;

	if (!ValidAlphanumeric(objForm.tbName.value)) {
		missinginfo += "\n     *  Please enter a Reports Group Name (Alphanumeric Only)";
	}

//	if (objForm.chkTopPeers.checked == false &&
//		objForm.chkTopPeersCombined.checked == false &&
//		objForm.chkAllPeersCombined.checked == false) {
//		missinginfo += "\n     *  Please select a Report Type";
//	}

	if (missinginfo != "") {
		missinginfo = "Please correct the following:\n" +
		missinginfo + "\n\nPlease re-enter the information and try again...";
		alert(missinginfo);
		return false;
	}
	else {
//		for (i = 0; i < objList.length; i++) {
//			strSavedName = objList.options[i].text;
//			strSavedName = strSavedName = strSavedName.substr(0);
//			strSavedName = FTrim(strSavedName);
//			strGroupName = FTrim(objName);
//
//			if (strSavedName.toUpperCase() == strGroupName.toUpperCase()) {
//				if (confirm("\"" + strGroupName + "\" already exists.\n\nClick OK to overwrite this entry...")) {
//					return true;
//				}
//				else{
//					return false;
//				}
//				break;
//			}
//		}
		return true;
	}
}