/*function mapSearch(aFieldLocation, aSpanLocation, cEdit)
{
	cEdit=cEdit||'new';
	if (cEdit == 'edit' && lastAction == 'loc')
	{
		locSearch(aFieldLocation, aSpanLocation);
	}
	else
	{
		mapSearchExt(aFieldLocation, aSpanLocation, 3, ", ", "...", true, true);
		lastAction="map";
	}
}*/

var arrLastUsedLocObjNames = null;

function mapSearch(aFormLocation, aFieldLocation, aSpanLocation, cEdit, aArrLocObjNames)
{
//debugger;
	if (!window.oMapSearch) window.oMapSearch = new MapSearch();
	window.oMapSearch.mapSearch(aFormLocation, aFieldLocation, aSpanLocation, cEdit, aArrLocObjNames);
}

var lastAction="";

function ReturnValues(locationIds, cLocationsCodes, aFieldLocation, aFormLocation, aSpanLocation, aiLocNoToShow, acDispSeparator, acMoreText, bShowOnlyLocationTitle, bEncloseInBrackets, cType)
{
	FillDataValues(locationIds, cLocationsCodes, aFieldLocation, aFormLocation, aSpanLocation, aiLocNoToShow, acDispSeparator, acMoreText, bShowOnlyLocationTitle, bEncloseInBrackets, cType, arrLastUsedLocObjNames);
}

function getDefaultLocObjNames ()
{
	if (!window.oMapSearch) window.oMapSearch = new MapSearch();
	return window.oMapSearch.getDefaultLocObjNames();
}

function locSearch(aFormLocation, aFieldLocation, aSpanLocation, aArrLocObjNames)
{
	if (!window.oMapSearch) window.oMapSearch = new MapSearch();
	window.oMapSearch.mapSearchExt(aFieldLocation, aFormLocation, aSpanLocation, 3, ", ", "...", true, true, "chklst", aArrLocObjNames);
	lastAction="loc";
}

/*function locSearch(aFieldLocation, aSpanLocation)
{
	mapSearchExt(aFieldLocation, aSpanLocation, 3, ", ", "...", true, true, "chklst");
	lastAction="loc";
}*/

function mapSearchExt(aFieldLocation, aFormLocation, aSpanLocation, aiLocNoToShow, acDispSeparator, acMoreText, bShowOnlyLocationTitle, bEncloseInBrackets, cType, aArrLocObjNames)
{
	if (!window.oMapSearch) window.oMapSearch = new MapSearch();
	window.oMapSearch.mapSearchExt(aFieldLocation, aFormLocation, aSpanLocation, aiLocNoToShow, acDispSeparator, acMoreText, bShowOnlyLocationTitle, bEncloseInBrackets, cType, aArrLocObjNames);
}

function FillDataValues(locationIds, cLocationsCodes, aFieldLocation, aFormLocation, aSpanLocation, aiLocNoToShow, acDispSeparator, acMoreText,
										bShowOnlyLocationTitle, bEncloseInBrackets, cType, aArrLocObjNames)
{
	if (!window.oMapSearch) window.oMapSearch = new MapSearch();
	window.oMapSearch._setUpSetting(cLocationsCodes, aFieldLocation, aFormLocation, aSpanLocation, aiLocNoToShow, acDispSeparator, acMoreText,bShowOnlyLocationTitle, bEncloseInBrackets, cType, aArrLocObjNames);
	window.oMapSearch.FillDataValues(locationIds);
	
}


function getLocObject(aArrLocObjNames, acObjType, acColName)
{
	var cObjectId = aArrLocObjNames[acObjType];
	var cReplaceExp = /:COLUMN_NAME:/g;
	var oLocObject = null;
	
	if (acColName != null)
	{
		cObjectId = cObjectId.replace(cReplaceExp, acColName);
	}
	oLocObject = document.getElementById(cObjectId);
	
	return oLocObject;
}

function trim(s){
	return s.replace(/^\s*(.*?)\s*$/,"$1")
}

function setLocationSelection(oSpan, selectedVal)
{
	oSpan.value=selectedVal;
}
function rebuildCombo(oSpan, selectedVal)
{
	oSpan.value=selectedVal;
}
		
