if (document.images)
{
	checkit= new Image(); 
	checkit.src="../images/maps/checkit.gif"; 
}
/**************************************  CALGARY RESIDENTIAL MAPS  *********************************/
// Each map is sectioned off, containing its own variables, functions and data.  There is a section at the end that contains common functions
// among all three maps.


function SelectAllRD()
{
	mapCalgRES_selectRegion(0,0,true);
	mapCalgRES_selectRegion(1,0,true);
	mapCalgRES_selectRegion(2,0,true);
}


var mapCalgRES_titleposx = 140; //150
var mapCalgRES_titleposy = -20;   // 8
var mapCalgRES_sidelayerposx = 0; // 20
var mapCalgRES_sidelayerposy = -20; //120


var mapCalgRES_titleOfArea = new Array();
var mapCalgRES_nameOfRegion = new Array();
var mapCalgRES_idOfRegion = new Array();
var mapCalgRES_valueOfRegion = new Array();




// 0 Red Deer City
// 1 Red Deer County
// 2 Surrounding Areas



//Data for the Titles and the Regions.
mapCalgRES_titleOfArea[0] = "Red Deer City";
mapCalgRES_nameOfRegion[0] = new Array();
mapCalgRES_idOfRegion[0] = new Array();
mapCalgRES_valueOfRegion[0] = new Array();


intReg = 0;



mapCalgRES_idOfRegion[intReg][0]="Abasand Heights";  mapCalgRES_nameOfRegion[intReg][0]="Abasand Heights"; mapCalgRES_valueOfRegion[intReg][0]="Abasand Heights";
mapCalgRES_idOfRegion[intReg][1]="Anzac";  mapCalgRES_nameOfRegion[intReg][1]="Anzac"; mapCalgRES_valueOfRegion[intReg][1]="Anzac";
mapCalgRES_idOfRegion[intReg][2]="Beacon Hill";  mapCalgRES_nameOfRegion[intReg][2]="Beacon Hill"; mapCalgRES_valueOfRegion[intReg][2]="Beacon Hill";
mapCalgRES_idOfRegion[intReg][3]="Dickinsfield";  mapCalgRES_nameOfRegion[intReg][3]="Dickinsfield"; mapCalgRES_valueOfRegion[intReg][3]="Dickinsfield";
mapCalgRES_idOfRegion[intReg][4]="Downtown";  mapCalgRES_nameOfRegion[intReg][4]="Downtown"; mapCalgRES_valueOfRegion[intReg][4]="Downtown";
mapCalgRES_idOfRegion[intReg][5]="Grayling Terrace";  mapCalgRES_nameOfRegion[intReg][5]="Grayling Terrace"; mapCalgRES_valueOfRegion[intReg][5]="Grayling Terrace";
mapCalgRES_idOfRegion[intReg][6]="Gregoire Lake Estates";  mapCalgRES_nameOfRegion[intReg][6]="Gregoire Lake Estates"; mapCalgRES_valueOfRegion[intReg][6]="Gregoire Lake Estates";
mapCalgRES_idOfRegion[intReg][7]="Gregoire Park";  mapCalgRES_nameOfRegion[intReg][7]="Gregoire Park"; mapCalgRES_valueOfRegion[intReg][7]="Gregoire Park";
mapCalgRES_idOfRegion[intReg][8]="Mackenzie Industrial Park";  mapCalgRES_nameOfRegion[intReg][8]="Mackenzie Industrial Park"; mapCalgRES_valueOfRegion[intReg][8]="Mackenzie Industrial Park";
mapCalgRES_idOfRegion[intReg][9]="Prairie Creek";  mapCalgRES_nameOfRegion[intReg][9]="Prairie Creek"; mapCalgRES_valueOfRegion[intReg][9]="Prairie Creek";
mapCalgRES_idOfRegion[intReg][10]="Saprae Creek Estates";  mapCalgRES_nameOfRegion[intReg][10]="Saprae Creek Estates"; mapCalgRES_valueOfRegion[intReg][10]="Saprae Creek Estates";
mapCalgRES_idOfRegion[intReg][11]="Thickwood Heights";  mapCalgRES_nameOfRegion[intReg][11]="Thickwood Heights"; mapCalgRES_valueOfRegion[intReg][11]="Thickwood Heights";
mapCalgRES_idOfRegion[intReg][12]="Timberlea";  mapCalgRES_nameOfRegion[intReg][12]="Timberlea"; mapCalgRES_valueOfRegion[intReg][12]="Timberlea";
mapCalgRES_idOfRegion[intReg][13]="Waterways";  mapCalgRES_nameOfRegion[intReg][13]="Waterways"; mapCalgRES_valueOfRegion[intReg][13]="Waterways";
mapCalgRES_idOfRegion[intReg][14]="Wood Buffalo";  mapCalgRES_nameOfRegion[intReg][14]="Wood Buffalo"; mapCalgRES_valueOfRegion[intReg][14]="Wood Buffalo";



