/**
 * This is the listener of map component layers events. To add layer listener to the MapCAt component, you need to specify in MapCat configuration 
 * <param name='js_layers_listener' value='LayerListener' /> in env_conf element.
 * 
 * @author Priit Kervi (Priit.Kervi@regio.ee)
 * 31.10.2007
 */
LayerListener = {
	
	/**
	 * Handler of layer loaded event. Is called by MapCat component after layer objects are loaded from the server.
	 * @param {String} args.layerId id of the layer
	 * @param {String} args.groupId id of the group the layer belongs to
	 * @param {Array} args.loadedObjects an array containing information about loaded objects: args.loadedObjects[i] is an object {id:String, typeCode:Number, typeName:String, tooltip:String}
	 */
	onLayerLoaded: function(args) {
		/* handle event
		var text = "";
		for (var i = 0; i < args.loadedObjects.length; i++) {
			var obj = args.loadedObjects[i];
			if (obj.tooltip == null)
				obj.tooltip = "tooltip is not set";
			text += obj.id + ": " + obj.tooltip + " (" + obj.typeName + ")\n";
		}
		alert("layer " + args.layerId + " from group " + args.groupId + " is loaded, objects:\n" + text);
		//*/	
	},
	
	/**
	 * Handler of layer status changing event. Is called by MapCat component after layer is enabled/disabled in result of zoom level change.
	 * @param {String} args.layerId id of the layer
	 * @param {String} args.groupId id of the group the layer belongs to
	 * @param {Boolean} args.enabled true if the layer is enabled, false otherwise
	 */
	onLayerStatusChanged: function(args) {
		/* handle event	
		alert("layer " + args.layerId + " from group " + args.groupId + " status is: " + args.enabled);
		//*/	
	}
}