
// -----------------------------------------------------------------
//						Redland Shire Council 
// -----------------------------------------------------------------
// Class    : Toolbar 
// Purpose  : Handles toolbar mouseover highlighting,
//			  and highlights them when selected etc.
// -----------------------------------------------------------------
// Calls    :
// Called by: default.aspx mouseover/onclick events
// -----------------------------------------------------------------
// Arguments:
// Globals  :
// Returns  :
// -----------------------------------------------------------------
// Notes    :
// -----------------------------------------------------------------
// History  :
// =================================================================


//Unhighlights all of the tools on the toolbar that have a persistent
//state so a new one can be highlighted
function unHighlightAll()
{
	if (document.getElementById('imgZoomIn')) document.getElementById('imgZoomIn').style.background='#0066CC';
	if (document.getElementById('imgZoomOut')) document.getElementById('imgZoomOut').style.background='#0066CC';
	if (document.getElementById('imgPan')) document.getElementById('imgPan').style.background='#0066CC';
	if (document.getElementById('imgInfo')) document.getElementById('imgInfo').style.background='#0066CC';
	if (document.getElementById('imgMeasure')) document.getElementById('imgMeasure').style.background='#0066CC';
	if (document.getElementById('imgSelect')) document.getElementById('imgSelect').style.background='#0066CC';
	if (document.getElementById('imgCoord')) document.getElementById('imgCoord').style.background='#0066CC';
	if (document.getElementById('imgAddText')) document.getElementById('imgAddText').style.background='#0066CC';
	if (document.getElementById('imgAsCon')) document.getElementById('imgAsCon').style.background='#0066CC';
		
	//Hide the select tools
	document.getElementById('selectToolbar').style.display = 'none';

}

//Hightlighs the tool passed to this function
function highlightMe(thisImage)
{
	//Unhighlight the current tool
	unHighlightAll();
	
	//Highlight the new tool that was clicked on
	thisImage.style.background='#3399CC';
}

//Re-highlights the current tool being used. This function is called after a postback.
function restoreCurrentTool()
{
	//Unhighlight the current tool
	unHighlightAll();

	//Check which tool was just used and restore it
	switch (document.getElementById('txtCurrentTool').value)
	{
		case "ZoomIn":
			//Re-highlight the zoomin tool
			document.getElementById('imgZoomIn').style.background='#3399CC';
		break
		
		case "ZoomOut":
			//Re-highlight the zoomout tool
			document.getElementById('imgZoomOut').style.background='#3399CC';
		break
				
		case "Pan":
			//Re-highlight the pan tool
			document.getElementById('imgPan').style.background='#3399CC';
		break
		
		case "ResizeMapWindow":
			//Re-highlight the zoomin tool
			document.getElementById('imgZoomIn').style.background='#3399CC';
		break
		
		case "ZoomToFullExtent":
			//Re-highlight the zoomin tool
			document.getElementById('imgZoomIn').style.background='#3399CC';
		break
		
		case "ClearSelection":
			//Re-highlight the zoomin tool
			document.getElementById('imgZoomIn').style.background='#3399CC';
		break
		
		case "ZoomToLastExtent":
			//Re-highlight the zoom to last extent tool
			document.getElementById('imgZoomIn').style.background='#3399CC';
		break
		
		case "Select":
			//Re-highlight the feature select tool
			document.getElementById('imgSelect').style.background='#3399CC';
			//Also need to make sure that the select tools is visible
			document.getElementById('selectToolbar').style.display='block';
		break
		
		case "SelectAdd":
			//Re-highlight the feature select tool
			document.getElementById('imgSelect').style.background='#3399CC';
			//Also need to make sure that the select tools is visible
			document.getElementById('selectToolbar').style.display='block';
			document.getElementById('txtCurrentTool').value='Select';
		break
		
		case "SelectAdjoining":
			//Re-highlight the feature select tool
			document.getElementById('imgSelect').style.background='#3399CC';
			//Also need to make sure that the select tools is visible
			document.getElementById('selectToolbar').style.display='block';
			document.getElementById('txtCurrentTool').value='Select';
		break

		case "AsCon":
			//Re-highlight the zoomin tool
			document.getElementById('imgAsCon').style.background='#3399CC';
		break
		
		case "AddText":
			//Show the Add Text div again.
			//showCommonDiv('Add Text',240,150,300,63,'AddText.htm',true,false,false);
			
			// highlight the default tool - Zoom In
			document.getElementById('imgZoomIn').style.background='#3399CC';
			document.getElementById('txtCurrentTool').value='ZoomIn';
		break
				
		default: 
			//Re-highlight the zoomin tool
			document.getElementById('imgZoomIn').style.background='#3399CC';
	}
}