function locationChange(oSource,num,frm,valueList)
{
	var oCountry = oSource;
	var cBlock = 'inline';
	var formNum = 0;

	var valueArray = valueList.split(',');
	
	for(var i=0;i<document.forms.length;i++)
		if(document.forms[i].name == frm)
			 formNum = i;
	
	if (!window.ActiveXObject){
		cBlock = 'table-row';
	}
		for(var i=0;i<valueArray.length;i++)
			ShowHideSpanBlocked('1',frm+'_span_locations_tabs_'+valueArray[i],'2',cBlock);
	
	document.forms[formNum].district_id.value = '';
	
	for(var i=0;i<valueArray.length;i++)
		if(valueArray[i]!=oCountry.value)
			document.getElementById('locations_tabs_' + oCountry.value+'_'+frm).value = '';
			
	if(oCountry.value != '')
		{
		ShowHideSpanBlocked('1',frm+"_span_locations_tabs_" + oCountry.value,'1',cBlock);					
		setLocationSelection(document.forms[formNum].country_loc, document.getElementById('locations_tabs_' + oCountry.value+'_'+frm).value);
		
		}
	else
	{
			setLocationSelection(document.forms[formNum].country_loc, '');
	}
}
function copyValue(oDistrict,frm)
{
	
	var formNum = 0;

	for(var i=0;i<document.forms.length;i++)
		if(document.forms[i].name == frm)
			 formNum = i;

	document.forms[formNum].district_id.value = oDistrict.value;
	
}

function filterDistrictBasedOnCountry(form,spanName,divNameWithMap,divNameWithoutMap,divNameWithMapEdit,divNameWithoutMapEdit)
	{	
	
	var i,formNum=0;

	for(var i=0;i<document.forms.length;i++)
		if(document.forms[i].name == form)
			formNum =i;

	var	countryCode=document.forms[formNum].country_code.value;
	var Pars = "?cCountryCode=" + countryCode ;

		_oAjax =  new Ajax.Request("/v3/include/search/search_content/change_location.cfm",{
					method: "get",
					parameters: Pars,
					onSuccess: function(transport){
						var result = transport.responseText;
						var combovalues = result.split("]");
						var district = document.forms[formNum].district_id;
						var optionsDataVal = combovalues[0].split("|");
						var optionsDisplayVal = combovalues[1].split("|");
						var i,j =0;
						var option = new Option();
						document.forms[formNum].epId.value = combovalues[0];
						document.forms[formNum].title.value = combovalues[1];
						while (district.options.length ){
								 district.options[0] = null;
							}
						option.text='Any';
						option.value='';
						district.options[0] = option;
						for(i=0;i<optionsDisplayVal.length;i++)
						{	var option = new Option();
						
							option.text = trim(optionsDisplayVal[i]);
							option.value = trim(optionsDataVal[i]);
							district.options[i+1] = option;
					
						}
						rearrangeDiv(form,spanName,divNameWithMap,divNameWithoutMap,divNameWithMapEdit,divNameWithoutMapEdit);
					},
					onException: function(t,j){alert('exception.message');}
					});
	}
