// MLS Search (313)
// MLS Search Header
// MR 2/22/03 -->

// .js files defined in MLSSearchHeader.htm
// /scripts/common/trimutilities.js
// /scripts/common/dateutilities.js
// /scripts/mls/mlssearchheader.js
// /scripts/mls/mlscheckregionareachange.js

// Variables defined in MLSSearchHeader.htm
// mgBannerFilename
// mgAppName
// mgSessionNumber
// mgSearchNumber
// mgSearchType
// mgRegionLabel
// mgAreaLabel
// mgCoordinateFormat
// mgAgeYearBuilt
// mgLotMeasurement
// mgSetFocus

// Used to keep preview count window unique:
// winSuffix

// Variables defined in MLSSearchRemarks.htm
// MarketingRemarks
// AgentRemarks

// Used for MAC Compatibility
var btnSubmit = null;

// Used for Toggle of 'Additional Criteria' buttons
var intPTCheckedCount = 0;
var btnAdditionalCriteria = null;

var bIsPublic = false; // see InitForm
// Used for subdivisions so the user cannot select multiple subdivisions for different areas
var currentRegion = '';
var currentArea = '';
var regionInit = '';
var areaInit = '';
var currentRegion1 = '';
var currentArea1 = '';
var regionInit1 = '';
var areaInit1 = '';

var currentRegion2 = '';
var currentArea2 = '';
var regionInit2 = '';
var areaInit2 = '';

var currentRegion3 = '';
var currentArea3 = '';
var regionInit3 = '';
var areaInit3 = '';

var currentRegion4 = '';
var currentArea4 = '';
var regionInit4 = '';
var areaInit4 = '';

var subdivisionInit = '';

// Used for Sort Options
var indexSortA = 0;
var indexSortB = 0;
var indexSortC = 0;

//Used for Area By Counties Lookup
var sSelectedCounties = '';

//Used for Amenity Lookups
var sSelectedPropType = '';

var objElements;

var objCountWindow;

/************************************** Begin Search Header **************************************/
function InitRegions()
{
	// init currentRegion + currentArea if field exists
	currentRegion = objElements["Region_Fill_In"] ? objElements["Region_Fill_In"].value : '';
	regionInit = objElements["Region_Fill_In"] ? objElements["Region_Fill_In"].value : '';
	currentArea = objElements["Area_Fill_In"] ? objElements["Area_Fill_In"].value : '';
	areaInit = objElements["Area_Fill_In"] ? objElements["Area_Fill_In"].value : '';
	
	currentRegion1 = objElements["Region_Fill_In_1"] ? objElements["Region_Fill_In_1"].value : '';
	regionInit1 = objElements["Region_Fill_In_1"] ? objElements["Region_Fill_In_1"].value : '';
	currentArea1 = objElements["Area_Fill_In_1"] ? objElements["Area_Fill_In_1"].value : '';
	areaInit1 = objElements["Area_Fill_In_1"] ? objElements["Area_Fill_In_1"].value : '';
	
	currentRegion2 = objElements["Region_Fill_In_2"] ? objElements["Region_Fill_In_2"].value : '';
	regionInit2 = objElements["Region_Fill_In_2"] ? objElements["Region_Fill_In_2"].value : '';
	currentArea2 = objElements["Area_Fill_In_2"] ? objElements["Area_Fill_In_2"].value : '';
	areaInit2 = objElements["Area_Fill_In_2"] ? objElements["Area_Fill_In_2"].value : '';
	
	currentRegion3 = objElements["Region_Fill_In_3"] ? objElements["Region_Fill_In_3"].value : '';
	regionInit3 = objElements["Region_Fill_In_3"] ? objElements["Region_Fill_In_3"].value : '';
	currentArea3 = objElements["Area_Fill_In_3"] ? objElements["Area_Fill_In_3"].value : '';
	areaInit3 = objElements["Area_Fill_In_3"] ? objElements["Area_Fill_In_3"].value : '';
	
	currentRegion4 = objElements["Region_Fill_In_4"] ? objElements["Region_Fill_In_4"].value : '';
	regionInit4 = objElements["Region_Fill_In_4"] ? objElements["Region_Fill_In_4"].value : '';
	currentArea4 = objElements["Area_Fill_In_4"] ? objElements["Area_Fill_In_4"].value : '';
	areaInit4 = objElements["Area_Fill_In_4"] ? objElements["Area_Fill_In_4"].value : '';
	
	subdivisionInit = objElements["Subdivision_Fill_In"] ? objElements["Subdivision_Fill_In"].value : '';

	// Initialize Region/Area Fill In fields
	if(objElements["IsRegion"])
	{
		RegionFillIn_onBlur("Region_Fill_In", "Area_Fill_In")
		if(TrimSpaces(objElements["IsPublic"].value) != "Y")
		{
			for(var i = 1; i <= 4; i++)
			{
				RegionFillIn_onBlur("Region_Fill_In_" + i, "Area_Fill_In_" + i);
			}
		}
	}

}
function updateSortDirection(sABC)
	{
		// Set Offset for Index: B and C sort have an extra Blank value
		sABC == 'A' ? iOffSet= 0 : iOffSet = 1;
		if (document.InputForm.Sort_Dir_Defaults.value.substr(objElements['Sort_'+sABC].selectedIndex-iOffSet, 1) == 'D')
			{iDir = 1}
		else
			{iDir = 0}
		objElements['Sort_Dir_'+sABC][iDir].checked = true;
		objElements['Sort_Dir_'+sABC][1-iDir].checked = false;
		// update Hidden Fields for GETPARAM 
		//objElements['Sort_'+sABC+'_H'].value = objElements['Sort_'+sABC].value
	}


