// JavaScript Document

function IProject()
{
	 this.from;
	 this.to;
	 this.points;
	 this.delimiter = '~';
	 this.projectAXL = projectAXL;
	 this.getProject = getProject;
	 this.sendProject = sendProject;
	 this.applyProject = applyProject;
}



function projectAXL()
{
	var pAXL = '';
		pAXL +='<?xml version="1.0" encoding="UTF-8"?>\n';
		pAXL +='<ARCXML version="1.1">\n';
		pAXL +='<REQUEST>\n';
		pAXL +='<GET_PROJECT compact="true">\n';
		pAXL +='<ENVIRONMENT>\n';
		pAXL +='<SEPARATORS cs=" " ts="'+this.delimiter+'" />\n';
		pAXL +='</ENVIRONMENT>\n';
		pAXL +='<FROMCOORDSYS id="'+this.from+'"/>\n';
		pAXL +='<TOCOORDSYS id="'+this.to+'"/>\n';
		pAXL +='<MULTIPOINT>\n';
		pAXL +='<COORDS>'+this.points+'</COORDS>\n';
		pAXL +='</MULTIPOINT>\n';
		pAXL +='</GET_PROJECT>\n';
		pAXL +='</REQUEST>\n';
		pAXL +='</ARCXML>';
		
		return pAXL;
}

function getProject(callBack)
{
	var axl = this.projectAXL();
	this.sendProject(axl,callBack);
}

function sendProject(axl,callBack)
{
	//showLayer("loadingLayer");
	
	doDebug(axl,null);
	var url = myMap.service.url + "&CustomService=Query";
	var xml = new JKL.ParseXML(url,axl);
	var copy = this;
	
    xml.async(copy.apply = function(data) { copy.applyProject(data,callBack)  } );
    xml.parse();
}

function applyProject(data,callBack)
{	
	if (callBack)
	{
		
		callBack(data.ARCXML.RESPONSE.PROJECT.MULTIPOINT.COORDS,this.to);
	}

	//hideLayer("loadingLayer");
	
}




