
//which tools are to be present
var identify = true;
var zoomin = true;
var zoomout = true;
var pan = true;
var pan1 = true;
 
//inital tool setup
var initialTool = new String;
var tool = new String;
var initialTool = "identify";
var tool = initialTool;

//toolpic setting
function resetToolPic() { 
	//set ToolPics to non-set
	if (identify) parent.ButtonFrame.document.identify.src="/images/select_bridge.gif";
	if (zoomin) parent.ButtonFrame.document.zoomin.src= "/images/zoomin_high.gif";
	if (zoomout) parent.ButtonFrame.document.zoomout.src= "/images/zoomout_high.gif";
	//if (pan) parent.ButtonFrame.document.pan.src= "/images/pan_high.gif";
	if (pan1)  parent.ButtonFrame.document.pan1.src= "/images/pan_high.gif"; 
	 
}
		
function setToolPic(selTool) {   
	resetToolPic();
	if (selTool == "identify") parent.ButtonFrame.document.identify.src= "/images/select_bridge_over.gif";
	if (selTool == "zoomin") parent.ButtonFrame.document.zoomin.src= "/images/zoomin_low.gif";
	if (selTool == "zoomout") parent.ButtonFrame.document.zoomout.src= "/images/zoomout_low.gif";
	//if (selTool == "pan") parent.ButtonFrame.document.pan.src= "/images/pan_low.gif";
	if (selTool == "pan1")   parent.ButtonFrame.document.pan1.src= "/images/pan_low.gif";  
	 
}

function setTool(selectedTool) {
	switch (selectedTool) {
		
		case "zoomin":
		//	parent.MapFrame.document.mapserv.mode.value = "browse";
			parent.MapFrame.document.mapserv.zoomdir.value = 1;
			zoomdir = 1;
			tool = "zoomin";		
		break;
		
		case "zoomout":
		//	parent.MapFrame.document.mapserv.mode.value = "browse";
			parent.MapFrame.document.mapserv.zoomdir.value = -1;
			zoomdir = -1;
			tool = "zoomout";
		
		break;
		
		case "fullextent":
		
		        //alert( parent.MapFrame.document.mapserv.mode.value);
		         fullview();
		         		        
		break;
			
	        case "refresh" :
		//	parent.MapFrame.document.mapserv.mode.value = "browse";
			parent.MapFrame.document.mapserv.zoomdir.value = "0";
			zoomdir = 0;
		//	parent.MapFrame.document.mapserv.submit();
			return(false)
		break;
		
		case "pan":
		        
		        //alert( parent.MapFrame.document.mapserv.mode.value);
		//	mode = "browse";
		        if (theSelection != "")
			{  
			  parent.MapFrame.document.mapserv.mode.value = "itemnquery";			   
	                }
	                else
	                { 
	                  parent.MapFrame.document.mapserv.mode.value="browse";
	                }  
			parent.MapFrame.document.mapserv.zoomdir.value = 0;
			zoomdir = 0;
			tool = "panning";			
									
		break;
		
		case "identify":
		 //	parent.MapFrame.document.mapserv.mode.value="query";
			tool = "identify";
		
		break;	
		
		case "pan1":
			 
			parent.MapFrame.document.mapserv.zoomdir.value = 0;
			zoomdir = 0;
			tool = "panningn";			
				
		break;
	}
}



function fullview()
{  
   if (parent.MapFrame.document.mapserv.mode.value == "itemnquery")
	{     
	       parent.MapFrame.document.mapserv.mapext.value= fullExtent;
	       URLString = new String;
	       imageext = new String;

	       URLString = "/cgi-bin/mapserv.exe?map="+escape(parent.MapFrame.document.mapserv.map.value);

	       parseImgExt();

	       for (i=0; i<newext.length; i++) 
		  {   imageext += newext[i];
		      if (i<newext.length-1) imageext += "+";
		  }

	       URLString += "&imgext=" + imageext;		  
	       URLString += "&mapext=" + parent.MapFrame.document.mapserv.mapext.value;
	       URLString += "&imgxy="+mouseX+"+"+mouseY;		       

	       if (theSelection != "")
	       {
		     URLString += "&mode=itemnquery";
		     URLString += "&qlayer=bridge&map_querymap_size=" + imgxy + "&map_bridge_header=demo.html&map_bridge_template=zoomto.html&map_web_error=../zoomaway.html&map_bridge_filter=" + theSelection;
		}

		parent.MapFrame.location.href = URLString;
	}

	else
	{	

		parent.MapFrame.document.mapserv.mode.value="browse";
		parent.MapFrame.document.mapserv.mapext.value= fullExtent;
		parent.MapFrame.document.mapserv.submit();
	}	

}	