function SetAdditionalCriteraButton()
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	// "Prop_Types_String" - comma dilimited string of Property Types
	var aPropertyTypes = new Array();
	var PTIndex = 0;

	// "Prop_Types_Amenity_String" - comma dilimited string of whether searchable amenities exist
	var aPropertyTypesAmenity = new Array();
	var AmenityIndex = 0;
	var boolDisplayAmenities = false;

	// "Prop_Types_Auction_String" - comma dilimited string of Property Types Auction settings
	var aPropertyTypesAuction = new Array();
	var AuctionIndex = 0;
	var boolDisplayAuctions = false;

	// "Prop_Types_Measurement_String" - comma dilimited string of Property Types Measurement settings
	var aPropertyTypesMeasurement = new Array();
	var MeasurementIndex = 0;
	var strMeasurement = "";

	// "PT_Measurement_Default_String" - comma dilimited string of Property Types Measurement Default settings
	var aPTMeasurementDefault = new Array();
	var MeasurementDefaultIndex = 0;
	var strMeasurementDefault = "";

	var strTemp = "";
	var strPropType = "";
	var strToken = ",";
	var intTokenIndex = 0;

	if(objElements["Prop_Types_String"] == null)
	{
		btnAdditionalCriteria.disabled = true;
		document.getElementById('AdditionalCriteriaAnchor').disabled = true;

		if(document.getElementById('LoadAuctions'))
		{
			document.getElementById('LoadAuctions').style.display = "none";
			objElements["Include_Auctions"].checked = false;
		}
	}
	else
	{
		aPropertyTypes = objElements["Prop_Types_String"].value.split(strToken);
		strTemp = objElements["Prop_Types_String"].value;

		aPropertyTypesAmenity = objElements["Prop_Types_Amenity_String"].value.split(strToken);

		aPropertyTypesAuction = objElements["Prop_Types_Auction_String"].value.split(strToken);
		aPropertyTypesMeasurement = objElements["Prop_Types_Measurement_String"].value.split(strToken);
		aPTMeasurementDefault = objElements["PT_Measurement_Default_String"].value.split(strToken);

		// Get count of number of Property Types checked
		intPTCheckedCount = 0;
		while((intTokenIndex = strTemp.indexOf(strToken)) != -1)
		{
			strPropType = strTemp.substring(0, intTokenIndex);
			strTemp = strTemp.substr(intTokenIndex + 1);
			if(objElements["Prop_Type_" + strPropType].checked == true)
			{
				sSelectedPropType = strPropType;
				if(aPropertyTypesAmenity[AmenityIndex] == 'Y')
				{
					boolDisplayAmenities = true;
				}

				if(aPropertyTypesAuction[AuctionIndex] != '')
				{
					boolDisplayAuctions = true;
				}

				if(strMeasurement == '')
				{
					strMeasurement = aPropertyTypesMeasurement[MeasurementIndex]
				}
				else if(aPropertyTypesMeasurement[MeasurementIndex] != strMeasurement)
				{
					strMeasurement = 'E';
				}

				if(strMeasurementDefault == '')
				{
					strMeasurementDefault = aPTMeasurementDefault[MeasurementDefaultIndex];
				}
				intPTCheckedCount++;
			}
			AmenityIndex++;
			AuctionIndex++;
			MeasurementIndex++;
			MeasurementDefaultIndex++
		}
		if(objElements["Prop_Type_" + strTemp].checked == true)
		{
			sSelectedPropType = strTemp;
			if(aPropertyTypesAmenity[AmenityIndex] == 'Y')
			{
				boolDisplayAmenities = true;
			}

			if(aPropertyTypesAuction[AuctionIndex] != '')
			{
				boolDisplayAuctions = true;
			}

			if(strMeasurement == '')
			{
				strMeasurement = aPropertyTypesMeasurement[MeasurementIndex]
			}
			else if(aPropertyTypesMeasurement[MeasurementIndex] != strMeasurement)
			{
				strMeasurement = 'E';
			}

			if(strMeasurementDefault == '')
			{
				strMeasurementDefault = aPTMeasurementDefault[MeasurementDefaultIndex];
			}
			intPTCheckedCount++;
		}

		if(document.getElementById('LoadAuctions'))
		{
			if(boolDisplayAuctions)
			{
				document.getElementById('LoadAuctions').style.display = "";
			}
			else
			{
				document.getElementById('LoadAuctions').style.display = "none";
				objElements["Include_Auctions"].checked = false;
			}
		}

		if(document.getElementById('LTSqFt'))
		{
			//alert(strMeasurement);
			if(strMeasurement == 'A')
			{
				document.getElementById('LTAcres').style.display = "";
				document.getElementById('LTSqFt').style.display = "none";
				document.getElementById('Include_0_Text').innerText = "Include 0 Acres";
				objElements["Lot_Measurement"][0].checked = false;
				objElements["Lot_Measurement"][1].checked = true;
			}
			else if(strMeasurement == 'S')
			{
				document.getElementById('LTAcres').style.display = "none";
				document.getElementById('LTSqFt').style.display = "";
				document.getElementById('Include_0_Text').innerText = "Include 0 SqFt"
				objElements["Lot_Measurement"][0].checked = true;
				objElements["Lot_Measurement"][1].checked = false;
			}
			// this used to be commented out but that caused problems for FTWY FD 06162004
			else
			{
				document.getElementById('LTSqFt').style.display = "";
				document.getElementById('LTAcres').style.display = "";

				if(TrimSpaces(objElements["Lot_Size_From"].value) == "" &&
						TrimSpaces(objElements["Lot_Size_Thru"].value) == "")
				{
					if(strMeasurementDefault == 'S')
					{
						objElements["Lot_Measurement"][0].checked = true;
						objElements["Lot_Measurement"][1].checked = false;
						document.getElementById('Include_0_Text').innerText = getLblIncludeZeroSqft();
					}
					else
					{
						objElements["Lot_Measurement"][0].checked = false;
						objElements["Lot_Measurement"][1].checked = true;
						document.getElementById('Include_0_Text').innerText = getLblIncludeZeroAcres();
					}
				}
			}/**/
		}

		if(document.getElementById('PPLTSqFt'))
		{
			if(strMeasurement == 'A')
			{
				document.getElementById('PPLTAcres').style.display = "";
				document.getElementById('PPLTSqFt').style.display = "none";
				objElements["PP_Lot_Measurement"][0].checked = false;
				objElements["PP_Lot_Measurement"][1].checked = true;
			}
			else if(strMeasurement == 'S')
			{
				document.getElementById('PPLTAcres').style.display = "none";
				document.getElementById('PPLTSqFt').style.display = "";
				objElements["PP_Lot_Measurement"][0].checked = true;
				objElements["PP_Lot_Measurement"][1].checked = false;
			}
			else
			{
				document.getElementById('PPLTSqFt').style.display = "";
				document.getElementById('PPLTAcres').style.display = "";

				if(TrimSpaces(objElements["PP_Lot_Size_From"].value) == "" &&
						TrimSpaces(objElements["PP_Lot_Size_Thru"].value) == "")
				{
					if(strMeasurementDefault == 'S')
					{
						objElements["PP_Lot_Measurement"][0].checked = true;
						objElements["PP_Lot_Measurement"][1].checked = false;
					}
					else
					{
						objElements["PP_Lot_Measurement"][0].checked = false;
						objElements["PP_Lot_Measurement"][1].checked = true;
					}
				}
			}
		}

		// Set 'Additional Criteria' button
		if(intPTCheckedCount == 1)
		{
			if(boolDisplayAmenities)
			{
				btnAdditionalCriteria.disabled = false;
				document.getElementById('AdditionalCriteriaAnchor').disabled = false;
			}

			for(PTIndex in aPropertyTypes)
			{
				if(objElements["Prop_Type_" + aPropertyTypes[PTIndex]].checked == true)
				{
					if(objElements["Prop_Subtype_Count_" + aPropertyTypes[PTIndex]].value > 1)
					{
						document.getElementById('Load' + aPropertyTypes[PTIndex]).style.display = "";
					}
					
					
					var iCounter = 1;
					while(document.getElementById('Load' + aPropertyTypes[PTIndex] + iCounter))
					{
						//alert (''+ document.getElementById('Load' + aPropertyTypes[PTIndex]) + iCounter == null ? 'null' : 'not null');
						document.getElementById('Load' + aPropertyTypes[PTIndex] + iCounter).style.display = "";
						document.getElementById('HR' + aPropertyTypes[PTIndex] + iCounter).style.display = "";
						iCounter++;
					}
				}
			}
		}
		else
		{
			btnAdditionalCriteria.disabled = true;
			document.getElementById('AdditionalCriteriaAnchor').disabled = true;

			for(PTIndex in aPropertyTypes)
			{
				if(objElements["Prop_Subtype_Count_" + aPropertyTypes[PTIndex]].value > 1)
				{
					document.getElementById('Load' + aPropertyTypes[PTIndex]).style.display = "none";
					for(var i = 1; i <= objElements["Prop_Subtype_Count_" + aPropertyTypes[PTIndex]].value; ++i)
					{
						objElements["Prop_Subtype_" + aPropertyTypes[PTIndex] + "_" + "000".substr(parseInt(i, 10).toString().length - 1) + i].checked = false;
					}
				}
				//  Hide all the amenities from the first screen
				var iCounter = 1;
				while(document.getElementById('Load' + aPropertyTypes[PTIndex] + iCounter))
				{
					//alert (iCounter+' Load'+aPropertyTypes[PTIndex] +iCounter);
					//alert (''+ document.getElementById('Load' + aPropertyTypes[PTIndex]) + iCounter == null ? 'null' : 'not null');
					document.getElementById('Load' + aPropertyTypes[PTIndex] + iCounter).style.display = "none";
					document.getElementById('HR' + aPropertyTypes[PTIndex] + iCounter).style.display = "none";
					iCounter++;
				}
			}
		}
	}
	return true;
}

function UpdateSortOptions()
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	if(objElements["Sort_as_Entered"].checked == true)
	{
		indexSortA = objElements["Sort_A"].selectedIndex;
		objElements["Sort_A"].selectedIndex = 0;
		objElements["Sort_A"].disabled = true;

		indexSortB = objElements["Sort_B"].selectedIndex;
		objElements["Sort_B"].selectedIndex = 0;
		objElements["Sort_B"].disabled = true;

		indexSortC = objElements["Sort_C"].selectedIndex;
		objElements["Sort_C"].selectedIndex = 0;
		objElements["Sort_C"].disabled = true;
	}
	else
	{
		objElements["Sort_A"].disabled = false;
		objElements["Sort_A"].selectedIndex = indexSortA;

		objElements["Sort_B"].disabled = false;
		objElements["Sort_B"].selectedIndex = indexSortB;

		objElements["Sort_C"].disabled = false;
		objElements["Sort_C"].selectedIndex = indexSortC;
	}

	return true;
}

