//client info command to control client behavior for info tool.
function InfoCommand(name, interaction)
{
	if (arguments.length > 0) {
		this.Init(name, interaction);
	}
};

InfoCommand.prototype = new MapCommand();
InfoCommand.prototype.constructor = InfoCommand;
InfoCommand.superclass = MapCommand.prototype;
InfoCommand.prototype.Execute = function()
{

	InfoClick();

	this.CreateUrl();
	this.AddParamToUrl("PixelTolerance", this.pixelTolerance);
	
	//create an XMLHttp obj to send request to server
	var xmlHttp = CreateXMLHttp();
	xmlHttp.open("GET", this.url, false);
	xmlHttp.send(null);
	//get response back
	this.result = xmlHttp.responseText;
	
	var div = FindElement("Info");
		
	//display the response at client html
	if(this.result == "")
	{		
		div.innerHTML = "<p class='LFP_Error'>There are no producers where you clicked.</p><p> Please select a red circle or click on the back button</p><input id='uiResultsInput' onclick='BackClick()' type='button' value='Back' class='LFP_input_Button'/>";
	}
	else
	{	
		div.innerHTML = "<p></p>" + this.result + "<input id='uiResultsInput' onclick='BackClick()' type='button' value='Back' class='LFP_input_Button'/>"
	}
	
	//BT Added 	to hide Map loading Gif - Map not changed
	div = FindElement("uiMapLoading"); 
	div.style.visibility = "hidden";
	self.status="Done";

};
	
//added by BT
function SearchClick()
{
		var div = FindElement("uiMapLoading");
		div.style.visibility = "visible";

		ResultsClick();	
};

function ProcessingClick()
{
		var div = FindElement("uiMapLoading");
		div.style.visibility = "visible";
};

function ResultsClick()
{
		self.status="Processing... please wait ResultsClick";
		
		var div = FindElement("Results");
		if(!(div == null))
		{
			
			div.style.display = "";
		}

		div = FindElement("Info");
		if(!(div == null))
		{

				div.style.display= "none";
		}
		
		//div = FindElement("Search");
		//div.style.display = "none";
		//div.style.visibility = "hide";
};	

function BackClick()
{
		
		var div = FindElement("SearchResults");
		if(!(div == null))
		{
			if(div.style.display = "none")
			{
				div.style.display = "";
			}

		}

		div = FindElement("Info");
		if(!(div == null))
		{

				div.style.display= "none";
		}
		
		
};	

function InfoClick()
{
	self.status="Processing... please wait ResultsClick InfoClick";
		
		var div = FindElement("Info");
		if(!(div == null))
		{
			div.style.display = "";
		}
		 
		div = FindElement("SearchResults");
		if(!(div == null))
		{
			//if(div.style.display = "")
				div.style.display = "none";
		
		}
		
//		div = FindElement("Search");
//		if(!(div == null))
//		{
//			
//			//if(div.style.display = "")
//				div.style.display = "none";
//		}
		
};	

//Added by BT
function MapMoved()
{
};



