	
	var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function fixPNG(myImage) 
{
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	   myImage.outerHTML = strNewHTML	  
    }
}



	
	
   	function CGoogleMaps() { 
			this.map_ = null;
			this.manager_ = null;
			this.geocoder_ = null;
			this.addmng_  = null;
			this.markerlayers_ = [];
			this.zoom_ = 12;
			this.icons_ = [];
			this.selectedLayers_ = [];
		};
	
	// ***********************************************************
	// inicializa el mapa
	// ***********************************************************
	CGoogleMaps.prototype.initMap  = function(nombre, focus, opt_onload, opt_zoom, opt_ongeocode) 
	{ 
		if (GBrowserIsCompatible()) 
		{
	      
	      
	        this.geocoder_ = new GClientGeocoder();
	        this.geocoder_.setBaseCountryCode("ES");
	        
			this.map_ = new GMap2(document.getElementById(nombre));


			
			
			
			
			
	//		this.map_.enableScrollWheelZoom();
			if (opt_zoom) this.setZoom(opt_zoom);

			
			this.ongeocode = opt_ongeocode;
			
			var instance = this;
			
 			GEvent.addListener(instance.map_, "load", function() 
			{
				instance.manager_ = new MarkerManager(instance.map_, { "borderPadding": 50, "maxZoom": 20, "trackMarkers": false });
				if (opt_onload) opt_onload();
			});
			this.setCenter(focus);	
		}
	}

    // ***********************************************************
    CGoogleMaps.prototype.addListener = function(type, event, callback) {
    	var instance; //default
    	switch (type) {
    		case 'map': instance = this.map_; break;
    		case 'manager': instance = this.manager_; break;
    		default: return;
    	}
    	GEvent.addListener(instance, event, callback);
    }
    	
    // ***********************************************************
	// añade un tipo de icono
	// ***********************************************************
	CGoogleMaps.prototype.addIcon = function(type, minzoom, maxzoom, icon, opt_ondrag)	 {
			this.icons_[type] = { icon: icon, minzoom: minzoom, maxzoom: maxzoom, ondrag: opt_ondrag} ;	
	}


    // ***********************************************************
	// centra el mapa en la direccion indicada
	// ***********************************************************
    CGoogleMaps.prototype.setCenter = function(place)
	{
		var instance = this;
		if (place.address) {
			if (this.geocoder_) {
		    		this.geocoder_.getLatLng(place.address, 
		    			function(point) {
		      			instance.map_.setCenter(point, instance.zoom_);
		      		}
		      	);
	      	}	
	    } 
	    else if (place.lat && place.lng)
	    {
	    	var point = new GLatLng(place.lat, place.lng);
    		instance.map_.setCenter(point, instance.zoom_);
	    }  	
	}
    
    // ***********************************************************
		// mueve el mapa a la direccion indicada
		// ***********************************************************
    CGoogleMaps.prototype.setFocus = function(place)
		{
			var instance = this;
			if (place.address) {
					if (this.geocoder_) {
		    		this.geocoder_.getLatLng(place.address, 
		    			function(point) {
		      			instance.map_.panTo(point);
		      		}
		      	);
	      	}	
	    } 
	    else if (place.lat && place.lng)
	    {
	    		var point = new GLatLng(place.lat, place.lng);
	    		this.map_.panTo(point);
	    }  	
		}

		// ***********************************************************
		// recorre las direcciones en memoria y ejecuta onscan y/o onlayer si están definidas
		// ***********************************************************
	
		CGoogleMaps.prototype.scanLayers = function(onscan, onlayer) {
					
			for (var i in this.markerlayers_) 
			{
				if (this.selectedLayers_[i])
				{
					var layer = this.markerlayers_[i];
					var type = layer["type"];
					
					if (onlayer) onlayer(type, i);										
	
					for (var j in layer["places"]) 
					{
		      			var place = layer["places"][j];
		      			if (onscan) onscan(place, type, i, j);
		    		}
		  		}
		  	}	
		}	
		
		CGoogleMaps.prototype.scanLayer = function(i, onscan) 
		{
			var layer = this.markerlayers_[i];
			var type = layer["type"];
			for (var j in layer["places"]) 
			{
      			var place = layer["places"][j];
      			if (onscan) onscan(place, type, j);
    		}
		}	
		
	
		// ***********************************************************
		// transforma todas las direcciones de memoria a coordenadas del mapa
		// ***********************************************************
		
		CGoogleMaps.prototype.geocodeAddresses = function() 
		{
			for (var i in this.markerlayers_) 
			{
				var layer = this.markerlayers_[i];
			//	this.addmng_ = new CAddressManager(this);
				for (var j in layer["places"]) 
				{
		      		var place = layer["places"][j];
		      		if (place.address) {
		      	//		this.addmng_.add(i, j);
		      			this.geocodePosn(i, j);
	      			}	
    			}
  			}
  		//	this.addmng_.setTotal(count);
		}
		
		// ***********************************************************
		// traduce una dirección a coordenadas del mapa
		// y la actualiza en memoria
		// ***********************************************************
		CGoogleMaps.prototype.geocodePosn = function(i, j, fullGeocoding) 
		{
			var place = this.getPlace(i, j);
			var instance = this;
			if (this.geocoder_) {
				if (fullGeocoding) 
				{
					this.geocoder_.getLocations(
					place.address,
					function(response)
					{
						var code = response.Status.code;
						if (code == 200) 
						{
							var point = response.Placemark[0].Point;
		       				place.lng = point.coordinates[0];
		       				place.lat = point.coordinates[1];
						}
						instance.ongeocode(i, j, response);
				
					});
				}
				else
				{					
			    	this.geocoder_.getLatLng(
			      	place.address,
			      	function(point) 
			      	{
			        	if (point) { 
		       				place.lat = point.lat();
		       				place.lng = point.lng();
			        	}	
			        	instance.ongeocode(i, j, point);
		         	});
		        }	
			}	
		}
		
		
		
		
		// ***********************************************************
		// extrae la información de marcadores que hay en memoria 
		// y actualiza el mapa
		// ***********************************************************
		CGoogleMaps.prototype.showMarkers = function() {
			var markers = [];
		  	for (var x in this.markerlayers_) {
			  	markers[x] = [];
		  	}
		  	this.manager_.clearMarkers();
			this.scanLayers(function(place, type, i ,j)
			{ 
      			markers[i].push(j); 
			});

 			this.createMarkers(markers);
		}	
		// ***********************************************************
		// crea los markers y los muestra
		// ***********************************************************
		CGoogleMaps.prototype.createMarkers = function(layers)
		{
			var markers = [];
			for (var i in layers)
			{
				var icon = this.icons_[i]["icon"];
				var minzoom = this.icons_[i]["minzoom"];
				var maxzoom = this.icons_[i]["maxzoom"];
				for (var j in layers[i]) 
				{
					markers.push(this.createMarker(i,j,icon));
				}
			}
			this.manager_.addMarkers(markers, minzoom, maxzoom);
	  		this.manager_.refresh();
		}
		
		// ***********************************************************
		// abre un bocadillo apuntando a una dirección del mapa menos el offset
		// ***********************************************************
		CGoogleMaps.prototype.openInfo = function (place, type, opt_html) 
		{
			if (place.lat) {
				var posn = new GLatLng(place.lat,place.lng);
				var offsetHeight = 32;
				var offsetWidth = 0;
				if (this.icons_[type]["icon"]) {
					offsetHeight = this.icons_[type]["icon"].iconSize.height - this.icons_[type]["icon"].infoWindowAnchor.y; //baseIcon.iconSize.height;
					offsetWidth = this.icons_[type]["icon"].infoWindowAnchor.x; //baseIcon.iconSize.height;
				}	
				var point = this.map_.fromLatLngToDivPixel(posn);
		    		point.y -= offsetHeight;
		    		point.x -= offsetWidth;
				this.map_.openInfoWindowHtml(this.map_.fromDivPixelToLatLng(point), opt_html?opt_html:place["txt"]);
			}			
		}
		CGoogleMaps.prototype.closeInfo = function () 
		{
			this.map_.closeInfoWindow();
		}
		// ***********************************************************
		CGoogleMaps.prototype.createMarker = function(i, j, icon) 
		{
			var place = this.getPlace(i,j);
			var posn = new GLatLng(place["lat"], place["lng"]);
			var draggable = this.icons_[i]["ondrag"]?true:false;
			var marker = null;
			if (icon) marker = new GMarker(posn, { title: place["name"], icon: icon, draggable: draggable});
			else marker = new GMarker(posn, { title: place["name"], draggable: draggable});
			
			var instance = this;
			var mm = marker;
			if (draggable) 
			{
				GEvent.addListener(marker, "dragend", function () {
					instance.icons_[i]["ondrag"](mm);
				});
				GEvent.addListener(marker, "dragstart", function () {
					instance.closeInfo();
				});
			}	
/*			GEvent.addListener(marker, "mouseover", function () {
				alert("title: "+ place["txt"])
				mm.openInfoWindowHtml('hola');
//				alert("title: "+ );
				});
*/			this.setMarkerId(marker, i, j);
    		return marker;
		}
		// ***********************************************************
		CGoogleMaps.prototype.setMarkerLayers = function(markerArray) 
		{
			this.markerlayers_ = markerArray;
		}
		CGoogleMaps.prototype.selectLayer = function(i, selected) 
		{
			this.selectedLayers_[i] = selected;
		}	
		// ***********************************************************
		CGoogleMaps.prototype.getPlace = function(i, j) 
		{
			return this.markerlayers_[i]["places"][j];
		}
		CGoogleMaps.prototype.getPlaceById = function(myid) 
		{
				var str = myid.split("_");
				var i = str[0];
				var j = str[1];
				return this.getPlace(i, j);
		}
		CGoogleMaps.prototype.getTypeById = function(myid) 
		{
				var str = myid.split("_");
				var i = str[0];
				return parseInt(i);
		}
		CGoogleMaps.prototype.getCoordsById = function(myid) 
		{
				var str = myid.split("_");
				return {"i":parseInt(str[0]),"j":parseInt(str[1])};
		}		
		
		CGoogleMaps.prototype.getId = function(i, j) 
		{
				return ''+i+'_'+j;
		}		
		CGoogleMaps.prototype.getMarkerId = function(marker) 
		{
				return marker.myid;
		}
		CGoogleMaps.prototype.setMarkerId = function(marker, i, j) 
		{
				marker.myid = this.getId(i, j);
		}					
		
		CGoogleMaps.prototype.setZoom = function(zoom) 
		{
			this.zoom_ = zoom;
		}	
		
		CGoogleMaps.prototype.getCurrentZoom = function() 
		{
			return this.map_.getZoom();
		}	
		CGoogleMaps.prototype.getCurrentBounds = function() 
		{
			return this.map_.getBounds();
		}			
		CGoogleMaps.prototype.getCurrentCenter = function() 
		{
			return this.map_.getCenter();
		}	
		
		// ***********************************************************
		// ***********************************************************
		// ***********************************************************
		// ***********************************************************		
	
		// *****************************
		// LIST MANAGER
		// *****************************	
		
		
		function CListManager(cgooglemaps, table, callback) {
			this.initialized_ = false;
			this.list_ = [];
			this.icons_= [];
			this.cmaps_ = cgooglemaps;
			this.table_ = table;
			this.callback_ = callback;
			this.type_ = null;
		}
		CListManager.prototype.addListIcon = function(type, listable, listImage) { //necesario para inicializar
			this.icons_[type] = { listable: listable, listImage: listImage} ;	
			this.type_ = type;
		}
		
		CListManager.prototype.init = function() {
			this.initialized_ = true;
		}
		
		CListManager.prototype.add = function(id) {
			var coords = this.cmaps_.getCoordsById(id);
			var pos = coords["j"];
			this.list_[id] = pos;
		}
		CListManager.prototype.remove = function(id) {
			if (this.list_[id]!=null)  {    
				this.list_[id] = null;
			}	
		}
		
		CListManager.prototype.refresh = function () 
		{
			if (this.initialized_ && this.icons_[this.type_]["listable"]) 
			{
				this.clearRows();
				var bounds = this.cmaps_.getCurrentBounds();
				var maxId = -1;
				for (var x in this.list_) {
					if (this.list_[x]>maxId) maxId = this.list_[x];
				}
				for (var i=0;i<=maxId;i++) {
					var id = cmaps.getId(this.type_,i);
					if (this.list_[id]!=null) {
						 this.show(id, bounds);
					}	 
				}
			}	
		}
		CListManager.prototype.show = function(id, bounds) {
			var type = this.cmaps_.getTypeById(id);
			var place = this.cmaps_.getPlaceById(id);
			var point = new GLatLng(place.lat, place.lng);
			if (bounds.contains(point)) {
				this.insertRow(id);
			} else this.deleteRow(id); 
		}		

		CListManager.prototype.insertRow = function(id) {
			if (document.getElementById(id)) return;	// si ya está no habrá q añadirla
			var len = this.table_.rows.length;
			var type = this.cmaps_.getTypeById(id);
			var row = this.table_.insertRow(len);
			this.callback_(row, id, this.icons_[type]["listImage"]);
		}
		CListManager.prototype.deleteRow = function(id) {
			var node = document.getElementById(id);
			if (node) {
				node.parentNode.removeChild(node);
			}	
		}

		CListManager.prototype.clearList = function() {
			this.initialized_ = false;
			this.list_ = [];
			
		}
		CListManager.prototype.clearRows = function () {
			while (this.table_.rows.length>0) {
				var child = this.table_.firstChild;
				this.table_.removeChild(child);
			}		
		}
		
		// *****************************
		// MOVEMENT MANAGER
		//  *****************************
		
		
	function CMovementManager() {
		this.topLeft_ = null;
		this.downLeft_ = null;
		this.downRight_ = null;
		this.topRight_ = null;
		this.bounds_ = null;
		this.minDistance_ = 1000;
	}
	CMovementManager.prototype.setMapBounds = function(bounds) {
		this.bounds_ = bounds;
	}
	CMovementManager.prototype.setVirtualWindowBounds = function(topLeft, downRight) {
		this.topLeft_ = topLeft;
		this.downRight_ = downRight;
		this.topRight_ = new GLatLng(this.topLeft_.lat(), this.downRight_.lng());
		this.downLeft_ = new GLatLng(this.downRight_.lat(), this.topLeft_.lng());
	}
	CMovementManager.prototype.getMinDistance = function() {
		if (this.topLeft_) {
			var dl = this.bounds_.getSouthWest();
			var tr = this.bounds_.getNorthEast();
			var dr = new GLatLng(dl.lat(), tr.lng());
			var tl = new GLatLng(tr.lat(), dl.lng());
			
			if (dl.lat() < this.downLeft_.lat()) return (this.minDistance_-1);
			if (dr.lat() < this.downRight_.lat()) return (this.minDistance_-1);
			if (tl.lat() > this.topLeft_.lat()) return (this.minDistance_-1);
			if (tr.lat() > this.topRight_.lat()) return (this.minDistance_-1);
			if (dl.lng() < this.downLeft_.lng()) return (this.minDistance_-1);
			if (tl.lng() < this.topLeft_.lng()) return (this.minDistance_-1);
			if (dr.lng() > this.downRight_.lng()) return (this.minDistance_-1);
			if (tr.lng() > this.topRight_.lng()) return (this.minDistance_-1);
			var distance1 = this.topLeft_.distanceFrom(tl);
			var distance2 = this.downRight_.distanceFrom(dr);
			var distance3 = this.topRight_.distanceFrom(tr);
			var distance4 = this.downLeft_.distanceFrom(dl);
			
			return Math.min(distance1, distance2, distance3, distance4);
		} else return (this.minDistance_);	
	}
	CMovementManager.prototype.isNearBorder = function(zoom) {
			var distance = this.getMinDistance();
			return (distance < this.minDistance_);
	}
		
		
		
		

	// ********************************		
	// *** CONTROLES 				***		
	// ********************************		
	
	
	function MMapTypeControl() {}
	MMapTypeControl.prototype = new GControl();
	
	MMapTypeControl.prototype.initialize = function(map) {
		var container = document.createElement("div");
		var div = document.createElement("div");
			div.className = 'botones';
			container.appendChild(div);
		this.boton1_ = document.createElement("span");
		this.boton2_ = document.createElement("span");	
		this.boton3_ = document.createElement("span");	
		this.setInnerHTML(1);
		var instance = this;

		div.appendChild(this.boton1_);
		div.appendChild(this.boton2_);
		div.appendChild(this.boton3_);
		GEvent.addDomListener(this.boton1_, "click", function() {
		    map.setMapType(G_NORMAL_MAP);
		    instance.setInnerHTML(1);
		});
		GEvent.addDomListener(this.boton2_, "click", function() {
		    map.setMapType(G_SATELLITE_MAP);
		    instance.setInnerHTML(2);
		});
		GEvent.addDomListener(this.boton3_, "click", function() {
		    map.setMapType(G_HYBRID_MAP);
		    instance.setInnerHTML(3);
		});
		
		map.getContainer().appendChild(container);
		return container;
	}
	
	MMapTypeControl.prototype.getDefaultPosition = function() {
  		return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
	}
	MMapTypeControl.prototype.getHTML_Image = function(img, width, height, modo) {
		return '<img src="../Visuals/imgs/gifs/'+img+'" width="'+width+'" height="'+height+'" alt="Ver modo '+modo+'" />';
	}
	MMapTypeControl.prototype.setInnerHTML = function(selected) {
		this.boton1_.innerHTML = this.getHTML_Image('bot_map_'+(selected==1?'on':'off')+'.gif',58,19,'mapa');
		this.boton2_.innerHTML = this.getHTML_Image('bot_sat_'+(selected==2?'on':'off')+'.gif',74,19,'sat&eacute;lite');
		this.boton3_.innerHTML = this.getHTML_Image('bot_hib_'+(selected==3?'on':'off')+'.gif',63,19,'h&iacute;brido');
	}
	
	
	// --------------------
	// FLECHAS	
	// --------------------
	function FlechaUpControl(mapWidth, mapHeight, path) {
		this.width_ = mapWidth;
		this.height_ = mapHeight;
		this.path_ = path;
	}
	FlechaUpControl.prototype = new GControl();	
	FlechaUpControl.prototype.initialize = function(map) {
		var container = document.createElement("div");
		var src = '<div onMouseOver="this.style.cursor=\'pointer\';">';
		src += '<img src="'+this.path_+'flecha_up.png" border="0" class="flecha_up" onload="fixPNG(this)"></div>'; 
		container.innerHTML = src;
		
		GEvent.addDomListener(container, "click", function() {
			map.panDirection(0,+1);
		});
		map.getContainer().appendChild(container);
		return container;
	}
	
	FlechaUpControl.prototype.getDefaultPosition = function() {
  		return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize((this.width_/2)-20, 0));
	}
	// -----------
	function FlechaDownControl(mapWidth, mapHeight, path) {
		this.width_ = mapWidth;
		this.height_ = mapHeight;
		this.path_ = path;
	}
	FlechaDownControl.prototype = new GControl();	
	FlechaDownControl.prototype.initialize = function(map) {
		var container = document.createElement("div");
		
		var src = '<div onMouseOver="this.style.cursor=\'pointer\';">';
		src += '<img src="'+this.path_+'flecha_down.png" border="0" class="flecha_down" onload="fixPNG(this)"></div>'; 
		container.innerHTML = src;
		GEvent.addDomListener(container, "click", function() {
			map.panDirection(0,-1);
		});
		map.getContainer().appendChild(container);
		return container;
	}
	
	FlechaDownControl.prototype.getDefaultPosition = function() {
  		return new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize((this.width_/2)-20, 0));
	}
		// -----------
	function FlechaLeftControl(mapWidth, mapHeight, path) {
		this.width_ = mapWidth;
		this.height_ = mapHeight;
		this.path_ = path;
	}
	FlechaLeftControl.prototype = new GControl();	
	FlechaLeftControl.prototype.initialize = function(map) {
		var container = document.createElement("div");
		var src = '<div onMouseOver="this.style.cursor=\'pointer\';">';
		src += '<img src="'+this.path_+'flecha_left.png" border="0" class="flecha_left" onload="fixPNG(this)"></div>'; 
		container.innerHTML = src;
		GEvent.addDomListener(container, "click", function() {
			map.panDirection(+1,0);
		});
		map.getContainer().appendChild(container);
		return container;
	}
	
	FlechaLeftControl.prototype.getDefaultPosition = function() {
  		return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(0, (this.height_/2)-20));
	}
		// -----------
	function FlechaRightControl(mapWidth, mapHeight, path) {
		this.width_ = mapWidth;
		this.height_ = mapHeight;
		this.path_ = path;
	}
	FlechaRightControl.prototype = new GControl();	
	FlechaRightControl.prototype.initialize = function(map) {
		var container = document.createElement("div");
		var src = '<div onMouseOver="this.style.cursor=\'pointer\';">';
		src += '<img src="'+this.path_+'flecha_right.png" border="0" class="flecha_right" onload="fixPNG(this)"></div>'; 
		container.innerHTML = src;
		GEvent.addDomListener(container, "click", function() {
			map.panDirection(-1,0);
		});
		map.getContainer().appendChild(container);
		return container;
	}
	
	FlechaRightControl.prototype.getDefaultPosition = function() {
  		return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(0, (this.height_/2)-20));
	}
		
		
		
		
			
		// ----------------- VELO ---------------------------
		
	
		function UAlert() {
			this.divBackground = null;
			this.divAlert = null;
			this.divBlocked = null;
		}
		
		UAlert.prototype.init = function(name) 
		{
			if (this.divBackground) {
				this.divBackground.parentNode.removeChild(this.divBackground);
			}	
			if (this.divAlert) {
				this.divAlert.parentNode.removeChild(this.divAlert);
			}	
		
			this.divBackground = document.createElement("div");
			this.divBackground.setAttribute("align","center");
			this.divBackground.setAttribute("id","divEsperaFondo");

			this.divAlert = document.createElement("div");
			this.divAlert.setAttribute("align","center");
			this.divAlert.setAttribute("id","divEsperaDibu");

			
			var body = document.getElementsByTagName('BODY')[0];
				body.appendChild(this.divBackground);
				body.appendChild(this.divAlert);
			
									
			this.divBlocked = document.getElementById(name);
			var bkCoords = UtilAJAX.findCoords(this.divBlocked); 
			var bkWidth = UtilAJAX.findWidth(this.divBlocked);
			var bkHeight = UtilAJAX.findHeight(this.divBlocked);	
							
			this.divBackground.style.height = bkHeight;
			this.divBackground.style.width = bkWidth;
			this.divBackground.style.top = bkCoords["top"];
			this.divBackground.style.left = bkCoords["left"];
				
			var alertHeight =  UtilAJAX.findHeight(this.divAlert);
			var alertWidth =  UtilAJAX.findWidth(this.divAlert);
			this.divAlert.style.top = bkCoords["top"] + (bkHeight/2) - (alertHeight/2);
			this.divAlert.style.left = bkCoords["left"] + (bkWidth/2) - (alertWidth/2);
		}
		
		UAlert.prototype.show = function(show) {
			if (this.divBackground)
			{
				var visibility = (document.layers) ? ((show)?"show":"hide") : ((show)?"visible":"hidden");
				this.divBackground.style.visibility = visibility;
				this.divAlert.style.visibility = visibility;
			}	
		}
		UAlert.prototype.setContent = function(html) {
			this.divAlert.innerHTML = html;
		}
		// ---------- pestañita

		function UFlap() {
			this.divFlap = null;
			this.divAnchored = null;
		}

		UFlap.prototype.init = function(name) 
		{
			if (this.divFlap) {
				this.divFlap.parentNode.removeChild(this.divFlap);
			}	
			this.divFlap = document.createElement("div");
			this.divFlap.setAttribute("align","center");
			this.divFlap.setAttribute("id","divFlap");
			
			var body = document.getElementsByTagName('BODY')[0];
				body.appendChild(this.divFlap);
				
			this.divAnchored = document.getElementById(name);
			var bkCoords = UtilAJAX.findCoords(this.divAnchored); 
			
			this.divFlap.style.top = bkCoords["top"];
			this.divFlap.style.left = bkCoords["left"] + 10;
			
		}			
		UFlap.prototype.show = function(show) {
			if (this.divFlap)
			{
				var visibility = (document.layers) ? ((show)?"show":"hide") : ((show)?"visible":"hidden");
				this.divFlap.style.visibility = visibility;
			}	
		}
		UFlap.prototype.setContent = function(html) {
			this.divFlap.innerHTML = html;
		}
		UFlap.prototype.close = function() {
			if (this.divFlap) {
				this.divFlap.parentNode.removeChild(this.divFlap);
			}
			this.divFlap = null;
			this.divAnchored = null;
		}
		UFlap.prototype.isOpen = function() {
			if (this.divFlap) return true;
			else return false;
		}	
		
