

function DrillDownZoomCommand(name, interaction)
{
	if (arguments.length > 0) {
		this.Init(name, interaction);
	}
}
DrillDownZoomCommand.prototype = new MapCommand();
DrillDownZoomCommand.prototype.constructor = DrillDownZoomCommand;
DrillDownZoomCommand.superclass = MapCommand.prototype;
DrillDownZoomCommand.prototype.Execute = function()
{
    //Create the URL for the request
	this.CreateUrl();
	this.AddParamToUrl("PixelTolerance", this.pixelTolerance);
	
	//Create an XMLHttp obj to send the request to server
	//The XMLHttp object enables developers to initiate HTTP requests from anywhere in an application. 
	//These requests return XML
	var xmlHttp = CreateXMLHttp();
    xmlHttp.open("GET", this.url, false);
    xmlHttp.send(null);

    //Get the new map placed in the Map control
    this.AddParamToUrl("GetMapImage", "true");
    var v = document.getElementById('MapControl1_Image');
    v.src = this.url; 
    
    
};

function DrillDownZoomThemeCommand(name, interaction)
{
	if (arguments.length > 0) {
		this.Init(name, interaction);
	}
}
DrillDownZoomThemeCommand.prototype = new MapCommand();
DrillDownZoomThemeCommand.prototype.constructor = DrillDownZoomThemeCommand;
DrillDownZoomThemeCommand.superclass = MapCommand.prototype;
DrillDownZoomThemeCommand.prototype.Execute = function()
{

    //var mapImage = document.getElementById("MapImage");
	//mapImage.style.visibility = "hidden";
	//var oldhandler = mapImage.onload;
	//showWait()
	//mapImage.onload == function (mapImage) {this.style.visibility = "visible"; this.onload = oldhandler;};
	//mapImage.onload = showMap();
	//mapImage.onload = oldhandler;
	
    //Create the URL for the request
	this.CreateUrl();
	this.AddParamToUrl("PixelTolerance", this.pixelTolerance);
	//this.AddParamToUrl("txtGeog", document.forms[0].txtGeog.value);
	
		
	//Create an XMLHttp obj to send the request to server
	//The XMLHttp object enables developers to initiate HTTP requests from anywhere in an application. 
	//These requests return XML
	var xmlHttp = CreateXMLHttp();
    xmlHttp.open("GET", this.url, false);
    xmlHttp.send(null);
    
    //Get tabular results response back and get the reference to the DIV tag for where 
    //the results will be placed on the page
	this.result = xmlHttp.responseText;
	var div = FindElement("DataTable");
	//var div2 = FindElement("DataTable2");
	
	//Get the new legend placed in the Legend Image control
    var v2 = document.getElementById('ImageLegend');
    //v2.src = "MapController.ashx?Command=GetLegend&MapAlias=Map1&Width=100&Height=70&ExportFormat=Gif" + "&ran=" + Math.random();
    v2.src = "GetImageFromSession.aspx?type=Legend"+ "&ran=" + Math.random();
    
    //Get the new map placed in the Map control
    this.AddParamToUrl("GetMapImage", "true");
    var v = document.getElementById('MapControl1_Image');
    v.src = this.url; 
    
    //showMap()
    
    //Check if no records were returned from the query
    var error = xmlHttp.responseText.length
    if (error < 1)
	{		
		 //Display the appropriate error page if no records were returned from the query
        window.location.href("REMDNoData.aspx?errortype=noData");
    }
    
    //Display the tabular results in the DIV tage
	div.innerHTML =  this.result;
	//div2.innerHTML =  this.result;
	
};


function showWait()
{
	var myWait = document.getElementById("Wait");
	var myMapImage = document.getElementById("MapImage");
					
	myWait.style.visibility="visible";
	myMapImage.style.visibility="hidden";
};

function showMap()
{
	var myWait = document.getElementById("Wait");
	var myMapImage = document.getElementById("MapImage");
					
	myWait.style.visibility="hidden";
	myMapImage.style.visibility="visible";
};

function openHelpNotApplicable(){
	window.open("/regional/definitions/nextpage.cfm?key=NA","NotPermitted","width=1000,height=500,resizable=yes,menubar=no,scrollbars=yes,toolbar=no");}
			
function openHelp(){
	window.open("/regional/definitions/nextpage.cfm?key=REMDMap","help","width=1000,height=500,resizable=yes,menubar=no,scrollbars=yes,toolbar=no");
}

function openHelpStatistic(x){
	window.open("/regional/definitions/nextpage.cfm?key="+x,"help","width=1000,height=500,resizable=yes,menubar=no,scrollbars=yes,toolbar=no");
}

function showPrintPreview(){
    window.open("PrintPreview.aspx?table=FALSE","_layer","menubar=yes,scrollbars=yes,toolbar=yes,resizable=yes");
    //var myDataTable2 = document.getElementById("DataTable2");
	//myDataTable2.style.visibility="hidden";
}

function showPrintPreviewTable(){
    window.open("PrintPreview.aspx?table=TRUE","_layer","menubar=yes,scrollbars=yes,toolbar=yes,resizable=yes");
    //var myDataTable2 = document.getElementById("DataTable2");
	//myDataTable2.style.visibility="visible";
}