// Example Further Detail Arrays
var intNum = 0;
var intMax = 1;






var mapCalgRES_strList= new Array(14);
var mapCalgRES_strOptions = new Array(14);






//Populates strings with the entire list to be used for larger areas, such as all of the north east.  It will add all the regions in the northeast into
//the string to be submitted.


var intTitleLength = mapCalgRES_titleOfArea.length;
for (var n=0; n < intTitleLength; n++){
	mapCalgRES_strList[n] = new Array();
	mapCalgRES_strOptions[n] = new Array();
	


	for (var i=0; i < mapCalgRES_nameOfRegion[n].length; i++)
	{
		//alert (mapCalgRES_titleOfArea[i]);
		if (mapCalgRES_nameOfRegion[n][i])
		{
			//mapCalgRES_strList[n] = mapCalgRES_strList[n] + '"' + mapCalgRES_valueOfRegion[n][i] + '",';
			mapCalgRES_strList[n] = mapCalgRES_strList[n] + '"' + mapCalgRES_idOfRegion[n][i] + '",';
			mapCalgRES_strOptions[n] = mapCalgRES_strOptions[n] + '<option value=\'"'+mapCalgRES_idOfRegion[n][i]+'"\'>'+mapCalgRES_nameOfRegion[n][i]+'</option>\n';			
			
			//	mapCalgRES_strOptions[n] = mapCalgRES_strOptions[n] + '<option value=\'\"'+mapCalgRES_valueOfRegion[n][i]+'\"\'>'+mapCalgRES_nameOfRegion[n][i]+'</option>';						
		}
	}


	if(mapCalgRES_strList[n] != '')
	{
		mapCalgRES_strList[n] = mapCalgRES_strList[n].substring(0,mapCalgRES_strList[n].length-1);
	}
	else
	{
		mapCalgRES_strList[n] = mapCalgRES_strList[n] + '"' + mapCalgRES_idOfRegion[n] + '"';
	}
	
}
//Function : to show the title and the side panel
function mapCalgRES_showAt(id,mapCalgRES_titleLayer,mapCalgRES_sideLayer,region,strPosition) {
	// mapCalgRES_showAt(0,'mapCalgRES_titleLayerSW',false,32,'right')
	strPosition = undefined;
//	alert("id: " + id + '\n' + "mapCalgRES_titleLayer: " + mapCalgRES_titleLayer + '\n' + "mapCalgRES_sideLayer: " + mapCalgRES_sideLayer + '\n' + "region: " + region + '\n' + "strPosition: " + strPosition + '\n');
    var x=y=0;
	var sidebarhtml="";
	var titlexinsert = 0;
	
	if (strPosition == "center")
		titlexinsert = 0;
	else if (strPosition == "right")
		titlexinsert = 50;
	else if (strPosition == "rightfarther")
		titlexinsert = 67;


	var blnValueSelected = false;
	var strSelectBox = getSelectBox();
	var MyList = "";
		
		if (mapCalgRES_valueOfRegion[id][region] != undefined)
		{
	for (var i = 0; i < strSelectBox.options.length; i++) 
	{
			var strTmpValue = '"'+mapCalgRES_valueOfRegion[id][region]+'"';
			var strListValue = new String(strSelectBox.options[i].value);
			
			if(strSelectBox.options[i].value==(strTmpValue))
			{
				//alert(strSelectBox.options[i].value);
				if (strSelectBox.options[i].selected)
					blnValueSelected = true;
			}
			/*
			MyList = MyList + "#" + strListValue + "# --- #" + strTmpValue + "#\n";
			if (strListValue.indexOf(strTmpValue) != -1)
			{
				
				if (strSelectBox.options[i].selected)
					blnValueSelected = true;
			}
			*/
			
			
	}
	//alert(MyList);
		}
	
	//if ((region)||(region==0))
	if (region>=0){
		if (blnValueSelected)
			mapCalgRES_changeContent (mapCalgRES_titleLayer, '<img name="checkit" src="../images/maps/checkit.gif" border="0" align="bottom"> ' + mapCalgRES_nameOfRegion[id][region]);
		else
			mapCalgRES_changeContent (mapCalgRES_titleLayer, mapCalgRES_nameOfRegion[id][region]);


	}else {
		mapCalgRES_changeContent (mapCalgRES_titleLayer, mapCalgRES_titleOfArea[id]);
	}
		
	if (document.getElementById) {//netscape 6 and above


		document.getElementById('mapCalgRES_titleLayer').style.visibility = 'hidden';		


		
		document.getElementById(mapCalgRES_titleLayer).style.left = mapCalgRES_titleposx+titlexinsert;
		document.getElementById(mapCalgRES_titleLayer).style.top = mapCalgRES_titleposy-5;
		document.getElementById(mapCalgRES_titleLayer).style.visibility = 'visible';
		
	}
    else if (document.layers && document.layers[mapCalgRES_titleLayer] != null) {//netscape 4
	
		document.layers['mapCalgRES_titleLayer'].style.visibility = 'hidden';
		
	
        document.layers[mapCalgRES_titleLayer].left = mapCalgRES_titleposx+titlexinsert;
        document.layers[mapCalgRES_titleLayer].top = mapCalgRES_titleposy;
        document.layers[mapCalgRES_titleLayer].visibility = 'visible';
    }
    else if (document.all) { //internet explorer


		document.all['mapCalgRES_titleLayer'].style.visibility = 'hidden';




        document.all[mapCalgRES_titleLayer].style.posLeft = mapCalgRES_titleposx+titlexinsert;
        document.all[mapCalgRES_titleLayer].style.posTop = mapCalgRES_titleposy;
        document.all[mapCalgRES_titleLayer].style.visibility = 'visible';
    }
	




   return
}
//Function to change the content in the layer
function mapCalgRES_changeContent(layerid,shtml) {
	var newshtml = shtml;
	//newshtml =  addanewline(shtml, " ", "<BR>",15);
   if (document.getElementById || document.all) {
      var el = document.getElementById? document.getElementById(layerid): document.all[layerid];
      if (el && typeof el.innerHTML != "undefined") el.innerHTML = newshtml;
   }
   return
}
//function hides the layer
function mapCalgRES_hide(mapCalgRES_titleLayer,mapCalgRES_sideLayer) {
	//mapCalgRES_hide title layer

		
	if (document.getElementById)	
		document.getElementById(mapCalgRES_titleLayer).style.visibility = 'hidden';
    else if (document.layers && document.layers[mapCalgRES_titleLayer] != null)
        document.layers[mapCalgRES_titleLayer].visibility = 'hidden';
    else if (document.all)
        document.all[mapCalgRES_titleLayer].style.visibility = 'hidden';

	
	//mapCalgRES_hide side layer
	if (mapCalgRES_sideLayer) {
		if (document.getElementById)	
			document.getElementById(mapCalgRES_sideLayer).style.visibility = 'hidden';
		else if (document.layers && document.layers[mapCalgRES_sideLayer] != null)
			document.layers[mapCalgRES_sideLayer].visibility = 'hidden';
		else if (document.all)
			document.all[mapCalgRES_sideLayer].style.visibility = 'hidden';
	}
   return
}
//This function is used for selecting areas from a map.  It populates a select box based on what region is selected.
function mapCalgRES_selectRegion(id,region,area,strPosition) {
	//alert('region:'+region);
	
	var strTitleLayers = new Array();
	strTitleLayers[0] = "mapCalgRES_titleLayer";
	strTitleLayers[1] = "mapCalgRES_titleLayer";
	strTitleLayers[2] = "mapCalgRES_titleLayer";	






	var strSelectBox = getSelectBox();
	for (var i = 0; i < strSelectBox.options.length; i++) {
		if (area){
			if(strSelectBox.options[i].value==mapCalgRES_strList[id]){
				//alert(strSelectBox.options[i].value);
				if (strSelectBox.options[i].selected)
					strSelectBox.options[i].selected = false;
				else
					strSelectBox.options[i].selected = true;
			}
		} else {
			
			//if(strSelectBox.options[i].value==('"'+mapCalgRES_valueOfRegion[id][region]+'"')){
				
				if(strSelectBox.options[i].value==('"' + mapCalgRES_idOfRegion[id][region] + '"' ))
				{				
				
				//alert(strSelectBox.options[i].value);
				if (strSelectBox.options[i].selected)
					strSelectBox.options[i].selected = false;
				else
					strSelectBox.options[i].selected = true;


				mapCalgRES_hide('mapCalgRES_titleLayer',false);	
				mapCalgRES_hide(strTitleLayers[id],false);						
				
				mapCalgRES_showAt(id,'mapCalgRES_titleLayer',false,region,strPosition);
			}
		}
	}
	chgAction();
}


