/* © Copyright 2008, Pitney Bowes MapInfo Corporation. All rights reserved. */
// This source code is provided under license on a royalty free basis for use by licensed users of the
// Exponare product. Licensed users may create derivative works of this source code for use solely in
// connection with Exponare. This source code is provided "AS IS". Pitney Bowes MapInfo Corporation makes no
// representations or warranties, express or implied with respect to this source code, including by way
// of example and not limitation, the implied warranties of merchantability and fitness for a
// particular purpose. The entire risk as to the modification and use of this source code is assumed by
// you. In no event shall Pitney Bowes MapInfo Corporation be liable to you or any other person regardless of the
// cause, for the effectiveness or accuracy of this source code, or for any special, indirect,
// incidental or consequential damages arising from or occasioned by your use of this source code in
// modified or unmodified form, even if advised of the possibility of such damages.
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
//
// CONSTANTS
//
//-----------------------------------------------------------------------------


//Exponare 3.5 Added for Cursor Change functionality.
//SetItemPressed function from Menu.js is Overloaded here.



// these are the values that appear in the drop down list for the left panel
//These are set in the configurator under the public interface left panel contents
//each item in the left panel has a "Name" property which must match the string below
//version 3.0 and 3.5
var InfoPanel="Information";
var QueriesPanel="Queries";
var AddressPanel="Address Search";
var LegendPanel="Legend";
var PrintPanel="Print";


// version 2.4
//var InfoPanel="Info Results";
//var QueriesPanel="Queries";
//var AddressPanel="Find Address";
//var LegendPanel="Legend";
//var PrintPanel="Printing";


//version 2.3
//var InfoPanel="Info results page view";
//var QueriesPanel="Queries";
//var AddressPanel="Find Address";
//var LegendPanel="Legend";
//var PrintPanel="Print";




function showBusyPic()
{	
	hidePic('CurrentToolIMG');
	showPic('busy');
}

function hidePic(whichPic) 
{
		//alert('hiding ' + document.all[whichPic].id);
		//document.all[whichPic].style.visibility = 'hidden';
		document.getElementById(whichPic).style.visibility = 'hidden';
}
function showPic(whichPic) 
{		
		//alert('showing ' + document.all[whichPic].id);
		//document.all[whichPic].style.visibility = 'visible';
		document.getElementById(whichPic).style.visibility = 'visible';
}
    
function ie_getElementsByTagName(str) 
{
 // Map to the all collections
 if (str=="*")
  return document.all
 else
  return document.all.tags(str)
}

function checkImgLoad(imgid)
{
	var Imgs = document.getElementsByTagName("IMG")
	var nImgsNr = 0
	nImgsNr = Imgs.length;
	var resultis = 1;
	for ( var i = 0 ; i < nImgsNr ; i++ )
	{
		if ( !Imgs[i].complete )
			resultis = 0;
	}

	if (resultis == 0) 
	{
		setTimeout('checkImgLoad("' + imgid + '")',200);
		}
	else
	{
		hidePic(imgid);
		
	}
}

if (document.all)
 document.getElementsByTagName = ie_getElementsByTagName       

        
        
function microsoftMouseMove(e)
{

	var toolImgId = 'CurrentToolIMG';
	var BusyImgId = 'busy';

	//handle firefox and windows
	if (!e)
	{
		e = window.event;
	}

	var mx = e.clientX;
	var my = e.clientY;
	
	document.all[toolImgId].style.top = my - 10;
	document.all[toolImgId].style.left = mx + 10;
	
	document.all[BusyImgId].style.top = my- 10;
	document.all[BusyImgId].style.left = mx + 10;		
	                      
	if (document.all[BusyImgId].style.visibility != 'visible')
	{		
	    if (document.body.mapid == null)
	    	return false;
	    	
		var map = ById(document.body.mapid);
	
		var coordX = mx + document.body.scrollLeft;
		var coordY = my + document.body.scrollTop;
		
		var absoluteOffsetTop = GetAbsoluteOffsetTop(map);
	    var absoluteOffsetLeft = GetAbsoluteOffsetLeft(map);
	
		// if the click point is not inside the map rectangle, do nothing
		if(coordX < absoluteOffsetLeft || coordX > absoluteOffsetLeft + map.clientWidth - 16)
		{
			hidePic(toolImgId)
		}
		else
		{
			if(coordY < absoluteOffsetTop +7|| coordY > absoluteOffsetTop + map.clientHeight)
			{
				hidePic(toolImgId)
			}
			else
			{
				showPic(toolImgId);
			
			}
	    }    			
	}	
}      
  
      
//over load the SetItemPressed of exponare
function SetItemPressed(item, val) 
{
    
	item.ip = val;
	SetState(item);	
	if (item.itemtype == 'Button' && val==true)
	{
		document.all['CurrentToolIMG2'].src =  item.imageOne.src ;
		//document.getElementById('CurrentToolIMG2').src =  item.imageOne.src ;
	}
}   
   
function selectNewPanel(n)
{
	var d,f,e,o
	d = document

	for (i=0;i<d.forms.length;i++)
	{

		f = d.forms[i];
		for (ii=0;ii<f.elements.length;ii++)
		{
			e = f.elements[ii]
			if (e.type == "select-one")
			{
				for(iii=0;iii<e.options.length;iii++)
				{
					o = e.options[iii]
					if (o.text==n)
					{
						e.value = o.value;
					}
				}
			}
		}
	}

	__doPostBack(e.name,'');
}


	  
  	
