

function FullExtentCommand(name, interaction)
{
	if (arguments.length > 0) {
		this.Init(name, interaction);
	}
	this.Exc = this.eventHandler("Execute");
}
FullExtentCommand.prototype = new MapCommand();
FullExtentCommand.prototype.constructor = FullExtentCommand;
FullExtentCommand.superclass = MapCommand.prototype;
FullExtentCommand.prototype.Execute = function()
{
    if (this.interaction.element == null) this.interaction.element = FindElement(this.interaction.elementID);
	this.CreateUrl();
	this.UpdateMap();
}

function ShowBusState(id)
{
    var mapImage = FindElement("MapControl1_Image");
    
    var url = "MapController.ashx?Command="+ "ShowBusState" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&StateId=" + id
					"&Ran=" + Math.random();
	//startProcessingMap();
	mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
	var hfState=FindElement("HFState");
	hfState.value=id;
}

function ShowPNames(pnames)
{
    var mapImage = FindElement("MapControl1_Image");
    
    var url = "MapController.ashx?Command="+ "ShowPNames" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&pnames=" + pnames+
					"&Ran=" + Math.random();
	startProcessingMap();
	mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
}

function ShowStates(states)
{
    var mapImage = FindElement("MapControl1_Image");
    
    var url = "MapController.ashx?Command="+ "ShowStates" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&states=" + states+
					"&Ran=" + Math.random();
	startProcessingMap();
	mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
}


function ShowPName(id,flag)
{
    var mapImage = FindElement("MapControl1_Image");
    
    var url = "MapController.ashx?Command="+ "ShowPName" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&pnameid=" + id+
					"&flag"+flag+
					"&Ran=" + Math.random();
	//startProcessingMap();
	mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
	var hfPname=FindElement("HFPName");
	hfPname.value=id;
	
}

function ShowNLeft(id)
{
    var mapImage = FindElement("MapControl1_Image");
    
    var url = "MapController.ashx?Command="+ "ShowNLeft" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&nleftid=" + id
					"&Ran=" + Math.random();
	//startProcessingMap();
	mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
	
}


function ShowOneWay(id,flag)
{
    var mapImage = FindElement("MapControl1_Image");
    
    var url = "MapController.ashx?Command="+ "ShowOneWay" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&roadid=" + id+
					"&flag=" + flag+
					"&Ran=" + Math.random();
	startProcessingMap();
	mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
	
}


function ShowRoad(id)
{
    var mapImage = FindElement("MapControl1_Image");
    
    var url = "MapController.ashx?Command="+ "ShowRoad" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&roadid=" + id+
					"&Ran=" + Math.random();
	startProcessingMap();
	mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
	
	
}


function ShowAllOneWay()
{
    var mapImage = FindElement("MapControl1_Image");
    
    var url = "MapController.ashx?Command="+ "ShowAllOneWay" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&Ran=" + Math.random();
	startProcessingMap();
	mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
	
	
}

function ShowAllNLeft()
{
    var mapImage = FindElement("MapControl1_Image");
    
    var url = "MapController.ashx?Command="+ "ShowAllNLeft" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&Ran=" + Math.random();
	startProcessingMap();
	mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
	
}

function ShowAllGasStation()
{
    var mapImage = FindElement("MapControl1_Image");
    
    var url = "MapController.ashx?Command="+ "ShowAllGasStation" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&Ran=" + Math.random();
	startProcessingMap();
	mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
	
}

function ShowAllCarRepare()
{
    var mapImage = FindElement("MapControl1_Image");
    
    var url = "MapController.ashx?Command="+ "ShowAllCarRepare" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&Ran=" + Math.random();
	startProcessingMap();
	mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
	
}




function ShowRealTraffic()
{
    var mapImage = FindElement("MapControl1_Image");
    
    var url = "MapController.ashx?Command="+ "ShowRealTraffic" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&Ran=" + Math.random();
	startProcessingMap();
	mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
}

