﻿// display_mapidentify.js

var bufferCallbackFunctionString = "WebForm_DoCallback('__Page',message,processCallbackResult,context,null,false)";
// Set up Identify tool
function MapBuffer(divid) {
    map = Maps[divid];
    MapPoint(map.controlName, "MapBuffer", false);
    map.divObject.onmousedown = MapIdClick1;
}

// Event handler for Identify
function MapIdClick1(e) {
    map.cursor = map.divObject.style.cursor;
	//map.divObject.style.cursor = "wait";
	getXY(e);
	var box = calcElementPosition(map.containerDivId);
	zleft = mouseX - box.left;
	ztop = mouseY - box.top;

	map.xMin=zleft;
	map.yMin=ztop;
	var div = document.getElementById("IdentifyLocation");
	if (div==null) {
	    addIdentifyLocation();
	}
	map.getTopLeftTile();
	var fpBody = document.getElementById('Results_TaskResults1');
	fpBody.innerHTML = "";
	var html = fpBody.innerHTML;
	fpBody.innerHTML = "<div><img src='images/callbackActivityIndicator.gif' align='middle'/> Consultando Informacion. . .</div>" + html;
	showFloatingPanel('Results');
	fpBody=document.getElementById('Results_BodyRow');
	if (fpBody.style.display=="none")
	    toggleFloatingPanelState('Results','images/collapse.gif','images/expand.gif');
    var distancia = document.getElementById('DDL_Distancia_Buffer');
    var capas = document.getElementById('DDL_Busqueda_Buffer');
	var message = "ControlID=Map1&ControlType=Map&EventArg=MapBuffer&Map1_mode=MapBuffer&minx=" + zleft + "&miny=" + ztop + "&distancia="+distancia.value+"&capas="+capas.value;
	var context = map.controlName;
	eval(bufferCallbackFunctionString);
	div = document.getElementById("IdentifyLocation");
	// point is bottom center... 2 pixels up for shadow
	var cWidth = Math.floor(div.clientWidth / 2);
	var cHeight = div.clientHeight;
	//alert(cWidth + " x " + cHeight); // width and height might not be available on first time.... if so, approximate size needed
	if (cWidth==0) cWidth = 12;
	if (cHeight==0) cHeight = 29;
	var idLeft = zleft - parseInt(map.divObject.style.left) - cWidth;
	var idTop = ztop - parseInt(map.divObject.style.top) - cHeight + 2; // add two back for icon bottom
//	if (isIE) {
//	    idTop+=2; 
//	    //idLeft+=2;
//	}
	window.setTimeout('moveLayer("IdentifyLocation", ' + idLeft + ', ' + idTop + '); showLayer("IdentifyLocation");', 0);
	map.mode = map.tempMode;
	map.actionType = map.tempAction;
	map.cursor = map.tempCursor;
	return false;
	
}
function processCallbackResultBuffer(returnmessage0,returnmessage1,context){
    
}