//This function is used when the form is submitted.  IT does nothing else but display in an alert box the values of the select box.
// NOTE: This function can be omitted.  It is for debug purposes only.
function mapCalgRES_submitFrm () {
	var strSelectBox = getSelectBox();
	var mapCalgRES_strList = "";
	
	// Deselect all options without values
		 for (var i=0; i<strSelectBox.options.length; i++) 
		 {
		
			if (strSelectBox.options[i].value == "")
			{		
				strSelectBox.options[i].selected = false;
			}
		  }	
	
	for (var i = 0; i < strSelectBox.options.length; i++) {
		if(strSelectBox.options[i].selected){
			mapCalgRES_strList = mapCalgRES_strList + strSelectBox.options[i].value +',';
		}
	}
	mapCalgRES_strList = mapCalgRES_strList.substring(0,mapCalgRES_strList.length-1);
	//alert ('Zones : '+mapCalgRES_strList);
//	
	//return false
	return true;
}
// This function displays an additoinal layer with the quadrant title.
function mapCalgRES_changeMapLayer(mapLayer,quadranttitle) {




		if(quadranttitle){
			//alert(quadranttitle);
			mapCalgRES_changeContent('mapCalgRES_quadranttitle',quadranttitle)
		}
		else {
			mapCalgRES_changeContent('mapCalgRES_quadranttitle','')
			
		}




		if(mapLayer!="CalgaryMapLayer")
		{
			if (document.getElementById)
			{
				document.getElementById('mapCalgRES_quadranttitle').style.visibility = 'visible';
			}
			else if (document.layers && document.layers[mapLayer] != null)
			{
				document.layers[mapCalgRES_quadranttitle].style.visibility = 'visible';
			}
			else if (document.all)
			{
				document.all[mapCalgRES_quadranttitle].style.visibility = 'visible';
			}


		}

		
		if (document.getElementById) {//netscape 6 and above
		
	
							 
			if (mapLayer != 'mapSA_RURAL_mapLayer')
			{
			document.getElementById('CalgaryMapLayer').style.visibility = 'hidden';
			document.getElementById('rdcityLayer').style.visibility = 'hidden';
			}
			
			
			
			document.getElementById(mapLayer).style.visibility = 'visible';
		}
		else if (document.layers && document.layers[mapLayer] != null) {
		

			document.layers['CalgaryMapLayer'].style.visibility = 'hidden';
			document.layers['rdcityLayer'].style.visibility = 'hidden';


			document.layers[mapLayer].style.visibility = 'visible';
		}
		else if (document.all) {		
		
			document.all['CalgaryMapLayer'].style.visibility = 'hidden';
			document.all['rdcityLayer'].style.visibility = 'hidden';



			document.all[mapLayer].style.visibility = 'visible';
		}


}


