moveTo(0,0);
resizeTo(screen.availWidth,screen.availHeight);
var x = screen.availHeight;
resizeTo(screen.availWidth,screen.availHeight);
function openWindow(URL,windowName,windowFeatures){
newWindow=window.open(URL,windowName,windowFeatures);
}
function closeWindow(windowName){
newWindow.close(windowName);
}

//<![CDATA[	
var browserName=navigator.appName;
var geocoder = null;var geoXml;
var map = "map";
var height;var html;var mark1;
var gmarkers = [];var htmls = [];var reg_array = [];var lat_array = [];var log_array = [];
var photos;
var start=0;
var language1;var lang;
var p=0;
var laty  = 39.6130941;var logx = 2.9072570;var zm   = 10;var laty1  = 39.6130941;var logx1 = 2.9072570;var zm1   = 10;
var home1 = false;
var tabscale = 1.25;var tabht= 170*tabscale;var tabwd= 310*tabscale;
var mgr;var mp;
var Elong ;var Wlong ;var Nlat;var Slat;
var address;
var aObj;
var count = 0;
var cat;var icon;
var img =false;var rest=false;var hotel= false;var rental=false;var sales=false;var pol =false;var golf = false;var sail = false;var utub = false;
var fish =false;var comm = false;var act0 = false;var google_on=false;
var mycenter;var center;var curzoom;
var input_item;
var qt;var Wl2;var El2;var Sl2;var Nl2;


var pin = new GIcon();
	pin.image = "pin.png";
	pin.iconSize = new GSize(27, 40);
	pin.iconAnchor = new GPoint(5, 40);
	pin.infoWindowAnchor = new GPoint(10,0);
	
var pin1 = new GIcon();
	pin1.iconSize = new GSize(30, 30);
	pin1.iconAnchor = new GPoint(10, 10);
	pin1.infoWindowAnchor = new GPoint(10,0);
	
var icon1 = new GIcon();
	icon1.image = "http://www.panoramio.com/img/panoramio-marker.png";
	icon1.shadow = "http://www.panoramio.com/img/panoramio-shadow.png";
	icon1.iconSize = new GSize(20, 20);
	icon1.shadowSize = new GSize(12, 12);
	icon1.iconAnchor = new GPoint(10, 10);
	icon1.infoWindowAnchor = new GPoint(10, 0);
	
var hcon = new GIcon();
	hcon.image = "Hotel.png";
	hcon.iconSize = new GSize(20, 20);
	hcon.iconAnchor = new GPoint(10, 10);
	hcon.infoWindowAnchor = new GPoint(10, 0);

var prcon = new GIcon();
	prcon.image = "pr.png";
	prcon.iconSize = new GSize(27, 27);
	prcon.iconAnchor = new GPoint(10, 10);
	prcon.infoWindowAnchor = new GPoint(10, 0);
	
var pscon = new GIcon();
	pscon.image = "ps.png";
	pscon.iconSize = new GSize(32, 40);
	pscon.iconAnchor = new GPoint(10, 10);
	pscon.infoWindowAnchor = new GPoint(10, 0);	

var restcon = new GIcon();
	restcon.image = "rest2.png";
	restcon.iconSize = new GSize(30, 30);
	restcon.iconAnchor = new GPoint(10, 10);
	restcon.infoWindowAnchor = new GPoint(10, 0);
	
var golfcon = new GIcon();
	golfcon.image = "golf1.png";
	golfcon.iconSize = new GSize(40, 25);
	golfcon.iconAnchor = new GPoint(40, 33);
	golfcon.infoWindowAnchor = new GPoint(20, 10);
	
var sailcon = new GIcon();
	sailcon.image = "sail1.png";
	sailcon.iconSize = new GSize(38, 50);
	sailcon.iconAnchor = new GPoint(0, 20);
	sailcon.infoWindowAnchor = new GPoint(10, 0);
	
var polcon = new GIcon();
	polcon.image = "pol.png";
	polcon.iconSize = new GSize(27, 27);
	polcon.iconAnchor = new GPoint(10, 10);
	polcon.infoWindowAnchor = new GPoint(10, 0);
	
var pollay = new GIcon();
	pollay.image = "pol_logo.png";
	pollay.iconSize = new GSize(100, 89);
	pollay.iconAnchor = new GPoint(0, 0);
	pollay.infoWindowAnchor = new GPoint(10, 0);
	