function forceDecimals(value) 
{
	var objElements = document.InputForm.elements;
	var isAcreageChecked = false;

	if(objElements["Lot_Measurement"] != null)
	{
		// see if Acreage Radio button is checked
		for (var i = 0; i < objElements["Lot_Measurement"].length; i++)
		{
			if(objElements["Lot_Measurement"][i].value == 'A' && objElements["Lot_Measurement"][i].checked == true)
			{
				isAcreageChecked = true;
			}
		}

		if(isAcreageChecked)
		{
			//strip out any commas
			value = value.replace(/\$|\,/g,'');
			var val = parseFloat(value);

			if(value == ''){return "";}
			if(isNaN(val)){return "0.000";}

			if(val <= 0){return "0.000";}
			else{val = parseFloat(Math.round(val*1000)/1000);}

			if(val == Math.floor(val)){val += '.000';}
			else if(val*1000 == parseInt(Math.floor(val*10)*100)){val += '00';}
			else if(val*1000 == parseInt(Math.floor(val*100)*10)){val += '0';}
			
			return val;
		}
		else return value.replace(/\$|\,/g,'');
	}
	//strip out any commas
	else return value.replace(/\$|\,/g,'');
}

function ErrorHandler()
{
	if(mgSearchType == 'RD')
	{
		var streetNumber = objElements['Search_Street_Number'].value !='' ? 1 : 0;
		var streetName = objElements['Search_Street_Name'].value !='' ? 1 : 0;
		var streetZip = objElements['Search_ZIP'].value !='' ? 1 : 0;
		var addressSum = streetNumber + streetName + streetZip;

		if(objElements['Search_Street_Number'].value != '' || objElements['Search_Street_Name'].value != '' ||
			objElements['Search_ZIP'].value != '' ) // Check Address fields if any of the required fields are filled out.
		{
			if(addressSum < 3)
			{
				alert('Radius search by address requires street name, number and ZIP code');
				return false;
			}
		}
		
		if(objElements['Radius_APN'].value == '' && objElements['Radius_County_Fill_In'].value == '' &&
			objElements['Radius_Listing_Number'].value == '' && objElements['Radius_APN'].value == '' && addressSum == 0)
		{
			alert('Radius search requires that you input either Listing Number, '+mgAPNLabel+', or Listing Address');
			return false;
		}
		
	}
	
	if(mgSearchType == 'RD' && objElements['Radius_APN'].value != '' && objElements['Radius_County_Fill_In'].value == '')
	{
			alert('Please enter a ' + mgCountyLabel + ' when searching by '+mgAPNLabel );
			return false;
	}

//	Open House or Broker Tour
	if(mgSearchType == 'OH' || mgSearchType == 'CV')
	{
		OHFromDate_onBlur(objElements['OH_Date_From'],objElements['OH_Date_Thru'])
		OHThruDate_onBlur(objElements['OH_Date_From'],objElements['OH_Date_Thru'])
		if(bFromDateError || bThruDateError)
		{return false;}
	}

//  Lot Size Validation
	if(!checkLotSizeLimit())
		{return false;}	

	// if statement necessary if this js file is used with old merge forms
	if(document.InputForm.SubmitInProcess)
	{
		if(document.InputForm.SubmitInProcess.value == "No" && (document.InputForm.target == "_self" || document.InputForm.target == "countWin_"+winSuffix)) 
		{
			document.InputForm.SubmitInProcess.value ="Yes";
			return true;
		}
		else
		{
			if(document.InputForm.target == "_self" || document.InputForm.target == "countWin_"+winSuffix)
			{
				alert('Processing your request ... \n         Please wait');
				return false;
			}
		}
	}
}

function taxSearch()
{
	// hardcoding Property Type to RESI. It doesn't matter as far as Tax Data goes.
	var objTaxWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSTaxAllSearch&ARGUMENTS=-N' + mgSessionNumber + ',-LFalse,-ARESI,-A' + document.InputForm.Radius_County_Fill_In.value + '&isListingInput=Y', 'newWin', 'menubar=yes,toolbar=yes,resizable=yes,directories=yes,scrollbars=yes,status=yes,width=750,height=500');
	return true;
}
/*************************************** End Search Header ***************************************/

/*************************************** Begin Association ***************************************/
// Open 'Select Associations' window
function OpenAssociationWindow()
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	if(objElements["Association_Fill_In"].disabled == false)
	{
		objElements["Association_Fill_In"].focus();
	}

	var objAssociationWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-AAS', 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
	return true;
}
/**************************************** End Association ****************************************/

/*************************************** Begin Region/Area ***************************************/
// Open 'Select Regions' window
function OpenRegionWindow(regionFillIn, areaFillIn)
{
//alert("Frank dbg OpenRegionWindow - " + regionFillIn + " - " + areaFillIn);
	if(document.InputForm.elements[regionFillIn].disabled == false)
	{
		RegionFillIn_onBlur(regionFillIn, areaFillIn);
	}

	// Open 'Select Regions' window
	var objRegionWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-ARG,-A,-A,-A,-A' + regionFillIn + '|' + areaFillIn, 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
	return true;
}

function RegionFillIn_onKeyUp(regionFillIn, areaFillIn)
{
//alert("RegionFillIn_onKeyUp - " + regionFillIn + " - " + areaFillIn);
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	if(TrimSpaces(objElements[regionFillIn].value) != "")
	{
		objElements[areaFillIn].disabled = false;
	}
	else
	{
		objElements[areaFillIn].disabled = true;
	}
}

function RegionFillIn_onBlur(regionFillIn, areaFillIn)
{
//alert("RegionFillIn_onBlur - " + regionFillIn + " - " + areaFillIn);
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	if(TrimSpaces(objElements["IsRegion"].value) == "Y")
	{
		if(TrimSpaces(objElements[regionFillIn].value) == "" ||
			TrimSpaces(objElements[regionFillIn].value).indexOf("-") != -1 ||
			TrimSpaces(objElements[regionFillIn].value).indexOf(",") != -1)
		{
			objElements[areaFillIn].disabled = true;
			//objElements[areaFillIn].value = objElements["AreaText2"].value;
		}
		else
		{
			if(TrimSpaces(objElements["IsPublic"].value) != "Y")
			{
				objElements[areaFillIn].disabled = false;
			}
		}
	}

	return checkRegionChange('RegionFillIn_onBlur()', regionFillIn, areaFillIn);
}

// Open 'Select Areas' window
function OpenAreaWindow(regionFillIn, areaFillIn)
{
// *********************
//		CAUTION
//		When changing code here, also make changes in other js files with this function
// *********************

//alert("OpenAreaWindow - " + regionFillIn + " - " + areaFillIn);
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	if(objElements[regionFillIn])
	{
		if(TrimSpaces(objElements[regionFillIn].value) == "" ||
			TrimSpaces(objElements[regionFillIn].value) == objElements["RegionText"].value ||
			TrimSpaces(objElements[regionFillIn].value).indexOf("-") != -1 ||
			TrimSpaces(objElements[regionFillIn].value).indexOf(",") != -1)
		{
			var strMsg = document.getElementById('msgSelectOneRegion').innerHTML;
			//alert("Please select only one " + objElements["RegionLabel"].value + " before selecting " + objElements["AreaLabel"].value);
			alert(strMsg);
			
			if(objElements[regionFillIn].disabled == false)
			{
				objElements[regionFillIn].focus();
			}
		}
		else
		{
			// Open 'Select Areas' window
			var objAreaWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-AAR,-A,-A,-A,-A' + regionFillIn + '|' + areaFillIn + ',-A,-A,-A' + objElements[regionFillIn].value, 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
		}
	}
	else
	{
		// Open 'Select Areas' window
		var objAreaWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-AAR,-A,-A,-A,-A' + regionFillIn + '|' + areaFillIn + ',-A,-A,-A0', 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
	}

	return true;
}