/**************************************  RURAL MAPS  *********************************/
// These maps differ from the residential maps in that they show a side panel with a listing of all the regions.  So when you select an area on the
// map, it selects all the regions within that area.


//positions the title and the side panel.
var mapSA_RURAL_titleposx = 125;
var mapSA_RURAL_titleposy = -553;
var mapSA_RURAL_sidelayerposx = 20;
var mapSA_RURAL_sidelayerposy = -330;


var mapSA_RURAL_titleOfArea = new Array();
var mapSA_RURAL_nameOfRegion = new Array();
var mapSA_RURAL_idOfRegion = new Array();


//Data for the Titles and the Regions.
mapSA_RURAL_titleOfArea[0] = "Rural Northeast (Zone 60)";
mapSA_RURAL_nameOfRegion[0] = "Rural Northeast (Zone 60)";
mapSA_RURAL_idOfRegion[0] = "60";


mapSA_RURAL_titleOfArea[1] = "Rural Northwest (Zone 70)";
mapSA_RURAL_nameOfRegion[1] = "Rural Northwest (Zone 70)";
mapSA_RURAL_idOfRegion[1] = "70";


mapSA_RURAL_titleOfArea[2] = "Rural Southeast (Zone 80)";
mapSA_RURAL_nameOfRegion[2] = "Rural Southeast (Zone 80)";
mapSA_RURAL_idOfRegion[2] = "80";