function rearrangeDiv(form,spanName,divNameWithMap,divNameWithoutMap,divNameWithMapEdit,divNameWithoutMapEdit)
{
	var i,formNum=0;

	for(var i=0;i<document.forms.length;i++)
		if(document.forms[i].name == form)
			formNum =i;

	var	countryCode=document.forms[formNum].country_code.value;
			
					if (countryCode == 'CY'){
							if(document.getElementById(divNameWithMap)!=null)
							{	
								document.getElementById(divNameWithoutMap).style.display='none';
								document.getElementById(divNameWithMap).style.display='block';
								if(document.getElementById(divNameWithMapEdit)!=null){
									document.getElementById(divNameWithMapEdit).style.display='block';
									document.getElementById(divNameWithoutMapEdit).style.display='none';
								}
							}
						}
						else{
							if(document.getElementById(divNameWithoutMap)!=null)
							{	
								document.getElementById(divNameWithMap).style.display='none';
								document.getElementById(divNameWithoutMap).style.display='block';
								if(document.getElementById(divNameWithMapEdit)!=null){
									document.getElementById(divNameWithMapEdit).style.display='none';
									document.getElementById(divNameWithoutMapEdit).style.display='block';
								}
							}
						}
	
	
}
function clearLocations(aFieldLocation, aSpanLocation, aArrLocObjNames)
{
	var arrLocObjNames = null;

	if (aArrLocObjNames != null)
		arrLocObjNames = aArrLocObjNames;
	else
		arrLocObjNames = getDefaultLocObjNames();
	
	var fldSpanText = getLocObject(arrLocObjNames, "TEXT_LOC", aSpanLocation);
	var fldSpanSelectLoc = getLocObject(arrLocObjNames, "BUTTONS_LOC_UNSELECTED", aSpanLocation);
	var fldSpanSelection = getLocObject(arrLocObjNames, "SELECTION", aSpanLocation);
	var fldSpanCombo = getLocObject(arrLocObjNames, "PLACEHOLDER_DISTRICT", aSpanLocation);
	var fldSpanSelectButtons = getLocObject(arrLocObjNames, "BUTTONS_LOC_SELECTED", aSpanLocation);
	var fldTextArea = getLocObject(arrLocObjNames, "TEXTAREA_LOC", aSpanLocation);
	var fldLocTextHidden = getLocObject(arrLocObjNames, "TEXT_HIDDEN_LOC", aSpanLocation);

	aFieldLocation.value = "";
		
	if (fldSpanSelectLoc != null)
		fldSpanSelectLoc.style.display="block";
	if (fldSpanSelection != null)
		fldSpanSelection.style.display="block";
	if (fldSpanCombo != null)
		fldSpanCombo.style.display="inline";
	if (fldSpanSelectButtons != null)
		fldSpanSelectButtons.style.display="none";
	if (fldSpanText != null)
		fldSpanText.innerHTML = "";
	if (fldTextArea != null)
		fldTextArea.value = "";
	if (fldLocTextHidden != null)
		fldLocTextHidden.value = "";
}

function popLocationText(aSpanLocation)
{
	var fldLocTextHidden = document.getElementById(aSpanLocation + "_text_hidden");
	var fldSpanText = document.getElementById(aSpanLocation + "_text");

	if (fldLocTextHidden != null)
	{  
		fldSpanText.innerHTML = fldLocTextHidden.value;
	}

}

function showLocationSpanGeneric(aSpanLocation, abVisible, aArrLocObjNames)
{
	var arrLocObjNames = null;

	if (aArrLocObjNames != null)
		arrLocObjNames = aArrLocObjNames;
	else
		arrLocObjNames = getDefaultLocObjNames();
	var fldSpanSelectLoc = getLocObject(arrLocObjNames, "BUTTONS_LOC_UNSELECTED", aSpanLocation);
	var fldSpanSelection = getLocObject(arrLocObjNames, "SELECTION", aSpanLocation);
	var fldSpanCombo = getLocObject(arrLocObjNames, "PLACEHOLDER_DISTRICT", aSpanLocation);
	var fldSpanSelectButtons = getLocObject(arrLocObjNames, "BUTTONS_LOC_SELECTED", aSpanLocation);	
	var fldSpan = getLocObject(arrLocObjNames, "TEXT_LOC", aSpanLocation,true);	
	fldSpan.style.display="block";

	if (abVisible)
	{
		fldSpanSelectLoc.style.display="block";
		if (fldSpanSelection != null)
			fldSpanSelection.style.display="block";
		if (fldSpanCombo != null)
			fldSpanCombo.style.display="inline";
		fldSpanSelectButtons.style.display="none";
	} else
	{
		fldSpanSelectLoc.style.display="none";
		if (fldSpanSelection != null)
			fldSpanSelection.style.display="none";
		//if (fldSpanCombo != null)
			//fldSpanCombo.style.display="none";
		fldSpanSelectButtons.style.display="block";
	}
}


function popLocationSpanForBackButton(fldLocList, acSpan, aArrLocObjNames)
{	
	var bLocationsSelected = !((fldLocList.value == undefined) || (fldLocList.value == null) || (fldLocList.value == ""));

	//alert("bLocationsSelected =" + bLocationsSelected);
	//alert(fldLocList.name);
	if (bLocationsSelected)
	{
		popLocationText(acSpan);
	}
	showLocationSpanGeneric(acSpan, !bLocationsSelected, aArrLocObjNames);
}