// Open 'Select Areas' window with "Group By" option 
function OpenAreaGroupByFramedWindow(regionFillIn, areaFillIn)
{
// *********************
//		CAUTION
//		When changing code here, also make changes in other js files with this function
// *********************

//alert("OpenAreaWindow - " + regionFillIn + " - " + areaFillIn);
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	if(objElements[regionFillIn])
	{
		if(TrimSpaces(objElements[regionFillIn].value) == "" ||
			TrimSpaces(objElements[regionFillIn].value) == objElements["RegionText"].value ||
			TrimSpaces(objElements[regionFillIn].value).indexOf("-") != -1 ||
			TrimSpaces(objElements[regionFillIn].value).indexOf(",") != -1)
		{
			alert("Please select only one " + objElements["RegionLabel"].value + " before selecting " + objElements["AreaLabel"].value);
			if(objElements[regionFillIn].disabled == false)
			{
				objElements[regionFillIn].focus();
			}
		}
		else
		{
			// Open 'Select Areas' window
			var objAreaWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-AAG,-A,-A,-A,-A' + regionFillIn + '|' + areaFillIn + ',-A,-A,-A' + objElements[regionFillIn].value, 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=yes,width=400,height=350');
		}
	}
	else
	{
		// Open 'Select Areas' window
		var objAreaWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-AAG,-A,-A,-A,-A' + regionFillIn + '|' + areaFillIn + ',-A,-A,-A0', 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=yes,width=650,height=450');
	}

	return true;
}

// Open 'Select Areas' window with "Group By County" option 
function OpenAreaGroupByCountyWindow(countyFillIn, cityFillIn, areaFillIn)
{
// *********************
//		CAUTION
//		When changing code here, also make changes in other js files with this function
// *********************

	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;
	var strCounties;
	var strCities;
	strCounties = objElements[countyFillIn] ? replaceCommas(objElements[countyFillIn].value) : '';
	strCities = '';
	
	if(objElements[cityFillIn])
	{
		if(objElements[cityFillIn].value != "Click the icon for selections.")
		{
			strCities = replaceCommas(objElements[cityFillIn].value);
		}
	}
	//alert("OpenAreaGroupByCountyWindow - " + strCounties + " - " + objElements[areaFillIn].value);

	/*
	if(objElements[countyFillIn])
	{
		
		if(TrimSpaces(objElements[countyFillIn].value) == "") 
			//(objElements["CountyText"].value && TrimSpaces(objElements[countyFillIn].value) == objElements["CountyText"].value) ||
			//TrimSpaces(objElements[countyFillIn].value).indexOf("-") != -1 ||
			//TrimSpaces(objElements[countyFillIn].value).indexOf(",") != -1)
		{
			alert("Please select at least one County before selecting " + objElements["AreaLabel"].value);
			if(objElements[countyFillIn].disabled == false)
			{
				objElements[countyFillIn].focus();
			}
		}
		
		else
		{
			//Open 'Select Areas' window
			var objAreaWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-AAY,-A,-A,-A,-A' + countyFillIn + '|' + areaFillIn + ',-A,-A,-A' + strCities + ',-A' + strCounties, 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=yes,width=400,height=350');
		}
	}
	*/
	/*
	else
	{
		// Open 'Select Areas' window
		var objAreaWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-AAY,-A,-A,-A,-A' + countyFillIn + '|' + areaFillIn + ',-A,-A,-A0', 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=yes,width=650,height=450');
	}
	*/
		// Open 'Select Areas' window
			var objAreaWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-AAY,-A,-A,-A,-A' + countyFillIn + '|' + areaFillIn + ',-A,-A,-A' + strCities + ',-A' + strCounties, 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=yes,width=400,height=350');

	return true;
}

function AreaFillIn_onClick(regionFillIn)
{
//alert("AreaFillIn_onClick - " + regionFillIn);
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	if(TrimSpaces(objElements["IsRegion"].value) == "Y")
	{
		if(TrimSpaces(objElements[regionFillIn].value) == "")
		{
			objElements[regionFillIn].focus();
		}
	}

	return true;
}

// Open 'RegionArea' window
function OpenRegionAreaWindow()
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	var objRegionAreaWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-ARA', 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=500,height=350');

	return true;
}
/**************************************** End Region/Area ****************************************/

/*************************************** Begin Subdivision ***************************************/
// Open 'Select Subdivisions' window
function OpenSubdivisionWindow()
{
//alert("OpenSubdivisionWindow");
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;
	if(objElements["SubdivisionType"].value == "E" &&
		(objElements["Area_Fill_In"] == null ||
		 objElements["Area_Fill_In"].value.indexOf(",") != -1 ||
		 objElements["Area_Fill_In"].value.indexOf("-") != -1 ||
		 objElements["Area_Fill_In"].value == objElements["AreaText"].value ||
		 objElements["Area_Fill_In"].value == objElements["AreaText2"].value ||
		 TrimSpaces(objElements["Area_Fill_In"].value) == ""))
	{
		alert("Please select only one " + objElements["AreaLabel"].value + " before selecting " + objElements["SubdivisionsLabel"].value);
	}
// ******                             *****
// ****** Start New Code for type 'N' *****
// ******                             *****
/* 
	if(objElements["SubdivisionType"].value == "N" &&
		(objElements["Area_Fill_In"] == null ||
		 objElements["Area_Fill_In"].value.indexOf(",") != -1 ||
		 objElements["Area_Fill_In"].value.indexOf("-") != -1 ||
		 objElements["Area_Fill_In"].value == objElements["AreaText"].value ||
		 objElements["Area_Fill_In"].value == objElements["AreaText2"].value ||
		 TrimSpaces(objElements["Area_Fill_In"].value) == ""))
	{
		alert("Please select only one " + objElements["AreaLabel"].value + " before selecting " + objElements["SubdivisionsLabel"].value);
	}
*/
// ******                             *****
// ****** End New Code for type 'N' *****
// ******                             *****

	else
	{
		if(objElements["Subdivision_Fill_In"].disabled == false)
		{
			objElements["Subdivision_Fill_In"].focus();
		}

		if(objElements["SubdivisionType"].value == "E")
		{
			var winURL = '/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-ASB,-A,-A,-A,-A,-A,-A,-A';
			//if region, add region and area parameters, otherwise just area
			if(objElements["IsRegion"])
			{
				winURL = winURL + (objElements["IsRegion"].value == "Y" ? getRegionAndArea() : getArea());
			}
			
			var objSubdivisionWindow = window.open (winURL, 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
		}
// ******                             *****
// ****** Start New Code for type 'N' *****
// ******                             *****
		else if(objElements["SubdivisionType"].value == "N")
		{
			var winURL = '/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-ASS,-A,-A,-A,-A,-A,-A,-A';
			//if region, add region and area parameters, otherwise just area
			if(objElements["IsRegion"])
			{
				winURL = winURL + (objElements["IsRegion"].value == "Y" ? getRegionAndArea() : getArea());
			}

			//alert (winURL);
			var objSubdivisionWindow = window.open (winURL, 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
			
			//alert (LookUpInputForm.ARGUMENTS.value);
			//LookUpInputForm.Region1.value = objElements["Region_Fill_In"].value;
			//var objSubdivisionWindow = window.open ('', 'newWin', 'menubar=yes,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
			//LookUpInputForm.submit();
		}
// ******                             *****
// ****** End New Code for type 'N'   *****
// ******                             *****
		else if(objElements["SubdivisionType"].value == "V")
		{
			var winURL = '/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-ASS,-A,-A,-A,-A,-A,-A,-A';
			//if region, add region and area parameters, otherwise just area
			if(objElements["IsRegion"])
			{
				winURL = winURL + (objElements["IsRegion"].value == "Y" ? getRegionAndArea() : getArea());
				winURL = winURL + ',-A' + (objElements["County_Fill_In"] ? objElements["County_Fill_In"].value : '');
			}
			
			var objSubdivisionWindow = window.open (winURL, 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
		}
		else
		{
			var objSubdivisionWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-ASB', 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
		}
	}
	return true;
}

function getArea()
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;
	//return blank if there is help text in the edit field
	var returnVal = TrimSpaces(objElements["Area_Fill_In"].value) == TrimSpaces(objElements["AreaText"].value) || TrimSpaces(objElements["Area_Fill_In"].value) == TrimSpaces(objElements["AreaText2"].value) ? '' : replaceCommas(TrimSpaces(objElements["Area_Fill_In"].value));
	//alert (returnVal);
	return returnVal;
}

function getRegionAndArea()
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;
	var strRegion1 = objElements["Region_Fill_In"].value;

	//blank if there is help text in the edit field
	var strRegion1 = TrimSpaces(objElements["Region_Fill_In"].value) == TrimSpaces(objElements["RegionText"].value) ? '' : replaceCommas(TrimSpaces(objElements["Region_Fill_In"].value),'||||');
	
	//blank if there is help text in the edit field
	var strArea1 = TrimSpaces(objElements["Area_Fill_In"].value) == TrimSpaces(objElements["AreaText"].value) || TrimSpaces(objElements["Area_Fill_In"].value) == TrimSpaces(objElements["AreaText2"].value) ? '' : replaceCommas(TrimSpaces(objElements["Area_Fill_In"].value));

	// need to return blank instead of a bunch of delimiters if everything is blank
	var allBlank = true;
	var returnVal = strRegion1+'||'+strArea1;
	allBlank = returnVal == '||' ? true : false;
	if(TrimSpaces(objElements["IsPublic"].value) != "Y")
		{
		for (i = 1; i < 5; i++ )
		{
			var strRegion = TrimSpaces(objElements["Region_Fill_In_"+i].value) == TrimSpaces(objElements["RegionText"].value) ? '' : replaceCommas(TrimSpaces(objElements["Region_Fill_In_"+i].value),'||||');
			var strArea = TrimSpaces(objElements["Area_Fill_In_"+i].value) == TrimSpaces(objElements["AreaText"].value) || TrimSpaces(objElements["Area_Fill_In_"+i].value) == TrimSpaces(objElements["AreaText2"].value) ? '' : replaceCommas(TrimSpaces(objElements["Area_Fill_In_"+i].value));
			// if everything is blank keep allBlank true
			if(strRegion == '' && strArea == '' && allBlank == true)
			{
				allBlank = true;
			}
			else
			{
				allBlank = false;
			}
			returnVal = returnVal + '||'+strRegion+'||'+strArea;
		}
	}
	if (allBlank)
	{
		returnVal = '';
	}
	return returnVal;
}

function replaceCommas(strString, strSeparator)
{
	if (strSeparator == null)
	{
		strSeparator = '|'
	}
	var strTemp = "";

	for(var i = 0; i < strString.length; i++)
	{
		if(strString.substr(i, 1) != ",")
		{
			strTemp = strTemp + strString.substr(i,1);
		}
		else
		{
			strTemp = strTemp + strSeparator;
		}

	}

	return strTemp;
}
/**************************************** End Subdivision ****************************************/

/****************************************** Begin County *****************************************/
// Open 'Select Counties' window
function OpenCountyWindow(sCountyFillInName, sBehavior)
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	if(objElements[sCountyFillInName].disabled == false)
	{
		objElements[sCountyFillInName].focus();
	}

	var objCountyWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-ACN,-A,-A,-A' + sBehavior + ',-A' + sCountyFillInName, 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
	return true;
}
/******************************************* End County ******************************************/