mapSA_RURAL_titleOfArea[3] = "Rural Southwest (Zone 90)";
mapSA_RURAL_nameOfRegion[3] = "Rural Southwest (Zone 90)";
mapSA_RURAL_idOfRegion[3] = "90";






//this function shows the title and side panel
function mapSA_RURAL_showAt(id,mapSA_RURAL_titleLayer,mapSA_RURAL_sideLayer) 
{
	
	
		mapSA_RURAL_titleLayer = 'mapCalgRES_titleLayerRural';
		strPosition = "left";
	var x=y=0;
	var sidebarhtml="";
	var titlexinsert = 0;
	
	if (strPosition == "center")
		titlexinsert = 0;
	else if (strPosition == "right")
		titlexinsert = 50;
	else if (strPosition == "rightfarther")
		titlexinsert = 67;
	else if (strPosition == "left")
		titlexinsert = -20;		


	var blnValueSelected = false;
	var strSelectBox = getSelectBox();


	for (var i = 0; i < strSelectBox.options.length; i++) {
			if(strSelectBox.options[i].value==('"'+mapSA_RURAL_idOfRegion[0]+'"')){
				//alert(strSelectBox.options[i].value);
				if (strSelectBox.options[i].selected)
					blnValueSelected = true;
			}
	}
					
		
	//if ((region)||(region==0))
	
		if (blnValueSelected)
		{
			mapSA_RURAL_changeContent (mapSA_RURAL_titleLayer, '<img name="checkit" src="../images/maps/checkit.gif" border="0" align="bottom"> ' + mapSA_RURAL_nameOfRegion[id]);
		}
		else
		{
						
			mapSA_RURAL_changeContent (mapSA_RURAL_titleLayer, mapSA_RURAL_nameOfRegion[id]);
						
		}
	
		


	if (document.getElementById) {//netscape 6 and above


	if (document.getElementById('mapCalgRES_titleLayerSW') != null)
	{
		document.getElementById('mapCalgRES_titleLayerSW').style.visibility = 'hidden';
		document.getElementById('mapCalgRES_titleLayer').style.visibility = 'hidden';		
		document.getElementById('mapCalgRES_titleLayerNW').style.visibility = 'hidden';		
		document.getElementById('mapCalgRES_titleLayerC').style.visibility = 'hidden';		
		document.getElementById('mapCalgRES_titleLayerNE').style.visibility = 'hidden';		
		document.getElementById('mapCalgRES_titleLayerSE').style.visibility = 'hidden';		
		document.getElementById('mapCalgRES_titleLayerW').style.visibility = 'hidden';		
	}
		document.getElementById('mapCalgRES_titleLayerRural').style.visibility = 'hidden';		


		document.getElementById(mapSA_RURAL_titleLayer).style.left = mapCalgRES_titleposx+titlexinsert;
		document.getElementById(mapSA_RURAL_titleLayer).style.top = mapCalgRES_titleposy-5;
		document.getElementById(mapSA_RURAL_titleLayer).style.visibility = 'visible';


		
	}
    else if (document.layers && document.layers[mapCalgRES_titleLayer] != null) {//netscape 4
	
	if (document.layers['mapCalgRES_titleLayerSW'] != null)
	{
		document.layers['mapCalgRES_titleLayerSW'].style.visibility = 'hidden';
		document.layers['mapCalgRES_titleLayer'].style.visibility = 'hidden';		
		document.layers['mapCalgRES_titleLayerNW'].style.visibility = 'hidden';		
		document.layers['mapCalgRES_titleLayerC'].style.visibility = 'hidden';		
		document.layers['mapCalgRES_titleLayerNE'].style.visibility = 'hidden';		
		document.layers['mapCalgRES_titleLayerSE'].style.visibility = 'hidden';		
		document.layers['mapCalgRES_titleLayerW'].style.visibility = 'hidden';		
		document.layers['mapCalgRES_titleLayerRural'].style.visibility = 'hidden';			
	}
	
        document.layers[mapSA_RURAL_titleLayer].left = mapCalgRES_titleposx+titlexinsert;
        document.layers[mapSA_RURAL_titleLayer].top = mapCalgRES_titleposy;
        document.layers[mapSA_RURAL_titleLayer].visibility = 'visible';
    }
    else if (document.all) { //internet explorer


	if (document.all['mapCalgRES_titleLayerSW'] != null)
	{
		document.all['mapCalgRES_titleLayerSW'].style.visibility = 'hidden';
		document.all['mapCalgRES_titleLayer'].style.visibility = 'hidden';		
		document.all['mapCalgRES_titleLayerNW'].style.visibility = 'hidden';		
		document.all['mapCalgRES_titleLayerC'].style.visibility = 'hidden';		
		document.all['mapCalgRES_titleLayerNE'].style.visibility = 'hidden';		
		document.all['mapCalgRES_titleLayerSE'].style.visibility = 'hidden';		
		document.all['mapCalgRES_titleLayerW'].style.visibility = 'hidden';		
		document.all['mapCalgRES_titleLayerRural'].style.visibility = 'hidden';		
	}


        document.all[mapSA_RURAL_titleLayer].style.posLeft = mapCalgRES_titleposx+titlexinsert;
        document.all[mapSA_RURAL_titleLayer].style.posTop = mapCalgRES_titleposy;
        document.all[mapSA_RURAL_titleLayer].style.visibility = 'visible';
    }




   return
}


