
gmap.XMLLayer = (function(){
	
	// ---- CONSTRUCTOR --------------------------
	function XMLLayer(urlOfXml, callback, opts){
		var I = this;
		I.options = j.extend({}, I.defaults, opts);
		if(I.options.map==null) I.options.map = gmap.map;
		
		GGeoXml.apply(I, [urlOfXml, callback]);
		
		GEvent.addListener(I, "load", I.onLoad);
	
		

	}
	
	// ---- CLASS MEMBERS --------------------------
	XMLLayer.prototype = new GGeoXml("");	
	j.extend(XMLLayer.prototype, {
		defaults:{
			map:null, //Gmap2 - http://code.google.com/apis/maps/documentation/reference.html#GMap2
			displayOnLoad:true,
			label:"Layer",
			opacity:1
		},
		options:null,
		_isOverlayAdded:false,
		toggle:function(forceVisible){
			
			var I = this;			
			if(forceVisible || (forceVisible==null && I.isHidden())){
				if(!I._isOverlayAdded){
					I._isOverlayAdded=true;
					I.options.map.addOverlay(I);					
				}else{
					I.show();					
				}				
				forceVisible=true;
			}else{
				I.hide();	
				forceVisible=false;
			}
			//return forceVisible;
			return forceVisible;
		},
		opacity:function(toOpacity){
			return;
			var I = this;
			var pane = I.options.map.getPane(G_MAP_OVERLAY_LAYER_PANE);
			
			if(toOpacity!=null){
				j(pane).css({opacity:toOpacity});
			}else{
				toOpacity = j(pane).css("opacity");	
			}
			/*for(var prop in I.mc){
				trace(prop + " : " +I[prop]);	
			}*/
			
			return toOpacity;
		},
		onLoad:function(evt){
			var I = this;
			//trace("gmap.XMLLayer.onLoad()");
			if(!I.options.displayOnLoad){
				//I.toggle(false);
			}else{
				I.toggle(true);							
			}
		}
		
	});
	
	// ---- RETURN TO ENCAPSULATOR --------------------------
	return XMLLayer;
})();