/******************************************* Begin City ******************************************/
// Open 'Select Cities' window
function OpenCityWindow(sCityFillInName, sCountyFillInName, sBehavior)
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;
	var strCountyFillIn = '';
	var strAreaFillIn = '';
	

	if(objElements[sCountyFillInName]&& sCountyFillInName != '')
	{
		strCountyFillIn = replaceCommas(objElements[sCountyFillInName].value)
	}
	
	if(objElements[sCityFillInName].disabled == false)
	{
		objElements[sCityFillInName].focus();
	}
	//req 61288
	if(objElements['Area_Fill_In'])
	{
		strAreaFillIn = replaceCommas(objElements['Area_Fill_In'].value);
	}
/*
	//This switch was implemented but then dropped again. Delete code when safe
	if(objElements['Enforce_City_To_County'] && objElements['Enforce_City_To_County'].value == 'Y')
	{
		if(strCountyFillIn == '')
		{
			alert("Please select at least one " + mgCountyLabel + " before selecting Cities." );
			return false;
		}
	}
*/
	var objCityWindow = window.open ( '/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-ACT,-A,-A,-A' + sBehavior + ',-A' + sCityFillInName + ',-A,-A,-A' + strAreaFillIn + ',-A' + strCountyFillIn, 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');

	return true;
}
/******************************************** End City *******************************************/

/************************************** Begin Map Coordinates ************************************/
// Open 'Select Map Coordinates' window
function OpenMapWindow()
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	var strMapBook = "";

	for(var i = 1; i <= objElements["Map_Book_Count"].value; i++) //this was i=0 and i < ...["Map_Book"].length
	{
		if(objElements["Map_Book" + i].checked == true)//this was ["Map_Book"][i].checked
		{
			strMapBook = objElements["Map_Book" + i].value; //this was ["Map_Book"][i].checked
			break;
		}
	}

	if(objElements["Map_Fill_In"].disabled == false)
	{
		objElements["Map_Fill_In"].focus();
	}

	var objMapWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-AMC,-A' + strMapBook + ',-A' + mgCoordinateFormat + '', 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
	return true;
}

// Open 'Map Book' window
function OpenMapBookWindow()
{
	var objMapBookWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-AMB', 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=475,height=375');

	return true;
}

/*************************************** End Map Coordinates *************************************/

/****************************************** Begin Address ****************************************/
// Open 'Select Addresses' window
function OpenAddressWindow()
{
	document.InputForm.elements["Street_Number_From_1"].focus();

	var objAddressWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-AAD', 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=640,height=325');
	return true;
}
/******************************************* End Address *****************************************/

/************************************** Begin School District ************************************/
// Open 'Select School Districts' window
function OpenSchoolDistrictsWindow()
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	if(objElements["School_District_Fill_In"].disabled == false)
	{
		objElements["School_District_Fill_In"].focus();
	}

	var objDistrictWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-ASD', 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
	return true;
}
/*************************************** End School District *************************************/

/******************************************* Begin School ****************************************/
// Open 'Select Schools' window
function OpenSchoolsWindow(objSchoolType, TextboxName, District, objDistrict)
{
	var DistrictArray = new Array();

	if(District == document.InputForm.elements["SchoolDistrictText"].value)
	{
		District = "";
	}

	DistrictArray = District.split(",");

	if(objSchoolType.value != "")
	{
		if(document.InputForm.elements["School_District_Fill_In"].disabled == false)
		{
			document.InputForm.elements["School_District_Fill_In"].focus();
		}

		var objSchoolWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-ASH,-A,-A,-AR,-A' + TextboxName + ',-A' + DistrictArray.join("|") + ',-A' + objSchoolType.value, 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
	}
	else
	{
		alert("Please select a school type.");
	}

	return true;
}
/******************************************** End School *****************************************/

/*************************************** Begin Statuses/Dates ************************************/
function StatusChecked(cbxStatus)
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	var dtFromDate = new Date();
	var intDay = dtFromDate.getDate();
	var strStatus = cbxStatus.name.substr(cbxStatus.name.length - 1);

	dtFromDate.setDate(intDay - objElements["Status_Period_" + strStatus].value);

	if(cbxStatus.checked == true)
	{
		if(objElements["Status_Date_" + strStatus] &&
			objElements["Status_Date_" + strStatus].checked == false &&
			objElements["Status_Period_" + strStatus].value != 0)
		{
			objElements["Status_Date_" + strStatus].checked = true;
			objElements["Status_From_Date_" + strStatus].value = dateToString(dtFromDate);
		}
	}
	else
	{
		if(objElements["Status_Date_" + strStatus] &&
			objElements["Status_Date_" + strStatus].checked == true)
		{
			objElements["Status_Date_" + strStatus].checked = false;
			objElements["Status_From_Date_" + strStatus].value = "";
			objElements["Status_Thru_Date_" + strStatus].value = "";
		}
	}

	return true;
}