function CloseRealTraffic()
{
    var mapImage = FindElement("MapControl1_Image");
    
    var url = "MapController.ashx?Command="+ "CloseRealTraffic" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&Ran=" + Math.random();
	startProcessingMap();
	mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
	
}



function ShowBusLine(buslineid,flag)
{
    var mapImage = FindElement("MapControl1_Image");
    
    var url = "MapController.ashx?Command="+ "ShowBusLine" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&lineId=" + buslineid+
					"&flag=" + flag
					"&Ran=" + Math.random();
	startProcessingMap();
	mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
	var hfbusline=FindElement("HFBusLine");
	hfbusline.value=buslineid;
	
}

function ShowBusDircetCase(buslineid,flag,beginno,endno,beginid,endid,beginpnameid,endpnameid)
{
    var mapImage = FindElement("MapControl1_Image");
    var url = "MapController.ashx?Command="+ "ShowBusDirect" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&lineId=" + buslineid+
					"&flag=" + flag+
					"&begin="+beginno+
					"&end="+endno+
					"&beginid="+beginid+
					"&endid="+endid+
					"&beginpnameid="+beginpnameid+
					"&endpnameid="+endpnameid+
					"&Ran=" + Math.random();
	startProcessingMap();
    mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
	var hfbusline=FindElement("HFBusLine");
	hfbusline.value=buslineid;
}


function ShowShorestPath(arcids)
{
    var mapImage = FindElement("MapControl1_Image");
    var url = "MapController.ashx?Command="+ "ShorestPath" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&arcids=" + arcids+
					"&Ran=" + Math.random();
	startProcessingMap();
    mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
}

function ShowShorestPath2(arcids)
{
    var mapImage = FindElement("MapControl1_Image");
    var url = "MapController.ashx?Command="+ "ShorestPath2" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&arcids=" + arcids+
					"&Ran=" + Math.random();
	startProcessingMap();
    mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
}


function ShowBusChangeCase(buslineid1,flag1,beginno1,endno1,beginid1,endid1,buslineid2,flag2,beginno2,endno2,beginid2,endid2,beginpnameid,endpnameid)
{
    var mapImage = FindElement("MapControl1_Image");
    var url = "MapController.ashx?Command="+ "ShowBusChange" + 
					"&Width=" + mapImage.width +
					"&Height=" + mapImage.height +
					"&ExportFormat=" + mapImage.exportFormat +
					"&MapAlias=" + mapImage.mapAlias +
					"&lineId1=" + buslineid1+
					"&flag1=" + flag1+
					"&begin1="+beginno1+
					"&end1="+endno1+
					"&beginid1="+beginid1+
					"&endid1="+endid1+
					"&lineId2=" + buslineid2+
					"&flag2=" + flag2+
					"&begin2="+beginno2+
					"&end2="+endno2+
					"&beginid2="+beginid2+
					"&endid2="+endid2+
					"&beginpnameid="+beginpnameid+
					"&endpnameid="+endpnameid+
					"&Ran=" + Math.random();
	startProcessingMap();
    mapImage.style.left = 0;
	mapImage.style.top = 0;
	mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	try {
	mapImage.src = url;
	} catch(e) { alert("ll"); }
}


function RectanglePickCommand(name, interaction)
{
	if (arguments.length > 0) {
		this.Init(name, interaction);
	}
	this.Exc = this.eventHandler("Execute");
}
RectanglePickCommand.prototype = new MapCommand();
RectanglePickCommand.prototype.constructor = RectanglePickCommand;
RectanglePickCommand.superclass = MapCommand.prototype;
RectanglePickCommand.prototype.Execute = function()
{
    this.CreateUrl();
		
	var xmlHttp = CreateXMLHttp();
	xmlHttp.open("GET", this.url, false);
	xmlHttp.send(null);
	var result = xmlHttp.responseText;
	var label = FindElement("LblBusLine");
	label.innerHTML="";
	label.innerHTML = result;
	var mapImage = document.getElementById("MapControl1_Image");
	 if(MainLeft.style.display=='none')
    {
        MainLeft.style.display='block'
        mapImage.width = Main.style.width - 292;
        mapImage.height = Main.style.height;
        MainCenter.style.backgroundImage = 'url(images/MainCenterBG.jpg)';
        GetMap("MapControl1");
    }
	
}