function oppFilterLocBasedOnDistrict(iDistrictId, cLocFieldId)
{
	var bClearField=true;
	var fldLocation = document.getElementById(cLocFieldId);
	if (fldLocation && (fldLocation.type == "select-one"))
	{
		if ((iDistrictId != ""))
		{
			if (arrOppLocations[cLocFieldId][iDistrictId] != null)
			{
				populateFieldList(fldLocation, "|" +  arrOppLocations[cLocFieldId][iDistrictId]["DATA_VALS"] + "|99999999", 
											"Select|" + arrOppLocations[cLocFieldId][iDistrictId]["DISPLAY_VALS"] + "|Other", "|");
				bClearField=false;
			}
			else
				fldLocation.value = "";
		}
		if (bClearField)
		{
			populateFieldList(fldLocation, " ", "Please select a district", "|");
	
		}
	}
}

function oppShowOtherLocText(aiLocation, acLocOtherId)
{
	var bOtherLocSelected = (aiLocation == "99999999");
	var fldLocOther = document.getElementById(acLocOtherId);
	var fldLocOtherLbl = document.getElementById("lbl_" + acLocOtherId);
	if (bOtherLocSelected)
	{
		fldLocOther.style.display = "inline";
		fldLocOtherLbl.style.display = "inline";
	} else
	{
		fldLocOther.value = "";
		fldLocOther.style.display = "none";
		fldLocOtherLbl.style.display= "none";			
	}
}


MapSearch.prototype.mapSearch = function (aFormLocation, aFieldLocation, aSpanLocation, cEdit, aArrLocObjNames)
{
	cEdit=cEdit||'new';
	if (cEdit == 'edit' && this.lastAction == 'loc')
	{
		this.locSearch(aFormLocation, aFieldLocation, aSpanLocation);
	}
	else
	{
		this.mapSearchExt(aFieldLocation, aFormLocation, aSpanLocation, 3, ", ", "...", true, true, null, aArrLocObjNames);
		this.lastAction="map";
	}
}
MapSearch.prototype.mapSearchExt = function(aFieldLocation, aFormLocation, aSpanLocation, aiLocNoToShow, acDispSeparator, acMoreText, bShowOnlyLocationTitle, bEncloseInBrackets, cType, aArrLocObjNames)
{
	this.arrLastUsedLocObjNames = aArrLocObjNames;
	var cPopupType = cType || "flash";
	var cLocationsCodes = aFieldLocation.value;
	this._setUpSetting(aFieldLocation,cLocationsCodes, aFormLocation, aSpanLocation, aiLocNoToShow, acDispSeparator, acMoreText, bShowOnlyLocationTitle, bEncloseInBrackets, cType, aArrLocObjNames);
	var locationIds = "";
	
	if (this.settings.arrLocObjNames && this.settings.arrLocObjNames != null)
		arrLocObjNames = this.settings.arrLocObjNames;
	else
		arrLocObjNames = this.getDefaultLocObjNames();
	var fldDistrict = this._getLocObject(arrLocObjNames, "SELECT_DISTRICT", this.settings.cSpanLocation);
	var iDistrict = '-1';
	if (fldDistrict)
		iDistrict = fldDistrict.value;
	if (cPopupType == "flash")
		locationIds  = getLocation(cLocationsCodes);
	else
	{ 
		locationIds  = getLocationChkLst(cLocationsCodes, aFieldLocation, aFormLocation, aSpanLocation, aiLocNoToShow, acDispSeparator, acMoreText, bShowOnlyLocationTitle, bEncloseInBrackets, cType,iDistrict);
	}
	if ( getBrowser() == 'IE')
		this.FillDataValues(locationIds);
	
}
MapSearch.prototype.locSearch = function(aFormLocation, aFieldLocation, aSpanLocation, aArrLocObjNames)
{
	this.mapSearchExt(aFieldLocation, aFormLocation, aSpanLocation, 3, ", ", "...", true, true, "chklst", aArrLocObjNames);
	this.lastAction="loc";
}