function DateChecked(cbxDate)
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	var dtFromDate = new Date();
	var intDay = dtFromDate.getDate();
	var strStatus = "";

	if(cbxDate.name == "Entry_Date")
	{
		if(cbxDate.checked == false)
		{
			objElements["Entry_Date_From"].value = "";
			objElements["Entry_Date_Thru"].value = "";
		}
	}
	else
	{
		strStatus = cbxDate.name.substr(cbxDate.name.length -1);
		dtFromDate.setDate(intDay - objElements["Status_Period_" + strStatus].value);

		if(cbxDate.checked == true)
		{
			if(objElements["Status_Period_" + strStatus].value != 0)
			{
				objElements["Status_From_Date_" + strStatus].value = dateToString(dtFromDate);
			}
		}
		else
		{
			objElements["Status_From_Date_" + strStatus].value = "";
			objElements["Status_Thru_Date_" + strStatus].value = "";
		}
	}

	return true;
}

function CheckIt(objDate)
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	var strStatus = "";

	if(objDate.name.substr(0, 10) == "Entry_Date")
	{
		if(objElements[objDate.name].value != "")
		{
			if(objElements["Entry_Date"].checked == false)
			{
				objElements["Entry_Date"].checked = true;
			}
		}
		else
		{
			if(objElements["Entry_Date_From"].value == "" &&
				objElements["Entry_Date_Thru"].value == "")
			{
				objElements["Entry_Date"].checked = false;
			}
		}
	}
	else
	{
		strStatus = objDate.name.substr(objDate.name.length -1);

		if(objElements[objDate.name].value != "")
		{
			if(objElements["Status_Date_" + strStatus].checked == false)
			{
				objElements["Status_Date_" + strStatus].checked = true;
			}
		}
		else
		{
			if(objElements["Status_From_Date_" + strStatus].value == "" &&
				objElements["Status_Thru_Date_" + strStatus].value == "")
			{
				objElements["Status_Date_" + strStatus].checked = false;
			}
		}
	}

	return true;
}

//Status Kickout - Display only for Contingent Status
function DisplayStatusKickout(oObject)
{
	var objElements = document.InputForm.elements;
	
	if(objElements["CheckedContingentStatuses"])
	{
		var count = objElements["CheckedContingentStatuses"].value;

		if(oObject != null)
		{
			if(oObject.checked)
			{
				count++;
			}
			else
			{
				count--;
			}
		}

		if(document.getElementById('DisplayStatusKickout'))
		{
			if(count>0)
			{
				document.getElementById('DisplayStatusKickout').style.visibility = "visible";
			}
			else
			{
				document.getElementById('DisplayStatusKickout').style.visibility = "hidden";
			}
		}
		
		objElements["CheckedContingentStatuses"].value = count;
	}
}


/**************************************** End Statuses/Dates *************************************/

/******************************************* Begin Style *****************************************/
// Open 'Select Styles' window
function OpenStyleWindow()
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	var aPropertyTypes = new Array();
	var PTIndex = 0;
	var strToken = ",";

	if(intPTCheckedCount == 1)
	{
		if(objElements["Style_Fill_In"].disabled == false)
		{
			objElements["Style_Fill_In"].focus();
		}

		aPropertyTypes = objElements["Prop_Types_String"].value.split(strToken);
		for(PTIndex in aPropertyTypes)
		{
			if(objElements["Prop_Type_" + aPropertyTypes[PTIndex]].checked == true)
			{
				var objStyleWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-ASY,-A,-A,-A,-A,-A,-A,-A,-A,-A' + aPropertyTypes[PTIndex], 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
				break;
			}
		}
	}
	else
	{
		var strMsg = document.getElementById('msgSelectOnePT').innerHTML;
		alert(strMsg);
	}

	return true;
}
/******************************************** End Style ******************************************/

/**************************************** Begin Open Houses **************************************/
var bDebug = false;

var bFromDateError = false;
var bThruDateError = false;

//******************************************************************************************//
// FUNCTION:																				//
//	OHFromDate_onBlur																		//
//																							//
// PURPOSE:																					//
//	Validate From Date																		//
//																							//
// INPUT:																					//
//	oFromDate																				//
//	oThruDate																				//
//																							//
// OUTPUT:																					//
//	None																					//
//																							//
// NOTES:																					//
//																							//
//******************************************************************************************//
function OHFromDate_onBlur(oFromDate, oThruDate)
{
bDebug ? alert("OHFromDate_onBlur") : void(0);
bDebug ? alert(document.activeElement.name) : void(0);
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	var dtCurrentDate = isValidDate(dateToString(new Date()), "D");
	var dtFromDate = isValidDate(oFromDate.value, "D");
	var dtThruDate = isValidDate(oThruDate.value, "D");

	var intMaxDaysMilli = 1000 * 60 * 60 * 24 * parseInt(objElements["OH_Max_Days"].value, 10);

	if(!bThruDateError)
	{
		if(oFromDate.value == "")
		{
bDebug ? alert('oFromDate.value == ""') : void(0);
			bFromDateError = true;
			if(document.activeElement.name == "OH_TD_From")
			{
				oFromDate.focus();
			}
			else if(document.activeElement.tagName != "IFRAME")
			{
				oFromDate.value = dateToString(dtCurrentDate);
				bFromDateError = false;
			}
		}
		else if(dtFromDate == null)
		{
bDebug ? alert('dtFromDate == null') : void(0);
			bFromDateError = true;
			if(document.activeElement.name != "OH_TD_From" &&
				document.activeElement.tagName != "IFRAME")
			{
				var strMsgOpenHouseInvalidDate = "The From date is not valid.";
				//This is for the spanish translation to get the Spanish text for the message
				if(document.getElementById('msgOpenHouseInvalidDate'))
				{
					strMsgOpenHouseInvalidDate = document.getElementById('msgOpenHouseInvalidDate').innerHTML;
				}
				alert(strMsgOpenHouseInvalidDate);

				oFromDate.focus();
			}
			else if(document.activeElement.tagName != "IFRAME")
			{
				oFromDate.focus();
			}
		}
		else if(dtFromDate < dtCurrentDate)
		{
bDebug ? alert('dtFromDate < dtCurrentDate') : void(0);
			bFromDateError = true;
			if(document.activeElement.name != "OH_TD_From" &&
				document.activeElement.tagName != "IFRAME")
			{
				var strMsgOpenHousePastDate = "The From date may not be in the past.";
				//This is for the spanish translation to get the Spanish text for the message
				if(document.getElementById('msgOpenHousePastDate'))
				{
					strMsgOpenHousePastDate = document.getElementById('msgOpenHousePastDate').innerHTML;
				}
				alert(strMsgOpenHousePastDate);
				
				oFromDate.value = dateToString(dtCurrentDate);
				bFromDateError = false;
			}
			else if(document.activeElement.tagName != "IFRAME")
			{
				oFromDate.focus();
			}
		}
		else if(dtFromDate > dtThruDate)
		{
bDebug ? alert('dtFromDate > dtThruDate') : void(0);
			bFromDateError = true;
			if(document.activeElement.name != "OH_TD_From" &&
				document.activeElement.tagName != "IFRAME")
			{
				var strMsgOpenHouseAdjustDate = "The From date is past the Thru date.\nThru date will be adjusted to ";
				//This is for the spanish translation to get the Spanish text for the message
				if(document.getElementById('msgOpenHouseAdjustDate'))
				{
					strMsgOpenHouseAdjustDate = document.getElementById('msgOpenHouseAdjustDate').innerHTML;
				}
				//add the adjusted date to msg:
				strMsgOpenHouseAdjustDate += dateToString(new Date(dtFromDate.getTime() + intMaxDaysMilli));
				alert(strMsgOpenHouseAdjustDate);

				//alert("The From date is past the Thru date.\nThru date will be adjusted to " +
				//		dateToString(new Date(dtFromDate.getTime() + intMaxDaysMilli)));
				oThruDate.value = dateToString(new Date(dtFromDate.getTime() + intMaxDaysMilli));
				oFromDate.focus();
				oThruDate.focus();
				bFromDateError = false;
			}
			else if(document.activeElement.tagName != "IFRAME")
			{
				oFromDate.focus();
			}
		}
		else if(document.activeElement.tagName != "IFRAME")
		{
bDebug ? alert('From - document.activeElement.tagName != "IFRAME"') : void(0);
			oFromDate.value = dateToString(dtFromDate);
			bFromDateError = false;
		}
	}

	return true;
}