var Utube = new GIcon();
	Utube.image = "Utube1.png";
	Utube.iconSize = new GSize(48, 66);
	Utube.iconAnchor = new GPoint(24, 66);
	Utube.infoWindowAnchor = new GPoint(20, 10);
	
var fishcon = new GIcon();
	fishcon.image = "fish.png";
	fishcon.iconSize = new GSize(46, 47);
	fishcon.iconAnchor = new GPoint(24, 47);
	fishcon.infoWindowAnchor = new GPoint(20, 10);
var actcon = new GIcon();
	actcon.image = "act.png";
	actcon.iconSize = new GSize(46, 47);
	actcon.iconAnchor = new GPoint(10, 10);
	actcon.infoWindowAnchor = new GPoint(10, 0);
var commcon = new GIcon();
	commcon.image = "comm.png";
	commcon.iconSize = new GSize(46, 47);
	commcon.iconAnchor = new GPoint(24, 47);
	commcon.infoWindowAnchor = new GPoint(10, 0);
	
var lolcon = new GIcon();
	lolcon.image = "biglol.png";
	lolcon.iconSize = new GSize(50, 79);
	lolcon.iconAnchor = new GPoint(5, 79);
	lolcon.infoWindowAnchor = new GPoint(10, 0);	

var gSmallIcon = new GIcon();
	gSmallIcon.image = "smile.png";
	gSmallIcon.iconSize = new GSize(35, 34);
	gSmallIcon.iconAnchor = new GPoint(0, 34);
	gSmallIcon.infoWindowAnchor = new GPoint(17, 0);
	
	

geoXml = new GGeoXml("http://www.mallorca-directory.com/kml/Bugadelles.kml");