MapSearch.prototype._setUpSetting = function (aFieldLocation,acLocationsCodes, aFormLocation, aSpanLocation, aiLocNoToShow, acDispSeparator, acMoreText, bShowOnlyLocationTitle, bEncloseInBrackets, cType, aArrLocObjNames)
{
	this.settings = {};
	if (aFieldLocation) this.settings.FieldLocation = aFieldLocation;
	if (acLocationsCodes) this.settings.cLocationsCodes = acLocationsCodes;
	if (aFormLocation) this.settings.FormLocation = aFormLocation;
	if (aSpanLocation) this.settings.cSpanLocation = aSpanLocation;
	if (aiLocNoToShow) this.settings.iLocNoToShow = aiLocNoToShow;
	if (acDispSeparator) this.settings.cDispSeparator = acDispSeparator;
	if (acMoreText) this.settings.cMoreText = acMoreText;
	if (bShowOnlyLocationTitle) this.settings.bShowOnlyLocationTitle = bShowOnlyLocationTitle
	if (bEncloseInBrackets) this.settings.bEncloseInBrackets = bEncloseInBrackets
	if (cType) this.settings.cType = cType
	if (aArrLocObjNames) this.settings.arrLocObjNames = aArrLocObjNames
}
MapSearch.prototype.FillDataValues = function (aLocationIds)
{
	var arrLocObjNames = null;
	var loc_list = document.getElementById("loc_list");

	if (this.settings.arrLocObjNames && this.settings.arrLocObjNames != null)
		arrLocObjNames = this.settings.arrLocObjNames;
	else
		arrLocObjNames = this.getDefaultLocObjNames();
	var fldSpanText = this._getLocObject(arrLocObjNames, "TEXT_LOC", this.settings.cSpanLocation);
	var fldSpanSelectLoc = this._getLocObject(arrLocObjNames, "BUTTONS_LOC_UNSELECTED", this.settings.cSpanLocation);
	var fldSpanSelection = this._getLocObject(arrLocObjNames, "SELECTION", this.settings.cSpanLocation);
	var fldSpanCombo = this._getLocObject(arrLocObjNames, "PLACEHOLDER_DISTRICT", this.settings.cSpanLocation);
	var fldSpanSelectButtons = this._getLocObject(arrLocObjNames, "BUTTONS_LOC_SELECTED", this.settings.cSpanLocation);
	var fldTextArea = this._getLocObject(arrLocObjNames, "TEXTAREA_LOC", this.settings.cSpanLocation);
	var fldLocTextHidden = this._getLocObject(arrLocObjNames, "TEXT_HIDDEN_LOC", this.settings.cSpanLocation);	
	var fldLocListHidden = this._getLocObject(arrLocObjNames, "TEXT_HIDDEN_LOC_LIST", this.settings.cSpanLocation);	
	var fldDistrict = this._getLocObject(arrLocObjNames, "SELECT_DISTRICT", this.settings.cSpanLocation);
	if (fldDistrict == null)
	{
		try 
		{
			fldDistrict = this.settings.FormLocation.district_id;
		}
		catch(er)
		{}
	}
	
	var cDispVal = "";
//		var iLocNoToShow = 3;
	var bLocationSelectionCancelled = (aLocationIds == null);
	if (!bLocationSelectionCancelled)
	{
		 this.settings.cLocationsCodes = "";					
		if  (aLocationIds != "")
		{						
			var iLoactions = aLocationIds.split("|");
			var cLocationsDesc = "";
			if (this.settings.iLocNoToShow && this.settings.iLocNoToShow <= 0)
				this.settings.iLocNoToShow = iLoactions.length;			
			for (var i = 0; i < iLoactions.length; i++)
			{
				var arrLocationParts = iLoactions[i].split("@");
				var iLocationId = arrLocationParts[0];
				var cLocationDesc = arrLocationParts[1];
				var arrLocationDescParts = cLocationDesc.split(" > ");
				var cLocationShortDesc = arrLocationDescParts[1];
				if (this.settings.cLocationsCodes != "")
					this.settings.cLocationsCodes = this.settings.cLocationsCodes + ",";
				this.settings.cLocationsCodes = this.settings.cLocationsCodes + iLocationId;
				if (i < this.settings.iLocNoToShow)
				{
					if (cLocationsDesc != "")
						cLocationsDesc = cLocationsDesc + this.settings.cDispSeparator;
					if (this.settings.bShowOnlyLocationTitle) 
						cLocationsDesc = cLocationsDesc + cLocationShortDesc;
					else
						cLocationsDesc = cLocationsDesc + cLocationDesc;
				} else
				{
					if (i == this.settings.iLocNoToShow)
						cLocationsDesc = cLocationsDesc + this.settings.cMoreText;
				}
			}
			if (this.settings.bEncloseInBrackets)
				cDispVal = "[" + cLocationsDesc + "]";
			else
				cDispVal = cLocationsDesc;
			if (fldSpanSelectLoc != null)
				fldSpanSelectLoc.style.display="none";
			if (fldSpanSelection != null)
				fldSpanSelection.style.display="none";
			if (fldSpanCombo != null)
			{				
				//fldSpanCombo.style.display="none";
			}
			if (fldSpanSelectButtons != null)					
				fldSpanSelectButtons.style.display="block";
		} else
		{
			cDispVal = "";
			if (fldSpanSelectLoc != null)
				fldSpanSelectLoc.style.display="block";
			if (fldSpanSelection != null)
				fldSpanSelection.style.display="block";
			if (fldSpanCombo != null)
				fldSpanCombo.style.display="inline";
			if (fldSpanSelectButtons != null)
			fldSpanSelectButtons.style.display="none";
		}
		if (fldSpanText != null)
		{
			fldSpanText.innerHTML = cDispVal + "&nbsp;";				
		}
		else if(fldTextArea != null)
		{
			fldTextArea.value = this._formatForTextarea(cDispVal);
		}
		if (fldLocTextHidden != null)
			fldLocTextHidden.value = cDispVal;			
		if ( getBrowser() == 'IE' )
			this.settings.FieldLocation.value = this.settings.cLocationsCodes;
		else if (getBrowser() == 'NETSCAPE')
		{	
			this.settings.FieldLocation.value= this.settings.cLocationsCodes;
			if (loc_list != null)
				loc_list.value = this.settings.cLocationsCodes;		
		}
		else
			fldLocListHidden.value = this.settings.cLocationsCodes;
				
		if (fldDistrict != null)
		{
			//fldDistrict.value = "";
		}
	}
}
MapSearch.prototype.getDefaultLocObjNames = function ()
{
	var arrDefaultLocObjNames = new Array();

	arrDefaultLocObjNames["TEXT_LOC"] = ":COLUMN_NAME:_text"; //Area where the location text is shown (after selection of specific locations)
	arrDefaultLocObjNames["TEXT_HIDDEN_LOC"] = ":COLUMN_NAME:_text_hidden"; //Hidden field to store the description of the selected locations, this is needed because the object 
	arrDefaultLocObjNames["TEXT_HIDDEN_LOC_LIST"] = ":COLUMN_NAME:_loc_list"; //Hidden field to store the description of the selected locations, this is needed because the object 
																																		//that usually the locations are shown (LOC_TEXT) is not an input field, usually is either a SPAN or a DIV
	arrDefaultLocObjNames["TEXTAREA_LOC"] = ":COLUMN_NAME:_textarea"; //Textarea field where the specific location(s) text will be shown into as text
	arrDefaultLocObjNames["PLACEHOLDER_DISTRICT"] = ":COLUMN_NAME:_combo";  //Placeholder (either a div or a span) for the Select field for districts
	arrDefaultLocObjNames["BUTTONS_LOC_UNSELECTED"] = ":COLUMN_NAME:_select";  //Object (usually span or div) that contains the specific location selection buttons when NO specific location is selected
	arrDefaultLocObjNames["BUTTONS_LOC_SELECTED"] = ":COLUMN_NAME:_buttons"; //Object (usually span or div) that contains the specific location selection buttons when specific location is selected
	arrDefaultLocObjNames["SELECTION"] = ":COLUMN_NAME:_selection";
	arrDefaultLocObjNames["SELECT_DISTRICT"] = "district_id";//Select field that holds the district

	return arrDefaultLocObjNames;
}

MapSearch.prototype._getLocObject = function (aArrLocObjNames, acObjType, acColName)
{
	var cObjectId = aArrLocObjNames[acObjType];

	var cReplaceExp = /:COLUMN_NAME:/g;
	var oLocObject = null;
	
	if (acColName != null)
	{
		cObjectId = cObjectId.replace(cReplaceExp, acColName);
	}

	oLocObject = document.getElementById(cObjectId);
	
	return oLocObject;
}

MapSearch.prototype._formatForTextarea = function (values)
{
	var cRetVal="";
	var aValues=values.split(", ");
	for (var i=0; i<aValues.length; i++)
	{
		cRetVal=cRetVal + trim(aValues[i]) + "\n";
	}
	
	return cRetVal;
}


function MapSearch ()
{
	this.lastAction='';
}
