    var negoci;
	var map;
    var gdir;
	var geocoder = null;
    var addressMarker;
	var lat;
	var lon;
	//*******************************************************
	//var latcat = 41.593456;
	//var loncat = 1.838377;
	//var latcat =  41.670450;
	//var loncat =  1.686662;
	var latcat =  41.2469;
	var loncat =  1.32925;
	//-------------------------------------------------------
	var pointcat = new GLatLng(latcat, loncat);
	var pos;
	var idiomap;
	var zoomini;
	var maptype;
	var centreicox;
	var centreicoy;
	var tamanyiconx;
	var tamanyicony;
	var tamanyicosox;
	var tamanyicosoy;
	var ancleinfowinx;
	var ancleinfowiny;
	var defecteinicirut;
	var descripcio;
	//*******************************************************
	negoci = "Cal Cant&oacute;";
	telefon = "620 629 133 / 977 260 658";
	web = "www.calcanto.com";
	var weblink = "<a href=\"http://www.calcanto.com/\" target=\"_blank\">www.calcanto.com</a>";
	defecteinicirut = "Tarragona";
	lat = 41.2469;
	lon = 1.32925;
	laticona = 41.2469;
	lonicona = 1.32925;
	//-------------------------------------------------------
	pos = (lat+' '+lon);
	var point = new GLatLng(lat, lon);
	var pointicona = new GLatLng(laticona, lonicona);
	var bounds = new GLatLngBounds();
	
	//*******************************************************
	idiomap = "ca";
	zoomini = 8;
	maptype = "G_NORMAL_MAP";
	//maptype = "G_SATELLITE_TYPE";
	//maptype = "G_PHYSICAL_MAP";
	tamanyiconx = 141;
	tamanyicony = 110;
	centreiconx = 66;
	centreicony = 90;
	tamanyicosox = 141;
	tamanyicosoy = 110;
	//-------------------------------------------------------
	ancleinfowinx= centreiconx;
	ancleinfowiny = centreiconx;
	descripcio = '<h3>'+negoci+'</h3>';
	descripcio += "Tel: "+telefon+"<br />";
	descripcio += "web: "+web+"<br />";
	//-------------------------------------------------------
	
	var icona = new GIcon(G_DEFAULT_ICON);
	//*******************************************************
	icona.image = "../images/goom/marcador14.png";
	icona.shadow = "../images/goom/marcador14s.png";
	//-------------------------------------------------------
	icona.iconSize = new GSize(tamanyiconx, tamanyicony);
	icona.shadowSize = new GSize(tamanyicosox, tamanyicosoy);
	icona.iconAnchor = new GPoint(centreiconx, centreicony);
	icona.infoWindowAnchor = new GPoint(ancleinfowinx, ancleinfowiny);
	markerOptions = { icon:icona };
	var logo = new GMarker(pointicona, markerOptions);
	
    function initialize() {
      if (GBrowserIsCompatible()) {      
        map = new GMap2(document.getElementById("map_canvas"));
		map.addMapType(G_PHYSICAL_MAP);
		map.setCenter(pointcat, zoomini);
		map.setMapType(G_PHYSICAL_MAP);
		map.addControl(new GSmallMapControl());
		//map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		map.addControl(new GOverviewMapControl());
		map.addControl(new GScaleControl());
		map.addOverlay(logo); 
		
		
		//GEvent.addListener(logo, 'click',
   			//function() {
   			//logo.openInfoWindowHtml(descripcio);
   			//});
		
		
        
		gdir = new GDirections(map, document.getElementById("directions"));
        GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleErrors);
createTabbedMarker(point,html1,html2,label1,label2);
        //setDirections("Tarragona",pos, idiomap);
		//map.centerAndZoom(new GPoint("Tarragona"), 3);

      }
    }
		
	// A function to create a tabbed marker and set up the event window***************************
	//<![CDATA[

	var label1="info";
	//var html1="html1";
	var html1 = '<h3>'+negoci+'</h3>';
	html1 += 'Tel: '+telefon+'<br />';
	html1 += 'web: '+weblink+'<br />';
	//var html1="html1";
	var label2='Dirección';
	var html2= '<table border="0" cellspacing="0" cellpadding="4">';
   	html2 += '<tr>';
    html2 += '<td><img src="18.jpg" alt="Cal Cant&oacute;" width="90" height="60" border="0" align="left" /></td>';
    html2 += '<td><p><strong>Direcci&oacute;n</strong><br />';
	html2 += 'Cal Cant&oacute; - Casa de Pay&eacute;s<br />';
    html2 += 'Sant Pere, 11<br />';
 	html2 += '<span class="subr">43886 VILABELLA (Tarragona)</span></p></td>';
   	html2 += '</tr>';
	html2 += '</table>';
    function createTabbedMarker(point,html1,html2,label1,label2) {
    
	var marker = new GMarker(point);
    //GEvent.addListener(marker, "click", function() {
GEvent.addListener(logo, "click", function() {
	logo.openInfoWindowTabsHtml([new GInfoWindowTab(label1,html1), new 
	GInfoWindowTab(label2,html2)]);
	//map.panBy(0,50);
    });
    //return marker;
	return logo;
    }
//]]>

	//determina si s'ha premut l'enter ************************************************************
	function esEnter(e){
		var characterCode;							
			if(e && e.which){ //if which property of event object is supported (NN4)
				e = e;
				characterCode = e.which; //character code is contained in NN4s which property
			}else{
				e = event;
				characterCode = e.keyCode; //character code is contained in IEs keyCode property
			}
	
		//comprovem l'enter
		if(characterCode == 13){ 
		return true;
		}								
	}
	//----------------------------------------------------------------------------------------------

	function zoomafx(){
		map.setMapType(G_NORMAL_MAP);

	}
	//----------------------------------------------------------------------------------------------
    
    function setDirections(fromAddress, toAddress, locale) {
    gdir.load("from: " + fromAddress + " to: " + toAddress,{ "locale": locale });
	zoomafx();
	}
	//----------------------------------------------------------------------------------------------
    function handleErrors(){
	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	     alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	     alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
	   
	   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	     alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);

	//   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
	//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);
	     
	   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
	     alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	     alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
	    
	   else alert("An unknown error occurred.");
	   
	}

	function onGDirectionsLoad(){ 
      // Use this function to access information about the latest load()
      // results.

      // e.g.
      // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
	  // and yada yada yada...
	}


    
   window.onload = initialize;
   window.onunload = GUnload;
 
 
 
 