//this function changes the content of the html in the layer (it changes the title).
function mapSA_RURAL_changeContent(layerid,shtml) {
	
   if (document.getElementById || document.all) {
      var el = document.getElementById? document.getElementById(layerid): document.all[layerid];
      if (el && typeof el.innerHTML != "undefined") el.innerHTML = shtml;
   }
   return
}






//this function is for the mouseout action.  It hides the titles and side info when the mouse is taken off the image.
function mapSA_RURAL_hide(mapSA_RURAL_titleLayer,mapSA_RURAL_sideLayer) {
		
	mapSA_RURAL_titleLayer = 'mapCalgRES_titleLayerRural';
	
	//mapSA_RURAL_hide title layer
	if (document.getElementById)	
	{			
	
		document.getElementById(mapSA_RURAL_titleLayer).style.visibility = 'hidden';
	}
    else if (document.layers && document.layers[mapSA_RURAL_titleLayer] != null)
	{
			
        document.layers[mapSA_RURAL_titleLayer].visibility = 'hidden';
	}
    else if (document.all)
	{				
        document.all[mapSA_RURAL_titleLayer].style.visibility = 'hidden';	
	}


	//mapSA_RURAL_hide side layer


   return


}
//this function selects an image map, and populates the correct select box with the values.
function mapSA_RURAL_selectRegion(id) {
	
	var strSelectBox = getSelectBox();
	var frmField = strSelectBox.options[id];
	
	if (frmField.selected)
	frmField.selected = false;
	else
	frmField.selected = true;


	mapSA_RURAL_hide('mapSA_RURAL_titleLayer','mapSA_RURAL_sideLayer')
	mapSA_RURAL_showAt(id,'mapSA_RURAL_titleLayer','mapSA_RURAL_sideLayer');


}