function ZoomInLevel()
{
    var mapImage = document.getElementById("MapControl1_Image"); 
	var ur=  "MapController.ashx?Command=ZoomInLevel" + 
				"&Width=" + mapImage.width +
				"&Height=" + mapImage.height +
				"&ExportFormat=" + mapImage.exportFormat +
				"&Ran=" + Math.random();
	//startProcessingMap();
	mapImage.style.left = 0;
    mapImage.style.top = 0;
    mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
    try {
    mapImage.src = ur;
    } catch(e) { alert("ll");}
}

function ZoomOutLevel()
{
    var mapImage = document.getElementById("MapControl1_Image"); 
	var ur=  "MapController.ashx?Command=ZoomOutLevel" + 
				"&Width=" + mapImage.width +
				"&Height=" + mapImage.height +
				"&ExportFormat=" + mapImage.exportFormat +
				"&Ran=" + Math.random();
	//startProcessingMap();
	mapImage.style.left = 0;
    mapImage.style.top = 0;
    mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
    try {
    mapImage.src = ur;
    } catch(e) { alert("ll")};
}

function DisCommand(name, interaction)
{
	if (arguments.length > 0) {
		this.Init(name, interaction);
	}
}
DisCommand.prototype = new MapCommand();
DisCommand.prototype.constructor = DisCommand;
DisCommand.superclass = MapCommand.prototype;
DisCommand.prototype.Execute = function()
{
	this.CreateUrl();
	this.AddParamToUrl("DistanceType", this.distanceType);
	this.AddParamToUrl("DistanceUnit", this.distanceUnit);
	var xmlHttp = CreateXMLHttp();
	xmlHttp.open("GET", this.url, false);
	xmlHttp.send(null);
//	this.result = xmlHttp.responseText;
//	alert(this.result);
    var d = Math.round(parseFloat(xmlHttp.responseText)*10) + "";
    
    getDistance(d);
}

function getDistance(d)
{
    alert("\u8DDD\u79BB\u4E3A\uFF1A" + d + "\u7C73");
}

//function getZoomValue()
//{
//	var mapImage = document.getElementById("MapControl1_Image");   
//	var url = "MapController.ashx?Command=ZoomValue&Width=" + mapImage.width+"&Ran=" + Math.random();
//	                     
//	if (mapImage.mapAlias) 
//		url +=  "&MapAlias=" + mapImage.mapAlias;
//		
//	var xmlHttp = CreateXMLHttp();
//	xmlHttp.open("GET", url, false);
//	xmlHttp.send(null);
//	var result = xmlHttp.responseText;	
//	var div = FindElement("scale");
//	div.innerHTML = "<font size=2 face=Arial><b><font color=Indigo>" + result + "</font></b></font>";
//};	

