
	var aVis = new Array();
	var aInf = new Array();
	var aAct = new Array();
	var aAvl = new Array();
	var aBuf = new Array();
	var aRel = new Array();
	var aFet = new Array();
	var aLid = new Array();
	var aLab = new Array();
	var visLayersList = '';
	var infLayersList = '';
	var actLayersList = '';
	var labLayersList = '';
	var mouseOverColor = 'orange';
	
	
	function initLayers(){			
			visList = document.layerElements.visList.value;
			aVis = visList.split(",");
			
			infList = document.layerElements.infList.value;
			aInf = infList.split(",");
			
			actList = document.layerElements.actList.value;
			aAct = actList.split(",");
			
			labList = document.layerElements.labList.value;
			aLab = labList.split(",");
			
			avlList = document.layerElements.avlList.value;
			aAvl = avlList.split(",");
			
			bufList = document.layerElements.bufList.value;
			aBuf = bufList.split(",");
			
			relList = document.layerElements.relList.value;
			aRel = relList.split(",");
			
			fetList = document.layerElements.fetList.value;
			aFet = fetList.split(",");
			
			lidList = document.layerElements.lidList.value;
			aLid = lidList.split(",");
			
			namList = document.layerElements.namList.value;
			aNam = namList.split(",");
						
			return;			
	}

	
	//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
			
	

	function relVis(){
		for (var row = 0; row <= aVis.length-1; ++row){
			if(aRel[row]!='99'){				
				masterVisLay = aRel[row];
				for (var row2 = 0; row2 <= aVis.length-1; ++row2){
					if(aLid[row2]== masterVisLay){
						aVis[row] = aVis[row2];												
					}
				}			
			}	
		}
		visChange();
	}
		

	
	function visOver(id){
	origVisColor = fLayers.document.getElementById(id).style.color;
		if(origVisColor != '#888888'){			
			fLayers.document.getElementById(id).style.cursor = 'hand';			
			fLayers.document.getElementById(id).style.color = mouseOverColor;					
		}								
	}
	
	function visOut(id){
	fLayers.document.getElementById(id).style.cursor = '';
	newVisColor = fLayers.document.getElementById(id).style.color;
		if (newVisColor == mouseOverColor){
			fLayers.document.getElementById(id).style.color = origVisColor;
			}								
	}
		
	function visDown(id){		
		idLength = id.length;		
		idRow = id.substring(0,idLength-3);	
		if(aVis[idRow] != '2')fLayers.document.getElementById(id).style.border = "thin inset";					
	}	
				
	function visUp(id){
		idLength = id.length;		
		idRow = id.substring(0,idLength-3);						
		fLayers.document.getElementById(id).style.border = "thin outset";
		if(aVis[idRow]!=2){
			if(aVis[idRow] == '1'){aVis[idRow]= '0';
			}					
			else{aVis[idRow]= '1';
			}				
		}
		relVis();															
	}
	
	function visChange(){					
		for (var row = 0; row <= aVis.length-1; ++row){
			if(aAvl[row]==1){
				id=row+'vis';				
				switch(aVis[row]){				
					case "0":					
						fLayers.document.getElementById(id).style.color = "#444444";																								
					break;					
					case "1":					
						fLayers.document.getElementById(id).style.color = "c0002d";												
					break;				
					case "2":					
						fLayers.document.getElementById(id).style.color = "#888888";																			
					break;
				}
			}				
		}		
	createVisLayerList();						
	}
	

	
	
	function createVisLayerList(){			//creates visible layers list for display toggle
	visLayersList='';
		for (var row = 0; row <= aVis.length-1; ++row){			
			if(aVis[row] == 1){
				if (visLayersList > ''){
					visLayersList = visLayersList+","+aLid[row];
				}
				else{
					visLayersList = aLid[row];
				}		
			}				
		}
		parent.document.s2sSelect.visList.value=visLayersList;
		parent.document.s2sSelect.submit();		
		parent.fLegend.location.reload(true);
		reDisplay();								
	}		
				
	//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
	
	function infOver(id){
	origInfColor = fLayers.document.getElementById(id).style.color;
		if(origInfColor != '#888888'){			
			fLayers.document.getElementById(id).style.cursor = 'hand';			
			fLayers.document.getElementById(id).style.color = mouseOverColor;					
		}								
	}
	
	function infOut(id){
	fLayers.document.getElementById(id).style.cursor = '';
	newInfColor = fLayers.document.getElementById(id).style.color;
		if (newInfColor == mouseOverColor){
			fLayers.document.getElementById(id).style.color = origInfColor;
			}								
	}	
		
	function infDown(id){		
		idLength = id.length;		
		idRow = id.substring(0,idLength-3);	
		if(aInf[idRow] != '2')fLayers.document.getElementById(id).style.border = "thin inset";					
	}
			
	function infUp(id){
		idLength = id.length;		
		idRow = id.substring(0,idLength-3);						
		fLayers.document.getElementById(id).style.border = "thin outset";
		if(aInf[idRow]!=2){
			if(aInf[idRow] == '1'){aInf[idRow]= '0';
			}					
			else{aInf[idRow]= '1';
			}				
		}		
		infChange();
	}
	
	function infChange(){					
		for (var row = 0; row <= aInf.length-1; ++row){
			if(aAvl[row]==1){
				id=row+'inf';				
				switch(aInf[row]){				
					case "0":					
						fLayers.document.getElementById(id).style.color = "#444444";																								
					break;					
					case "1":					
						fLayers.document.getElementById(id).style.color = "c0002d";												
					break;				
					case "2":					
						fLayers.document.getElementById(id).style.color = "#888888";																			
					break;
				}
			}				
		}
	createInfLayerList();						
	}
	
	
	function createInfLayerList(){			//creates information layers list for display toggle
		infLayersList='';
		for (var row = 0; row <= aInf.length-1; ++row){			
			if(aInf[row] == 1){
				if (infLayersList > ''){infLayersList = infLayersList+","+aLid[row];
				}
				else{infLayersList = aLid[row];
				}		
			}
			
		}
		parent.s2sSelect.infList.value=infLayersList;
		parent.document.s2sSelect.submit();						
	}					
	
	
	//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||	
	
	function labOver(id){
	origLabColor = fLayers.document.getElementById(id).style.color;
		if(origLabColor != '#888888'){			
			fLayers.document.getElementById(id).style.cursor = 'hand';			
			fLayers.document.getElementById(id).style.color = mouseOverColor;					
		}								
	}
	
	function labOut(id){
	fLayers.document.getElementById(id).style.cursor = '';
	newLabColor = fLayers.document.getElementById(id).style.color;
		if (newLabColor == mouseOverColor){
			fLayers.document.getElementById(id).style.color = origLabColor;
			}								
	}
	
			
	function labDown(id){		
		idLength = id.length;		
		idRow = id.substring(0,idLength-3);	
		if(aLab[idRow] != '2')fLayers.document.getElementById(id).style.border = "thin inset";					
	}
			
	function labUp(id){
		idLength = id.length;		
		idRow = id.substring(0,idLength-3);						
		fLayers.document.getElementById(id).style.border = "thin outset";
		if(aLab[idRow]!=2){
			if(aLab[idRow] == '1'){aLab[idRow]= '0';
			}					
			else{aLab[idRow]= '1';
			}				
		}		
		labChange();
	}
	
	function labChange(){							
		for (var row = 0; row <= aLab.length-1; ++row){
			if(aAvl[row]==1){
				id=row+'lab';				
				switch(aLab[row]){				
					case "0":					
						fLayers.document.getElementById(id).style.color = "#444444";																								
					break;					
					case "1":					
						fLayers.document.getElementById(id).style.color = "#c0002d";												
					break;				
					case "2":					
						fLayers.document.getElementById(id).style.color = "#888888";																			
					break;
				}
			}				
		}
	createLabLayerList();						
	}
	
	
	function createLabLayerList(){//creates label layers list for display toggle
		labLayersList='';
		for (var row = 0; row <= aLab.length-1; ++row){			
			if(aLab[row] == 1){
				if (labLayersList > ''){labLayersList = labLayersList+","+aLid[row];
				}
				else{labLayersList = aLid[row];
				}		
			}			
		}		
		parent.document.s2sSelect.labList.value=labLayersList;	
		parent.document.s2sSelect.submit();		
		parent.fLegend.location.reload(true);
		reDisplay();						
	}					
	
	
	//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||	
	
	function actOver(id){
	origActColor = fLayers.document.getElementById(id).style.color;
		if(origActColor != '#888888'){			
			fLayers.document.getElementById(id).style.cursor = 'hand';			
			fLayers.document.getElementById(id).style.color = mouseOverColor;					
		}								
	}
	
	function actOut(id){
	fLayers.document.getElementById(id).style.cursor = 'd';
	newActColor = fLayers.document.getElementById(id).style.color;
		if (newActColor == mouseOverColor){
			fLayers.document.getElementById(id).style.color = origActColor;
			}								
	}
	
	
		
	function actDown(id){		
		idLength = id.length;		
		idRow = id.substring(0,idLength-3);	
		if(aAct[idRow] != '2')fLayers.document.getElementById(id).style.border = "thin inset";							
	}
		
			
		function actUp(id,refresh){						
			idLength = id.length;			
			idRow = id.substring(0,idLength-3);						
			fLayers.document.getElementById(id).style.border = "thin outset";
			if(aAct[idRow]!=2){							
				for (count = 0; count <= aAct.length-1; ++count){
					if(aAct[count] != '2'){
						aAct[count] = '0';													
						if(idRow==count){								
							aAct[count] = '1';																							
						}																			
					}						
				}
				actChange(refresh);
			}		
		}	
	
	function actChange(refresh){					
		for (var row = 0; row <= aAct.length-1; ++row){
			if(aAvl[row]==1){
				id=row+'act';				
				switch(aAct[row]){				
					case "0":					
						fLayers.document.getElementById(id).style.color = "#444444";
						fLayers.document.getElementById(id).style.background = "#B0C4DE";																			
					break;					
					case "1":					
						fLayers.document.getElementById(id).style.color = "#c0002d";
						fLayers.document.getElementById(id).style.background = "#c0002d";							
					break;				
					case "2":					
						fLayers.document.getElementById(id).style.color = "#888888";
						fLayers.document.getElementById(id).style.background = "#B0C4DE";													
					break;
				}
			}				
		}
	createActLayerList(refresh);						
	}
	
	
	function createActLayerList(refresh){				//creates information layers list for display toggle
		actLayersList='';
		for (var row = 0; row <= aAct.length-1; ++row){			
			if(aAct[row] == 1){
				if (actLayersList > ''){actLayersList = actLayersList+","+aLid[row];
				}
				else{actLayersList = aLid[row];
				}				
				if(refresh == 1){
					srchDialog="layer_"+actLayersList+"/srchDialog_"+actLayersList+".cfm";
					parent.fQueryDialog.location.replace(srchDialog);					
				}									
				parent.document.s2sSelect.actLayer.value=actLayersList;
				parent.document.s2sSelect.submit();																	
			}			
		}											
	}
	

	//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||	
	
	
	
	
	function metDown(id){
		idLength = id.length;		
		idRow = id.substring(0,idLength-3);
		layID = aLid[idRow];		
		fLayers.document.getElementById(id).style.border = "thin inset";
		fLayers.document.getElementById(id).style.color = "#c0002d";	
		metaDataFile ="mapMetaDataPg.cfm?ID="+layID;			
		var mapMetaData = window.showModalDialog(metaDataFile,"","help:no; dialogHeight:400px; dialogWidth:650px; status:no");
		fLayers.document.getElementById(id).style.border = "thin outset";
		fLayers.document.getElementById(id).style.color = "#555555";	
	}
		
		
	//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