function mapSA_RURAL_selectRegionAll()
{
	var intNum = 0;
	var strSelectBox = getSelectBox();
	
	while (intNum < strSelectBox.options.length)
	{
			strSelectBox.options[intNum].selected = true;
			
			intNum = intNum + 1;
	}


}




//this function is used when the form is submitted.  it does nothing but display an alert box with the submitted values from the maps.  
//NOTE: this function is not needed for implementation.
function mapSA_RURAL_fillValues() {
	
	var strSelectBox = getSelectBox();
	var rural_strList = "";


	for (var i = 0; i < strSelectBox.options.length; i++) {
		if(strSelectBox.options[i].selected){
			rural_strList = rural_strList + strSelectBox.options[i].value +',';
			//alert ('Zones:'+strSelectBox.options[i].value);
		}
	}
	rural_strList = rural_strList.substring(0,rural_strList.length-1);
	alert ('Zones : '+rural_strList);
	
	return false


}






/* *****************STANDARD FUNCTIONS ************************************************/


// This function adds a new line to the title if it is too long.
function addanewline(s, t, u,startIndex) {
  /*
  **  Replace a token in a string
  **    s  string to be processed
  **    t  token to be found and removed
  **    u  token to be inserted
  **  returns new String
  */
  i = s.indexOf(t,startIndex);
  r = "";
  if (i == -1) return s;
  
  r += s.substring(0,i) + u;
	//alert (r);
  
    r += s.substring(i);
  return r;
}
// This function changes between the overall maps.  Currently it swaps between the 3 maps, Residential, Rural and Mobile Park.  
function changeMap(frmField) {
//	alert('HERE2');
	var mapLayer = "";
			
			for (var n = 0; n < frmField.options.length; n++) {
				if(frmField.options[n].selected){
					for (var i = 0; i < document.forms.length; i++) 
					{
						
						if (document.forms[i].name == "newlistingsearch")
						{
							if ((frmField.options[n].value==4)||(frmField.options[n].value==8)||(frmField.options[n].value==12))
							{
								mapLayer = "mapSA_RURAL_mapLayer";
							}


							else {
								mapLayer = "CalgaryMapLayer";
							}
						}
						
						if (document.forms[i].name == "lowpaymentsearch")
						{
							 
							if ((frmField.options[n].value==4)||(frmField.options[n].value==8)||(frmField.options[n].value==12)){
								mapLayer = "mapSA_RURAL_mapLayer";
							}
							else {
								mapLayer = "CalgaryMapLayer";
							}
						}




					}		


				}
			}




			//mapLayer = "CalgaryMapLayer";
		mapCalgRES_changeMapLayer(mapLayer,"");
		return;
		
		/*
		if (document.getElementById) {//netscape 6 and above
			document.getElementById('CalgaryMapLayer').style.visibility = 'hidden';
			document.getElementById('nwLayer').style.visibility = 'hidden';
			document.getElementById('neLayer').style.visibility = 'hidden';
			document.getElementById('seLayer').style.visibility = 'hidden';
			document.getElementById('swLayer').style.visibility = 'hidden';
			document.getElementById('mapSA_RURAL_mapLayer').style.visibility = 'hidden';
			document.getElementById('mapCalgRES_quadranttitle').style.visibility = 'hidden';
			
			document.getElementById(mapLayer).style.visibility = 'visible';
		}
		else if (document.layers && document.layers[mapLayer] != null) {
			document.layers['CalgaryMapLayer'].style.visibility = 'hidden';
			document.layers['nwLayer'].style.visibility = 'hidden';
			document.layers['neLayer'].style.visibility = 'hidden';
			document.layers['seLayer'].style.visibility = 'hidden';
			document.layers['swLayer'].style.visibility = 'hidden';
			document.layers['mapSA_RURAL_mapLayer'].style.visibility = 'hidden';
			document.layers['mapCalgRES_quadranttitle'].style.visibility = 'hidden';


			document.layers[mapLayer].style.visibility = 'visible';
		}
		else if (document.all) {
			document.all['CalgaryMapLayer'].style.visibility = 'hidden';
			document.all['nwLayer'].style.visibility = 'hidden';
			document.all['neLayer'].style.visibility = 'hidden';
			document.all['seLayer'].style.visibility = 'hidden';
			document.all['swLayer'].style.visibility = 'hidden';
			document.all['mapSA_RURAL_mapLayer'].style.visibility = 'hidden';
			document.all['mapCalgRES_quadranttitle'].style.visibility = 'hidden';


			document.all[mapLayer].style.visibility = 'visible';
		}
		*/
}
// Function to get the select box name from the forms on the page.
function getSelectBox() {
		//alert("here");
	for (var i = 0; i < document.forms.length; i++) {
		//alert (document.forms[i].name);
		if (document.forms[i].name=="housesearch")
			return document.forms[i].NEIGHBOURHOOD;
		else if (document.forms[i].name=="condosearch")
			return document.forms[i].NEIGHBOURHOOD;
		else if (document.forms[i].name=="lotsearch")
			return document.forms[i].NEIGHBOURHOOD;
		else if (document.forms[i].name=="acreagehomesearch")
			return document.forms[i].NEIGHBOURHOOD;
		else if (document.forms[i].name=="acreagenohomesearch")
			return document.forms[i].NEIGHBOURHOOD;
		else if (document.forms[i].name=="mobilesearch")
			return document.forms[i].NEIGHBOURHOOD;
		else if (document.forms[i].name=="commercialsearch")
			return document.forms[i].NEIGHBOURHOOD;
		else if (document.forms[i].name=="newhousesearch")
			return document.forms[i].NEIGHBOURHOOD;
		else if (document.forms[i].name=="lowpaymentsearch")
			return document.forms[i].NEIGHBOURHOOD;
		else if (document.forms[i].name=="newlistingsearch")
			return document.forms[i].NEIGHBOURHOOD;
	}
}


function LoadImage(imageName,imageFile)
{
	var loadingImage = false;
	
  if ((!document.images) || loadingImage) return;
  loadingImage = true;
  
imgTmp = new Image();
imgTmp.src = imageFile;




document.images[imageName] = imgTmp; 


/*  
	if (document.images[imageName].src.indexOf(imageFile)<0)
	{
		document.images[imageName].src = imageFile;
	}
*/  
  loadingImage = false;
}


LoadImage('checkit','../images/maps/checkit.gif');