//******************************************************************************************//
// FUNCTION:																				//
//	OHThruDate_onBlur																		//
//																							//
// PURPOSE:																					//
//	Validate Thru Date																		//
//																							//
// INPUT:																					//
//	oFromDate																				//
//	oThruDate																				//
//																							//
// OUTPUT:																					//
//	None																					//
//																							//
// NOTES:																					//
//																							//
//******************************************************************************************//
function OHThruDate_onBlur(oFromDate, oThruDate)
{
bDebug ? alert("OHThruDate_onBlur") : void(0);
bDebug ? alert(document.activeElement.name) : void(0);
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	var dtCurrentDate = isValidDate(dateToString(new Date()), "D");
	var dtFromDate = isValidDate(oFromDate.value, "D");
	var dtThruDate = isValidDate(oThruDate.value, "D");
	var intMaxDays = parseInt(objElements["OH_Max_Days"].value, 10);
	var FromDate = new Date(oFromDate.value);
	var ThruDate = new Date(oThruDate.value);

	var intMaxDaysMilli = 1000 * 60 * 60 * 24 * parseInt(objElements["OH_Max_Days"].value, 10);

	var SECOND = 1000; // the number of milliseconds in a second
	var MINUTE = SECOND * 60; // the number of milliseconds in a minute
	var HOUR = MINUTE * 60; // the number of milliseconds in an hour
	var DAY = HOUR * 24; // the number of milliseconds in a day
	var WEEK = DAY * 7; // the number of milliseconds in a week
	var TimeDifferenceMS = 0; // Difference between two dates in milliseconds
	var DayDifference = 0;

	var FromDateTime = Date.UTC(2000 + FromDate.getYear(),FromDate.getMonth()+1,FromDate.getDate());
	var ThruDateTime = Date.UTC(2000 + ThruDate.getYear(),ThruDate.getMonth()+1,ThruDate.getDate());
	TimeDifferenceMS = Math.abs(ThruDateTime - FromDateTime); 
	DayDifference = Math.round(TimeDifferenceMS/DAY);

	if(!bFromDateError)
	{
		if(oThruDate.value == "")
		{
bDebug ? alert('oThruDate.value == ""') : void(0);
			bThruDateError = true;
			if(document.activeElement.name == "OH_TD_Thru")
			{
				oThruDate.focus();
			}
			else if(document.activeElement.tagName != "IFRAME")
			{
				oThruDate.value = dateToString(new Date(dtFromDate.getTime() + intMaxDaysMilli));
				bThruDateError = false;
			}
		}
		else if(dtThruDate == null)
		{
bDebug ? alert('dtThruDate == null') : void(0);
			bThruDateError = true;
			if(document.activeElement.name != "OH_TD_Thru" &&
				document.activeElement.tagName != "IFRAME")
			{
				alert("The Thru date is not valid.");
				oThruDate.focus();
			}
			else if(document.activeElement.tagName != "IFRAME")
			{
				oThruDate.focus();
			}
		}
		else if(dtThruDate < dtCurrentDate)
		{
bDebug ? alert('dtThruDate < dtCurrentDate') : void(0);
			bThruDateError = true;
			if(document.activeElement.name != "OH_TD_Thru" &&
				document.activeElement.tagName != "IFRAME")
			{
				alert("The Thru date may not be in the past.\nThru date will be adjusted to " +
						dateToString(new Date(dtFromDate.getTime() + intMaxDaysMilli)));
				oThruDate.value = dateToString(new Date(dtFromDate.getTime() + intMaxDaysMilli));
				bThruDateError = false;
			}
			else if(document.activeElement.tagName != "IFRAME")
			{
				oThruDate.focus();
			}
		}
		else if(dtThruDate < dtFromDate)
		{
bDebug ? alert('dtThruDate < dtFromDate') : void(0);
			bThruDateError = true;
			if(document.activeElement.name != "OH_TD_Thru" &&
				document.activeElement.tagName != "IFRAME")
			{
				var strMsgOpenHouseThruDate = "The Thru date may not be prior to the From date.";
				//This is for the spanish translation to get the Spanish text for the message
				if(document.getElementById('msgOpenHouseThruDate'))
				{
					strMsgOpenHouseThruDate = document.getElementById('msgOpenHouseThruDate').innerHTML;
				}
				alert(strMsgOpenHouseThruDate);

				//alert("The Thru date may not be prior to the From date.");
				oThruDate.value = dateToString(dtThruDate);
				oThruDate.focus();

			}
			else if(document.activeElement.tagName != "IFRAME")
			{
				oThruDate.focus();
			}
		}
		//else if(dtThruDate - dtFromDate > intMaxDaysMilli)
		//Change made for Req 105773, use days to compare instead of time
		// Changed back to greater than since date range was always invalid. ITG 126620
		else if(DayDifference > intMaxDays)
		{
bDebug ? alert('dtThruDate - dtFromDate > intMaxDaysMilli') : void(0);
			bThruDateError = true;
			if(document.activeElement.name != "OH_TD_Thru" &&
				document.activeElement.tagName != "IFRAME")
			{
				var strMsgOpenHouseRange = "The maximum date range may not be greater than " + objElements["OH_Max_Days"].value + " days.";
				//This is for the spanish translation to get the Spanish text for the message
				if(document.getElementById('msgOpenHouseRange'))
				{
					strMsgOpenHouseRange = document.getElementById('msgOpenHouseRange').innerHTML;
				}
				alert(strMsgOpenHouseRange);

				//alert("The maximum date range may not be greater than " + objElements["OH_Max_Days"].value + " days.");
				oThruDate.value = dateToString(dtThruDate);
				oThruDate.focus();
			}
			else if(document.activeElement.tagName != "IFRAME")
			{
				oThruDate.focus();
			}
		}
		else if(document.activeElement.tagName != "IFRAME")
		{
bDebug ? alert('Thru - document.activeElement.tagName != "IFRAME"') : void(0);
			oThruDate.value = dateToString(dtThruDate);
			bThruDateError = false;
		}
	}

	return true;
}
/***************************************** End Open Houses ***************************************/

/******************************************* Begin Ranges ****************************************/
// Open 'Select Ranges' window
function OpenRangeLotSizeWindow()
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	var objRangeLotSizeWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-ALS,-A,-A,-A,-ALot_Size,-A' + CurrentPropertyTypes() + ',-A' + mgLotMeasurement, 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');

	return true;
}

// Open 'Select Ranges' window
function OpenRangeStructureSizeWindow()
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	var objRangeStructureSizeWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-ASF,-A,-A,-A,-AStructure_Square_Feet,-A' + CurrentPropertyTypes(), 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');

	return true;
}

// Open 'Select Ranges' window
function OpenRangeYearAgeWindow()
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	var objRangeYearAgeWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-AYB,-A,-A,-A,-AYear_Built,-A' + CurrentPropertyTypes() + ',-A' + mgAgeYearBuilt, 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');

	return true;
}