// Our global state
	    var gLocalSearch;

	    var gSelectedResults = [];
	    var gCurrentResults = [];
	    var gSearchForm;
	    
	    // Create our "tiny" marker icon
	    
	    
	    
	    // Set up the map and the local searcher.
	    function Initial() {
	    	google_on=true;
	      gSearchForm = new GSearchForm(false, document.getElementById("searchform"));
	      gSearchForm.setOnSubmitCallback(null, CaptureForm);
	      gSearchForm.input.focus();
	    // Initialize the local searcher
	      gLocalSearch = new GlocalSearch();
	      gLocalSearch.setCenterPoint(map);
	      gLocalSearch.setSearchCompleteCallback(null, OnLocalSearch);
	      // Execute the initial search
	      gSearchForm.execute("restaurants");
	    }
	   
	   
	   
	   
	   // Called when Local Search results are returned, we clear the old
	    // results and load the new ones.
	    function OnLocalSearch() {
	      if (!gLocalSearch.results) return;
	      var searchWell = document.getElementById("googlecontent");
	      // Clear the map and the old search well
	      searchWell.innerHTML = "";
	      for (var i = 0; i < gCurrentResults.length; i++) {
	        if (!gCurrentResults[i].selected()) {
	          map.removeOverlay(gCurrentResults[i].marker());
	        }
	      }
	      gCurrentResults = [];
	      for (var i = 0; i < gLocalSearch.results.length; i++) {
	        gCurrentResults.push(new LocalResult(gLocalSearch.results[i]));
	      }
	       
	     // move the map to the first result
	      //var first = gLocalSearch.results[0];
	      //var point1 = new GPoint( parseFloat(first.lat),parseFloat(first.lng));
	      //map.setCenter(point1);
	      //map.panTo(point1);
	    }
	    
	    
	    
	    // Cancel the form submission, executing an AJAX Search API search.
	    function CaptureForm(searchForm) {
	    input_item = searchForm.input.value;
	      gLocalSearch.execute(searchForm.input.value);
	      
	      return false;
	    }
	    
	   
	    
	    // A class representing a single Local Search result returned by the
	    // Google AJAX Search API.
	    
	    function LocalResult(result) {
	      this.result_ = result;
	      
	      this.resultNode_ = this.unselectedHtml();
	      document.getElementById("googlecontent").appendChild(this.resultNode_);
	      map.addOverlay(this.marker(gSmallIcon));
	    }

	    // marker()  Returns the map marker for this result, creating it with the given
	    // icon if it has not already been created.
	    
	    LocalResult.prototype.marker = function(opt_icon) {
	      if (this.marker_) return this.marker_;
	      var marker = new GMarker(new GLatLng(parseFloat(this.result_.lat),parseFloat(this.result_.lng)),opt_icon);
	      GEvent.bind(marker, "mouseover", this, function() {
	      marker.openInfoWindow(this.selected() ? this.selectedHtml() :
	                                                this.unselectedHtml());
	      });
	      this.marker_ = marker;
	      return marker;
	    }
	    
	    
	function Buildform(results){
     		// create a search control
	          var searchControl = new GSearchControl();
	     	// web search, close
	          options = new GsearcherOptions();
	          options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
	          options.setRoot(document.getElementById("googlecontent"));
	          searchControl.addSearcher(new GwebSearch(), options);
	          
	      
	     // tell the searcher to draw itself and tell it where to attach
	        searchControl.draw(document.getElementById("searchbox"));
	         searchControl.execute(results);   
	      }
	      
	      
	    // select()   "Saves" this result if it has not already been saved
	    
	    LocalResult.prototype.select = function() {
	      if (!this.selected()) {
	        this.selected_ = true;

	        // Remove the old marker and add the new marker
	        map.removeOverlay(this.marker());
	        this.marker_ = null;
	        map.addOverlay(this.marker(lolcon));
	        			                                               
			
	        // Add our result to the saved set
	        
	        //document.getElementById("selected").appendChild(this.selectedHtml());
	       //these ok city,title,streetAddress,region,phoneNumbers[0],phoneNumbers.length,(google)url;
	        
	        // Remove the old search result from the search well
	        if(this.resultNode_.parentNode){
	        this.resultNode_.parentNode.removeChild(this.resultNode_);
	        }
	        // ************************************************
	        var titles =this.result_.title;
	        titles=titles.replace( "<b>", "");
		titles=titles.replace( "<b>", "");
		titles=titles.replace( "</b>", "");
	        titles=titles.replace( "</b>", "");
	        Buildform(titles +' '+ this.result_.city);	
		// ************************************************
	      }
	    }
	    
	    
	    
	    // unselectedHtml()Returns the HTML we display for a result before it has been "saved"
	    
	    LocalResult.prototype.unselectedHtml = function() {
	      container = document.createElement("div");
	      container.className = "unselected";
	      container.appendChild(this.result_.html.cloneNode(true));
	      var saveDiv = document.createElement("div");
	      saveDiv.className = "select";
	      saveDiv.innerHTML = "Save this location";
	      GEvent.bindDom(saveDiv, "click", this, function() {
	      map.closeInfoWindow();
	      this.select();
	      gSelectedResults.push(this);
	      });
	      container.appendChild(saveDiv);
	      return container;
	    }
	    
	    // selectedHtml() Returns the HTML we display for a result after it has been "saved"
	    
	    LocalResult.prototype.selectedHtml = function() {
	    tabht= 170*tabscale;
	    tabwd= 310*tabscale;
	    var titles =this.result_.title;
	    titles=titles.replace( "<b>", "");
	    titles=titles.replace( "</b>", "");
	    if(this.result_.phoneNumbers[0].number == 'null'){
	    tel = 'none';
	    }else{
	    var tel=this.result_.phoneNumbers[0].number;
	    }    
	    html ="<OBJECT classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' WIDTH='"+tabwd+"' HEIGHT='"+tabht+"' id='Info_new' align='left'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='Info_new.swf' /><param name='flashvars' value='n_title="+titles+"&n_lat="+this.result_.lat+"&n_log="+this.result_.lng+"&n_city="+this.result_.city+"&n_zone="+this.result_.region+"&n_tel="+tel+"'/><param name='WMODE' value='transparent'><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='http://www.mallorca-directory.com/Info_new.swf' quality='high' bgcolor='#ffffff' WIDTH='"+tabwd+"' HEIGHT='"+tabht+"' name='Info_new' align='left' flashvars='n_title="+titles+"&n_lat="+this.result_.lat+"&n_log="+this.result_.lng+"&n_city="+this.result_.city+"&n_zone="+this.result_.region+"&n_tel="+tel+"' WMODE='transparent' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";
	    //this.result_.html.cloneNode(true);
	      return html;
	    }

	    // selected()  Returns true if this result is currently "saved"
	    
	    LocalResult.prototype.selected = function() {
	      return this.selected_;
	    }

		
		function photosdisplay(){

				if(!photos || photos== undefined){ return;}
				for (var i = 0; i < photos.length; i++)
				{

				point = new GLatLng(photos[i].latitude, photos[i].longitude);
				var p = photos[i];
				var html="<div id='infowin' style='height:" + (p.height + 80) + "px width:+(p.width +50)+px'>" +
				"<p><a href='http://www.panoramio.com/' target='_blank'><img src='http://www.panoramio.com/img/logo-small.gif' width='119px' height='25px' alt='Panoramio logo' /><\/a></p>" +
				"<a id='photo_infowin' >" +
				"<img width='" + p.width + "' height='" + p.height + "' src='" + p.photo_file_url + "'/><\/a>" +
				"<div style='overflow: hidden; width: 240px;'>" +
				"<p><a target='_blank' class='photo_title' href='" + p.photo_url +
				"'><strong>" + p.photo_title + "<\/strong><\/a></p>" +
				"<p>Posted by <a target='_blank' href='" + p.owner_url + "'>" +
				p.owner_name + "<\/a></p><\/div>";
				var imgs=map.getZoom()*2;
				icon1.iconSize = new GSize(imgs,imgs);
				icon1.image = "http://www.panoramio.com/photos/mini_square/"+p.photo_id+".jpg";
				map.addOverlay(createMarker(point, i + 1,map,html,icon1,0,p.photo_title));

				}}
				
		function loadData_gen(CategoryID,GroupID,SubID,Mode){
					findbounds();
					map.clearOverlays() ;
					
				 GDownloadUrl("php/api_data_gen_mal3.php?category="+CategoryID+"&mode="+Mode+"&groupId="+GroupID+"&subId="+SubID+"&El="+Elong+"&Wl="+Wlong+"&Nl="+Nlat+"&Sl="+Slat, function(data) {
				var xml = GXml.parse(data);
				display_data(xml,'Info_gen',pin1,CategoryID);
				});
				    }		
				
		function loadData_prop(CategoryID,GroupID,SubID,Mode){
					findbounds();
					map.clearOverlays() ;
					
				  GDownloadUrl("php/api_data_prop_mal3.php?category="+CategoryID+"&mode="+Mode+"&groupId="+GroupID+"&subId="+SubID+"&El="+Elong+"&Wl="+Wlong+"&Nl="+Nlat+"&Sl="+Slat, function(data) {
				var xml = GXml.parse(data);
				display_data(xml,'Info_prop_mall',pin1,CategoryID);
				});
				    }
				    
				    
		function load_hotels(){
				
				GDownloadUrl("php/mal_mash_hotels.php?El="+Elong+"&Wl="+Wlong+"&Nl="+Nlat+"&Sl="+Slat, function(data) {
				var xml = GXml.parse(data);
				display_data(xml,'Info_gen',hcon,'accomodation');
				}); 
				    }
		function load_pr(){
				GDownloadUrl("php/mall_mash_pr.php?category=property_rent&El="+Elong+"&Wl="+Wlong+"&Nl="+Nlat+"&Sl="+Slat, function(data) {
				var xml = GXml.parse(data);
				display_data(xml,'Info_gen_prop',prcon,'property_rent');
				});
				}
				
		function load_ps(){
				GDownloadUrl("php/mall_mash_pr.php?category=property_sales&El="+Elong+"&Wl="+Wlong+"&Nl="+Nlat+"&Sl="+Slat, function(data) {
				var xml = GXml.parse(data);
				display_data(xml,'Info_gen_prop',pscon,'property_sales');
				});		
				    }
		function load_vr_pr(){
				GDownloadUrl("php/vr_mash_pr.php?El="+El2+"&Wl="+Wl2+"&Nl="+Nl2+"&Sl="+Sl2, function(data) {
				var xml = GXml.parse(data);
				display_data(xml,'Info_prop_VR',prcon,'property_rent');
				});
				    }		    
				    
				    
		function load_gen(category,mark){
				
				GDownloadUrl("php/mall_mash_gen.php?category1="+category+"&El="+Elong+"&Wl="+Wlong+"&Nl="+Nlat+"&Sl="+Slat, function(data) {
				var xml = GXml.parse(data);
				var imgs=map.getZoom()*2.3;
				mark.iconSize = new GSize((imgs),imgs);
				display_data(xml,'Info_gen',mark,category);
				});
				    }		    
		function load_gen_grp(category,mark1,grp,x,y){
				
				GDownloadUrl("php/mall_mash_gen_grp.php?category1="+category+"&groupId="+grp+"&El="+Elong+"&Wl="+Wlong+"&Nl="+Nlat+"&Sl="+Slat, function(data) {
				var xml = GXml.parse(data);
				var imgs=map.getZoom()*2;
				mark1.iconSize = new GSize((imgs*x),imgs*y);
				display_data(xml,'Info_gen',mark1,category);
				});
				    }	
				    
		function load_editable(category,mark,x,y){
				
				GDownloadUrl("php/mall_mash_editable.php?category1="+category+"&El="+Elong+"&Wl="+Wlong+"&Nl="+Nlat+"&Sl="+Slat, function(data) {
				var xml = GXml.parse(data);
				var imgs=map.getZoom()*2;
				mark.iconSize = new GSize(imgs*x,imgs*y);
				display_data(xml,'Info_edit',mark,category);
				});
				    }
				    
				    
		function load_Utube(category){
				
				GDownloadUrl("php/mall_mash_utube.php?category="+category+"&El="+Elong+"&Wl="+Wlong+"&Nl="+Nlat+"&Sl="+Slat, function(data) {
				var xml = GXml.parse(data);
				display_Utube(xml,name,Utube,cat);
				});
				    }			    
		
		function load_Pol_sites(){

				GDownloadUrl("php/pol_sites.php?El="+Elong+"&Wl="+Wlong+"&Nl="+Nlat+"&Sl="+Slat, function(data) {
				var xml = GXml.parse(data);
				var imgs=map.getZoom()*4;
				pollay.iconAnchor = new GPoint(imgs/2, imgs);
				pollay.iconSize = new GSize((imgs),imgs);
				display_Pol(xml,name,pollay,'poligono1');
				});
		    		}
		
		function display_Pol(xml,name,pollay,cat){
				var markers = xml.documentElement.getElementsByTagName("marker");
				for (var i = 0; i < markers.length; i++) {
				var agent = markers[i].getAttribute("agent");
				var title = markers[i].getAttribute("title");
				var map_zm = parseFloat(markers[i].getAttribute("zoom"));
				point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),parseFloat(markers[i].getAttribute("log")));
				map.addOverlay(createMarker(point,i+1,map,html,pollay,cat,title,"none",map_zm));
				}
				}
						
		function display_data(xml,name,mark,cat){
				var markers = xml.documentElement.getElementsByTagName("marker");
				markers_length = markers.length;
				if(markers_length >= 40)markers_length=40;
				for (var i = 0; i < markers_length; i++) {
				var reg = markers[i].getAttribute("regNo");
				var title2 = markers[i].getAttribute("title");
				mark.image = markers[i].getAttribute("symbol");
				var video = markers[i].getAttribute("video");
				point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),parseFloat(markers[i].getAttribute("log")));
				tabht= 170*tabscale;
				tabwd= 310*tabscale;
				html ="<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='"+tabwd+"' HEIGHT='"+tabht+"' id='"+name+"' ALIGN='middle'> <param name='movie' value='"+name+".swf?' /> <param name='allowScriptAccess' value='always' /> <param name='flashvars' value='regNo="+reg+"&category="+cat+"'/><param name='quality' value='high' /> <param name='wmode' value='transparent' /> <param name='bgcolor' value='#ffffff' /> <EMBED src='"+name+".swf' quality='high' wmode='transparent' bgcolor='#ffffff'  WIDTH='"+tabwd+"' HEIGHT='"+tabht+"'  flashvars='regNo="+reg+"&category="+cat+"'     SwLiveConnect='true' NAME='"+name+"' ALIGN='middle' allowScriptAccess='always' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED> </OBJECT>";
				window.status = "My Done1";
				map.addOverlay(createMarker(point,i+1,map,html,mark,cat,title2,video));

				    }
				    }
		function display_Utube(xml,name,mark,cat){
		
				var markers = xml.documentElement.getElementsByTagName("marker");
				markers_length = markers.length;
				if(markers_length >= 40)markers_length=40;
				for (var i = 0; i < markers_length; i++) {
				var reg = markers[i].getAttribute("regNo");
				var title2 = markers[i].getAttribute("title");
				point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),parseFloat(markers[i].getAttribute("log")));
				var html ="<object width='425' height='373'><param name='movie' value='http://www.youtube.com/v/"+reg+"&rel=0&autoplay=1'></param><param name='wmode' value='transparent'></param><embed src='http://www.youtube.com/v/"+reg+"&rel=0&border=1' type='application/x-shockwave-flash' wmode='transparent' width='425' height='373'></embed></object>";
				map.addOverlay(createMarker(point, i + 1,map,html,mark,cat,title2,"none"));

				    }		  
				    
				}    
		

		/* Creates a marker at the given point with the given number label*/

		function createMarker(point,number,map,html,icon,cat,pop,film,map_zm) {
		                var marker = new GMarker(point,{icon:icon,title:pop,draggable:true});
				
				/*Add a Listner for Click on marker*/
					GEvent.addListener(marker, "click", function() {
						if(cat == 'poligono1'){
						map.setCenter(marker.getPoint());
						map.setZoom(map_zm);
						window.document.MD_header.SetVariable('sat',1);
						MapType(G_SATELLITE_MAP);
						}else{
						mycenter = marker.getPoint();
							if(film=="none"){
							marker.openInfoWindowHtml(html);
							}else{
							var html1 ="<object width='"+tabwd+"' height='"+tabht+"'><param name='movie' value='http://www.youtube.com/v/"+film+"&rel=0&autoplay=1'></param><name='scale' value='exactfit'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/"+film+"&rel=0&autoplay=1' type='application/x-shockwave-flash' allowscriptaccess='always' scale='exactfit' width='"+tabwd+"' height='"+tabht+"'></embed></object>";
                                                	marker.openInfoWindowTabsHtml([new GInfoWindowTab('main',html), new GInfoWindowTab('video',html1)]);
							}
						}
						});
					GEvent.addListener(marker, "dragstart", function() {
		          		//map.closeInfoWindow();
		        			});	
					GEvent.addListener(marker, "dragend", function() {
		          		//marker.openInfoWindowHtml("Just bouncing along...");
		          		mycenter = marker.getPoint();
					
						});
					
					gmarkers[number] = marker;
					htmls[number] = html;
					return marker;
					}
				
		
		function icon_on(ph, ht, rst, p_r, act1, sl, gf, fh, cm, pl, ut, p_s){
				/* Selected Symbol */
				img = ph; rest= rst; hotel = ht; rental = p_r; act0 = act1; sail = sl; golf = gf;
				fish = fh; comm = cm; pol = pl; utub = ut; sales = p_s;passFlash();
				}
			
		function storePhotos(panoramio){
			count = panoramio.count;
			photos = panoramio.photos;
			window.document.MD_header.SetVariable('count',count);
			if (count >0){
				photosdisplay();
			}
			
		}

		function myclick(i,scle) {
				
				/*Open marker from detail search*/
					tabscale = scle;
					gmarkers[i].openInfoWindowHtml(htmls[i]);
		      	   }

		function loadzoom(zm1){
			       map.setZoom(zm1);
			       	       }
			       			       
		function catchevent() {
		eventSrcID=(event.srcElement)?event.srcElement.id:'undefined';
		eventtype=event.type;
		status=eventSrcID+' has received a '+eventtype+' event.';
		}
		

		function MyApplication() {
		
		      GEvent.addListener(map, "click", function(overlay,point) {
		      
		      if(overlay)return;
		      	  
			  if(map.getZoom()<10)map.setZoom(10);
			  map.setCenter(point);
			  map.panTo(point);
			  mycenter = map.getCenter();
			  window.document.MD_header.SetVariable('coord',mycenter);
			  pin.image = "pin.png";
			  var marker = new GMarker(point,pin);
			  var tabht= 190*tabscale;
			  var tabwd= 310*tabscale;
			  map.addOverlay(marker);
			  var html ="<OBJECT classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+tabwd+"' height='"+tabht+"' id='Blog' align='left'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='Blog.swf' /><param name='WMODE' value='transparent'><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='Blog.swf' quality='high' bgcolor='#ffffff' width='"+tabwd+"' height='"+tabht+"' name='Blog' align='left' WMODE='transparent' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object>";
			   
			  GEvent.addListener(marker, 'click', function() {
			 	marker.openInfoWindowHtml(html);
			 	});
		
			});
			
			  
		    	}
		function createMarker2(point){

			var marker = new GMarker(point,pin);
			map.setCenter(point);

			var html ="<OBJECT classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='310' height='190' id='Blog' align='left'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='Blog.swf' /><param name='WMODE' value='transparent'><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='Blog.swf' quality='high' bgcolor='#ffffff' width='310' height='190' name='Blog' align='left' WMODE='transparent' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object>";
			GEvent.addListener(marker, 'click', function() {
				marker.openInfoWindowHtml(html);
				});
			map.panTo(point);
			
			return marker;
				}
				
		 function read1(whatever){
		 	alert(whatever);
		 	}
		 	
		 function mycentre(which){
		 if(which == 'mall'){window.document.Info_gen.SetVariable('coord',mycenter);}
		 if(which == 'edit'){window.document.Info_edit.SetVariable('coord',mycenter);}	
		 if(which == 'blog'){window.document.Blog.SetVariable('coord',mycenter);}	
			}
		    	
    		function AddMarker(laty,logx,zm){
			point = new GLatLng(laty,logx);
			var marker = new GMarker(point);
			return marker;
	    		}
	    		
	    	function home(laty,logx,zm) {
	    		map.clearOverlays() ;
	    		point = new GLatLng(laty,logx,zm);
	    		map.setZoom(zm);
	    		map.panTo(point);
	    		passFlash();
	    		
			}
		function centremap(){
			map.closeInfoWindow();
			map.clearOverlays();
			map.panTo(center);
			}
		function clear_pages(){
		
			google_on=false;
			document.getElementById("googlecontent").innerHTML = "";
			document.getElementById("searchform").innerHTML = "";
			
			 }
		

		function showAddress(address) {
		      if (geocoder) {
			geocoder.getLatLng(address,function(point) {
			    if (!point) {
			      alert(address + " not found");
			    	} else {
			      if(map.getZoom()<12)map.setZoom(12);
			      pin.image = "pin.png";
			      map.setCenter(point);
			      map.panTo(point);
			      var html ="<OBJECT classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='310' height='190' id='Blog' align='left'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='Blog.swf' /><param name='WMODE' value='transparent'><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='Blog.swf' quality='high' bgcolor='#ffffff' width='310' height='190' name='Blog' align='left' WMODE='transparent' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object>";

			      var marker = new GMarker(point,{icon:pin,draggable: true});
			      
			              GEvent.addListener(marker, "dragstart", function() {
			                map.closeInfoWindow();
			              });
			      
			              GEvent.addListener(marker, "dragend", function() {
			              
			                marker.openInfoWindowHtml("<h1>"+address+"</h1><br> Add your interest or photo here");
			              });
			              
			              GEvent.addListener(marker, 'click', function() {
					marker.openInfoWindowHtml(html);
				      });
			      
        			map.addOverlay(marker);
        			marker.openInfoWindowHtml(address+"<br> To add an interest at this point <br>close info and Click on the pin ");
        			window.document.MD_header.SetVariable('elog',Elong);
				window.document.MD_header.SetVariable('coord',center);
				window.document.MD_header.SetVariable('zoom',curzoom);
				window.document.MD_header.SetVariable('wlog',Wlong);
				window.document.MD_header.SetVariable('nlat',Nlat);
				window.document.MD_header.SetVariable('slat',Slat);
			       	}
			});
	    	}}
	    	    	

		function load(laty,logx,zm) {
		
			GUnload();
		          if (GBrowserIsCompatible()) {
		        map = new GMap2(document.getElementById("map"));
		        map.addControl(new GLargeMapControl());
		        map.setCenter(new GLatLng(laty,logx),zm);
		        map.addControl(new GOverviewMapControl());
		        map.enableDragging();
		        map.enableScrollWheelZoom();
		        map.enableContinuousZoom();
		        map.addOverlay(geoXml);
		        geocoder = new GClientGeocoder();
		        window.document.MD_header.SetVariable('release',1);
		        //key=new GKeyboardHandler(map,window);
		        
		        home1 = true;
			MyApplication();
			
			icon_on(0,0,0,0,0,0,0,0,0,0,0,0);
				/*Add a Listner for lat&lng figures*/
				

				GEvent.addListener(map, "dragend", function() {
					center = map.getCenter();
					passFlash();
					});

				GEvent.addListener(map, "zoomend", function() {
					center = map.getCenter();
					passFlash();
					});	
			passFlash();
			}
			}

			function MapType(mp){
				map.setMapType(mp);
					}
				
			function findbounds(){	
				var bounds = map.getBounds();
				var southWest = bounds.getSouthWest();
				var northEast = bounds.getNorthEast();
				Elong = Math.round(new Number(northEast.lng())*10000)/10000;
				Wlong = Math.round(new Number(southWest.lng())*10000)/10000;
				Nlat =  Math.round(new Number(northEast.lat())*10000)/10000;
				Slat =  Math.round(new Number(southWest.lat())*10000)/10000;
				qt= (Elong-Wlong)/6;
				Wl2 = Math.round((qt+Wlong)*10000)/10000;
				El2 = Math.round((Elong-qt)*10000)/10000;
				qt= (Nlat-Slat)/6;
				Sl2 = Math.round((qt+Slat)*10000)/10000;
				Nl2 = Math.round((Nlat-qt)*10000)/10000;
				
				}
				
				
			function findphotos(){
			url1="http://www.panoramio.com/map/get_panoramas.php?order=popularity&set=public&from=0&to=40&minx="+Wlong+"&miny="+Slat+"&maxx="+Elong+"&maxy="+Nlat+"&callback=storePhotos&size=small";
			aObj = new JSONscriptRequest(url1);
			/* Build the script tag*/
			aObj.buildScriptTag();
			/* Execute (add) the script tag*/
			aObj.addScriptTag();
				if (browserName!=="Microsoft Internet Explorer"){
				aObj.removeScriptTag();
				}
			}
			

		    	function loadpage(pages){
				    pages.write('map');
				    }

			function update(laty,logx,zm){
				    up.write('map');
			    }
			    
			function lang(language1){
			   window.document.status_bar.SetVariable('idioma',language1);
			   }
			    
			function PassShort(reg){
			 	window.document.display_euro.SetVariable('reg_id',reg);
			 }
			function PassSearch(){
			 	window.document.display_euro.SetVariable('page4',1);
			 } 
			function PassEmail(){
			 	window.document.display_euro.SetVariable('friend',1);
			 	
			 }  
			function PassOptions(){
			 	window.document.display_euro.SetVariable('options',1);
			 	
			 }
			function Options(scle){ 
			 	tabscale = scle;
			 	}

			function PassUp(){
				center = map.getCenter();
		  		curzoom = map.getZoom();
			    window.document.Update_api.SetVariable('coord',center);
			    window.document.Update_api.SetVariable('zoom',curzoom);
			    
			    }

			

		  function passFlash(){
		  		
		  		center = map.getCenter();
		  		curzoom = map.getZoom();
		  		findbounds();
				window.document.display_euro.SetVariable('elog',Elong);
		  		window.document.display_euro.SetVariable('coord',center);
		  		window.document.display_euro.SetVariable('zoom',curzoom);
		  		window.document.display_euro.SetVariable('wlog',Wlong);
		  		window.document.display_euro.SetVariable('nlat',Nlat);
		  		window.document.display_euro.SetVariable('slat',Slat);
		  		window.document.MD_header.SetVariable('elog',Elong);
				window.document.MD_header.SetVariable('coord',center);
				window.document.MD_header.SetVariable('zoom',curzoom);
				window.document.MD_header.SetVariable('wlog',Wlong);
				window.document.MD_header.SetVariable('nlat',Nlat);
				window.document.MD_header.SetVariable('slat',Slat);
				map.clearOverlays();
				if(pol==true){load_Pol_sites();}
				if(hotel==true){load_hotels();}
				if(img)findphotos();
				if(rest==true && map.getZoom() >7){load_gen('FoodDrink',restcon);}
				if(act0==true && map.getZoom() >7){load_gen('activities',actcon);}
				if(comm==true && map.getZoom() >7){load_gen('commercial',commcon);}
				if(pol==true && map.getZoom()>14){load_gen('poligono',polcon);}
				if(sales==true && map.getZoom() >8){load_ps();}
				if(rental==true && map.getZoom() >8){load_pr();}
				if(rental==true && map.getZoom() >8){load_vr_pr();}
				if(golf==true && map.getZoom()>7){load_gen_grp('Golf',golfcon,391,2,1.5);}
				if(sail==true && map.getZoom()>7){load_gen_grp('Nautical',sailcon,822,1,2);}
				if(utub==true && map.getZoom()>9){load_Utube('Utube');}
				if(fish==true && map.getZoom()>7){load_gen_grp('Fish',fishcon,564,2,2);}
				if(map.getZoom()>9){load_Utube('Utube1');}
				if(google_on){gLocalSearch.execute(input_item);}
				
				}
//]]>
