
/**
 * returns different types depending on layer parameters.
 * and type will be one of 'json', 'jtext', 'kml', 'file', 'zip' <-'file'/'zip' being a download file
 *	
 *this is currently used by Layers/LayerManager to get data
 *
 */


var LayersRequest=AjaxQuery.JsonResponse.extend({
	task:"layer_data",
	json:{},
	initialize:function(layer, type)
	{
	var me=this;
	if(!type)
		type="jtext"; //default response type is xml as text, wrapped as a json object
	me.json={format:type};
	if(layer.options.url)
	{	
		me.task="layer_redirect";
		me.json.url=layer.options.url;
	}
	//alternatively convert string to xml.
	if(type=="kml")
		me.onSuccess=function(text,xml){
		if(text)
			xml=GXml.parse(text);
		me.fireEvent('onSuccess',xml);
	};
	me.parent(layer);
	},
	identify:function(layer, json){
		AjaxQuery.IdentifyMap(layer,json);
		AjaxQuery.IdentifyLayer(layer,json);
	}
});