// Get currently selected property types
function CurrentPropertyTypes()
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	// "Prop_Types_String" - comma dilimited string of Property Types
	var aPropertyTypes = new Array();
	var PTIndex = 0;

	var sPropertyTypes = "";
	var sPropertyType = "";
	var sTemp = "";
	var sToken = ",";
	var iTokenIndex = 0;

	if(objElements["Prop_Types_String"])
	{
		aPropertyTypes = objElements["Prop_Types_String"].value.split(sToken);
		sTemp = objElements["Prop_Types_String"].value;

		while((iTokenIndex = sTemp.indexOf(sToken)) != -1)
		{
			sPropertyType = sTemp.substring(0, iTokenIndex);
			sTemp = sTemp.substr(iTokenIndex + 1);
			if(objElements["Prop_Type_" + sPropertyType].checked == true)
			{
				sPropertyTypes += sPropertyTypes == "" ? "" : "|";
				sPropertyTypes += "'" + sPropertyType + "'";
			}
		}
		if(objElements["Prop_Type_" + sTemp].checked == true)
		{
			sPropertyTypes += sPropertyTypes == "" ? "" : "|";
			sPropertyTypes += "'" + sTemp + "'";
		}
	}

	return sPropertyTypes;
}
/******************************************** End Ranges *****************************************/

/****************************************** Begin Financing **************************************/
// Open 'Select Financing' window
function OpenFinancingWindow(sBehavior)
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	objElements["Financing_Fill_In"].focus();

	var objFinancingWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-AFN,-A,-A,-A' + sBehavior, 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
	return true;
}
/******************************************* End Financing ***************************************/

/****************************************** Begin Financing **************************************/
// Open 'Select Agreement Type' window
function OpenAgreementTypeWindow(sAgreementTypeFillInName, sBehavior)
{
	// Get reference to this page's Elements collection
	var objElements = document.InputForm.elements;

	objElements[sAgreementTypeFillInName].focus();

	var objAgreementTypeWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-AAT,-A,-A,-A' + sBehavior + ',-A' + sAgreementTypeFillInName, 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
	return true;
}
/******************************************* End Financing ***************************************/
/**************************************** Begin Lot Measurement **********************************/
function round(number,X) 
{
	// rounds number to X decimal places, defaults to 2
	X = (!X ? 2 : X);
	return Math.round(number*Math.pow(10,X))/Math.pow(10,X);
}

function refreshSQFTAcresRange()
{
	var measurementValF = ''; 
	var measurementValT = ''; 
	var sizeFrom;
	var sizeThru;
	var measurementType;

	isNaN(document.getElementById('Lot_Size_From').value) == false ? sizeFrom = document.getElementById('Lot_Size_From').value : sizeFrom = 0;
	isNaN(document.getElementById('Lot_Size_Thru').value) == false ? sizeThru = document.getElementById('Lot_Size_Thru').value : sizeThru = 0;
	switch(mgLotMeasurement)
	{
		case 'A' :
			sizeFrom = sizeFrom * 43560;
			sizeThru = sizeThru * 43560;
			measurementType = 'sq';
			break;
		case 'S' :
			sizeFrom = round(sizeFrom / 43560,3);
			sizeThru = round(sizeThru / 43560,3);
			measurementType = 'ac';
			break;
		default :
			measurementType = '';
	}
	if (measurementType != '')
	{
		if (sizeFrom > 0)
			{measurementValF = '(From: ' + sizeFrom + measurementType + ')';}
		if (sizeThru > 0)
			{measurementValT = '(Thru: ' + sizeThru + measurementType + ')';}
	}
	document.getElementById('acresSqftDisplayFrom').innerText=measurementValF;
	document.getElementById('acresSqftDisplayThru').innerText=measurementValT;
}

function checkLotSizeLimit()
{
	var sizeFrom;
	var sizeThru;
	var sizeMeasurement;

	if(document.InputForm.Lot_Size_From && document.InputForm.Lot_Size_Thru && document.InputForm.Lot_Measurement)
	{
		sizeFrom = document.InputForm.Lot_Size_From.value;
		sizeThru = document.InputForm.Lot_Size_Thru.value;
		rg =  document.InputForm.Lot_Measurement;

		for (var j = 0; j < rg.length; ++j)
		{
			if (rg[j].checked) {sizeMeasurement = rg[j].value;}
		}
		
		if(rg && sizeMeasurement != 'S')
		{
			if(sizeFrom * 43560 > 999999999) {alert('Lot Size From must be less than 22955 acres.'); return false;}
			else if(sizeThru * 43560 > 999999999) {alert('Lot Size Thru must be less than 22955 acres.'); return false;}
			else {return true;}
		}
		else {return true;}
	}
	else return true;
}
/***************************************** End Lot Measurement ***********************************/



function debug()
{
	var sNames = '';
	for(i = 0; i < document.InputForm.length; i++)
	{
		switch (document.InputForm.elements[i].type)
		{
			case 'radio':
				//alert(' '+document.InputForm.elements[i].type);
				if(document.InputForm.elements[i].checked == true)
				{
					sNames +=  document.InputForm.elements[i].name+' '+document.InputForm.elements[i].value+'\n';
				}
				break;
		}
	}
	alert('Frank dbg \nsNames'+sNames);
}
function previewCount()
{
	if(document.InputForm.SubmitInProcess.value == "No" || (objCountWindow && objCountWindow.closed )) 
	{
		// This is version one with opening a regular window:
		var myHeight = 335;
		var myWidth = 640;
		var myTop = window.screenTop + (document.body.offsetHeight - myHeight) / 2;
		var myLeft =window.screenLeft + (document.body.offsetWidth - myWidth) / 2;

		// Don't Change any code below, just this variable! FD 12/01/04
		var isForCitrix = false;
		if (isForCitrix)
		{
			document.InputForm.target = 'countWin_'+winSuffix; //objCountWindow.name;//'countWin_'+winSuffix;
			return true;
		}
		else
		{
			objCountWindow = window.open ('/scripts/mls/MLSLoadingPleaseWait.htm', 'countWin_'+winSuffix, 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=no,status=no,width='+myWidth+',height='+myHeight+',top='+myTop+',left='+myLeft);
			document.InputForm.target = 'countWin_'+winSuffix;
			return true;
		}
		// here is version 2 with a modal dialog window
		//window.showModalDialog("/scripts/mls/MLSSearchCountWindow.htm", document.InputForm, "dialogHeight: 178px; dialogWidth: 541px; dialogTop: 239px; dialogLeft: 412px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes")
	}
	else
	{
		alert('Processing your request ... \n         Please wait');
		return false;
	}
}
function setDaysBack(strDateOrDays)
{
	// needed for call from InitForm()
	if(strDateOrDays == null) strDateOrDays = document.getElementById('DaysBackRadio').checked == true ? 'Days' : 'Date';

	document.getElementById('ChangesFrom').style.display = strDateOrDays == 'Date' ? '' : 'none';
	document.getElementById('ChangesThru').style.display = strDateOrDays == 'Date' ? '' : 'none';
	document.getElementById('DaysBack').style.display = strDateOrDays == 'Date' ? 'none' : '';
	if(strDateOrDays == 'Days')
	{
		//document.InputForm.HS_Days_Back.select();
		document.InputForm.HS_Days_Back.focus();
	}
}

/**************************************** Begin Amenities **********************************/

function OpenZAmenitiesWindow(Category)
{
	// Get reference to this page's Elements collection
	//alert(sSelectedPropType);
	var objElements = document.InputForm.elements;
	var objZAmenityWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-ALG,-A,-A,-A,-A,-A,-A,-A,-A,-A' + sSelectedPropType + ',-A' + Category, 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
	return true;
}
function UncheckCBox(CBox)
{
	//var strPropertyType = objSearchForms["InputForm"].elements["Prop_Count"]
	if(CBox.name.substring(0, 7) == "Include")
	{
		document.InputForm.elements["Exclude" + CBox.name.substring(7)].checked = false
	}
	if(CBox.name.substring(0, 7) == "Exclude")
	{
		document.InputForm.elements["Include" + CBox.name.substring(7)].checked = false
	}
	return true;
}
function OpenLanguagesWindow()
{
	var objElements = document.InputForm.elements;
	var objLanguagesWindow = window.open ('/scripts/mgrqispi.dll?APPNAME=' + mgAppName + '&PRGNAME=MLSSearchLookUp&ARGUMENTS=-N' + mgSessionNumber + ',-N1,-ALG,-A,-A,-A,-A,-A,-A,-A,-A,-A,-A', 'newWin', 'menubar=no,toolbar=no,resizable=yes,directories=no,scrollbars=yes,status=no,width=400,height=350');
	return true;
}
/**************************************** End Amenities **********************************/
//-->