function GetFullMap(mapControlId) 
{
    try {
		var mapImageId = mapControlId + "_Image";
		var mapImage = FindElement(mapImageId);
		if(mapImage) {
			//For situations where percentages (%) are used in the height and width
			// properties of the MapControl (and rendered in the html span and img tags), 
			// for Firefox and Netscape, the pixel dimension of the image object
			// should have been calculated and the heigth and width properties
			// set in the DOM's image object.  For IE, this does not seem to be the case,
			// so the height and width may be 0. See "if" block below.
			var w = mapImage.width;
			var h = mapImage.height;
			var exportFormat = "Gif";
			var url = null;
						
			if (BrowserType() == IE) {
				//If the browser is IE, check if the sizes obtained above are 
				// less than 1 (0, null, nothing),
				// then get height and width in pixels of parent/containing
				// element, namely the SPAN tag, this should have been calculated
				// by IE and the properties set in the style object of SPAN
				if (w < 1) {
					//get width from the SPAN tags "style" property
					w = mapImage.parentElement.style.pixelWidth;
				}
				//get height from the SPAN tags "style" property
				if (h < 1) {
					h = mapImage.parentElement.style.pixelHeight;
				}
				if (!mapImage.mapAlias) {
					mapImage.mapAlias = mapImage.attributes["mapAlias"].value;
				}
				if (!mapImage.exportFormat) {
					mapImage.exportFormat = mapImage.attributes["exportFormat"].value;
					exportFormat = mapImage.exportFormat;
				}
			}
			
			//...set the size of the image object to proper pixel dimensions...
			mapImage.width = w;
			mapImage.height = h;

			//...set the image source to a new URL to get a new map image
			// of the proper pixel dimensions
			url = "MapController.ashx?Command=MapPosition" + 
				"&Width=" + w +
				"&Height=" + h +
				"&ExportFormat=" + exportFormat + 
				"&Ran=" + Math.random();
				
			//If the map has an alias defined, append it to the url
			if (mapImage.mapAlias) {
				url += "&MapAlias=" + mapImage.mapAlias;
			}
			mapImage.style.left = 0;
			mapImage.style.top = 0;
			mapImage.style.clip = 'rect(' + 0 + ' ' + w + ' ' + h + ' ' + 0 +')';
			
			//Set the image object src attribute to the url to get a new map image
			mapImage.src = url;
		} else {
			alert("Image '" + mapImageId + "' could not be found on page");	
		}
	} catch (e) {
		alert("Execption in 'GetMap' function (Command.js)");
	}
}


function StartSelectionCommand(name, interaction)
{
	if (arguments.length > 0) {
		this.Init(name, interaction);
	}
}
StartSelectionCommand.prototype = new MapCommand();
StartSelectionCommand.prototype.constructor = StartSelectionCommand;
StartSelectionCommand.superclass = MapCommand.prototype;
StartSelectionCommand.prototype.Execute = function()
{
	var mapImage = FindElement("MapControl1_Image");
	this.url = "MapController.ashx?Command=StartSelect" +  
	          "&PixelTolerance" + this.pixelTolerance +
			   "&Ran=" + Math.random();
    if (this.interaction.PointsData.NumPoints() > 0) this.AddParamToUrl("Points", this.interaction.PointsData.GetPointsString(mapImage.origin));
	if (mapImage.mapAlias) this.AddParamToUrl("MapAlias", mapImage.mapAlias);
	var xmlHttp = CreateXMLHttp();
	xmlHttp.open("GET", this.url, false);
	xmlHttp.send(null);
	var result = xmlHttp.responseText;
	var start = document.getElementById("TxtBusBegin");
	start.value=result;
	start.value = result.substring(0,result.indexOf(","));
    var uid = document.getElementById("HFStartUid");
    uid.value=result;
    //uid.value = result.substring(result.indexOf(",")+1);
};

function EndSelectionCommand(name, interaction)
{
	if (arguments.length > 0) {
		this.Init(name, interaction);
	}
}
EndSelectionCommand.prototype = new MapCommand();
EndSelectionCommand.prototype.constructor = EndSelectionCommand;
EndSelectionCommand.superclass = MapCommand.prototype;
EndSelectionCommand.prototype.Execute = function()
{
	var mapImage = FindElement("MapControl1_Image");
	this.url = "MapController.ashx?Command=StartSelect" +  
	          "&PixelTolerance" + this.pixelTolerance +
			   "&Ran=" + Math.random();
    if (this.interaction.PointsData.NumPoints() > 0) this.AddParamToUrl("Points", this.interaction.PointsData.GetPointsString(mapImage.origin));
	if (mapImage.mapAlias) this.AddParamToUrl("MapAlias", mapImage.mapAlias);
	var xmlHttp = CreateXMLHttp();
	xmlHttp.open("GET", this.url, false);
	xmlHttp.send(null);
	var result = xmlHttp.responseText;
	var start = document.getElementById("TxtBusEnd");
	start.value=result;
	start.value = result.substring(0,result.indexOf(","));
    var uid = document.getElementById("HFEndUid");
    uid.value=result
    //uid.value = result.substring(result.indexOf(",")+1);
};	


function PNameSelectionCommand(name, interaction)
{
	if (arguments.length > 0) {
		this.Init(name, interaction);
	}
}
PNameSelectionCommand.prototype = new MapCommand();
PNameSelectionCommand.prototype.constructor = PNameSelectionCommand;
PNameSelectionCommand.superclass = MapCommand.prototype;
PNameSelectionCommand.prototype.Execute = function()
{
	var mapImage = FindElement("MapControl1_Image");
	this.url = "MapController.ashx?Command=PNameSelect" +  
	          "&PixelTolerance" + this.pixelTolerance +
			   "&Ran=" + Math.random();
    
	
    if (this.interaction.PointsData.NumPoints() > 0) this.AddParamToUrl("Points", this.interaction.PointsData.GetPointsString(mapImage.origin));
	if (mapImage.mapAlias) this.AddParamToUrl("MapAlias", mapImage.mapAlias);
	var xmlHttp = CreateXMLHttp();
	xmlHttp.open("GET", this.url, false);
	xmlHttp.send(null);
	var result = xmlHttp.responseText;
	if(result !="")
	{
	    temp=result.split(",");
	    if(temp[4]=="pname")
	    {
	        var pname = document.getElementById("TxtPnameSel");
	    
	        var hfPname=FindElement("HFPName");
	        pname.value=temp[0];
	        hfPname.value=temp[1];
	    
	        TabPName.style.display="block";
	        pnamefunc.style.display='block';
	        statefunc.style.display='none';
	        newpointFunc.style.display='none';
	    }
	    else if(temp[4]=="state")
	    {
	        var stateName = document.getElementById("TxtPnameSel");
	        stateName.value=temp[0];
	        var hfstate=FindElement("HFState");
	        hfstate.value=temp[1];
	        TabPName.style.display="block";
	        pnamefunc.style.display='none';
	        statefunc.style.display='block';
	        newpointFunc.style.display='none';
	    }
//	    else if(temp[4]=="newpoint")
//	    {
//	        var pname = document.getElementById("TxtPnameSel");
//	    
//	        var hfPname=FindElement("HFPName");
//	        pname.value=temp[0];
//	        hfPname.value=temp[1];
//	        TabPName.style.display="block";
//	        pnamefunc.style.display='none';
//	        statefunc.style.display='none';
//	        newpointFunc.style.display='block';
//	        InsertPoint( this.interaction.PointsData.GetPointsString(mapImage.origin));
//	        
//	    }

	}
	else
	{
	    TabPName.style.display="none";
	    
	    
	 }
	
	function InsertPoint(points)
	{
	    var mapImage = FindElement("MapControl1_Image");
        var url = "MapController.ashx?Command="+ "InsertPoint" + 
					    "&Width=" + mapImage.width +
					    "&Height=" + mapImage.height +
					    "&ExportFormat=" + mapImage.exportFormat +
					    "&MapAlias=" + mapImage.mapAlias +
					    "&Points=" + points+
					    "&Ran=" + Math.random();
	   
        mapImage.style.left = 0;
	    mapImage.style.top = 0;
	    mapImage.style.clip = 'rect(' + 0 + ' ' +  mapImage.width + ' ' + mapImage.height + ' ' + 0 +')';
	    try {
	    mapImage.src = url;
	    } catch(e) { alert("ll"); }
	}
	
	
};							

