function goto(url)
{
window.location=url;
}


function pop_win(url)
{
window.open(url,'','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
} 
// ====== This function displays the tooltip ======
// it can be called from an icon mousover or a side_bar mouseover
function showTooltip(marker) {
  tooltip.innerHTML = marker.tooltip;
    var point=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.getBounds().getSouthWest(),map.getZoom());
    var offset=map.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),map.getZoom());
    var anchor=marker.getIcon().iconAnchor;
    var width=marker.getIcon().iconSize.width;
    var pos = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(offset.x - point.x - anchor.x + width,- offset.y + point.y +anchor.y));
    pos.apply(tooltip);
    tooltip.style.visibility="visible";
}

// ===== This function is invoked when the mouse goes over an entry in the side_bar =====
// It launches the tooltip on the icon
function mymouseover(i)
{
    showTooltip(gmarkers[i])
}
// ===== This function is invoked when the mouse leaves an entry in the side_bar =====
// It hides the tooltip
function mymouseout()
{
    tooltip.style.visibility="hidden";
}


function createMarker(point, name,description,picPath,link,nrStele,selected,pret,fromAdmin,poza)
{
  var icon = new GIcon(G_DEFAULT_ICON);
  var pathAdd = '';
  if (fromAdmin == 1)
      pathAdd = 'http://www.info-hotels.ro/images/';

  if (selected == 1)
   {
       icon.image = "http://www.info-hotels.ro/images/marker-hotel-orange-large.png";
       icon.iconSize = new GSize(17, 20);
       
   }
  else
  {
      icon.image = "http://www.info-hotels.ro/images/marker-hotel-blue.png";
      icon.iconSize = new GSize(17, 20);

    
   }
   if(poza ==true){
    icon.image = "http://www.info-hotels.ro/images/marker-hotel-blue.png";
    icon.iconSize = new GSize(18, 20);
   }

     var starPics = '';
      for (j=1;j<=5;j++)
      {
          if (j<=nrStele)
            starPics = starPics+'<img src="http://www.info-hotels.ro/images/full_star.gif">';
          else
            starPics = starPics+'<img src="http://www.info-hotels.ro/images/half_star.gif">';
      }

  markerOptions = { icon:icon };
    if(poza != false){
        
        var name2=name.split("Hoteluri ");
    name2[1] = name2[1].toLowerCase();
    if(name2[1] == 'curtea de arges')
        name2[1] = 'curtea';
    }
  var marker = new GMarker(point, markerOptions);
  if (selected == 1)  
      marker.tooltip = '<div class="tooltipSelected"><table width=100% cellspaning="0" celspacing="0" class="toolTipTitleSelected"><tr><td >'+name+'</td><td align="right">'+starPics+'</td></tr></table> <img src="'+picPath+'" class="logo">'+description+'<div>Pret: '+pret+'/noapte/camera single</div><\/div>';
  else{
    if(pret != "")
        marker.tooltip = '<div class="tooltip2"><table width=100% cellspaning="0" celspacing="0" class="toolTipTitle"><tr><td>'+name+' </td><td align="right">'+starPics+'</td></tr></table> <img src="'+picPath+'" class="logo" style="padding-left:1px;">'+description+'<div>Pret: '+pret+'/noapte/camera single</div><\/div>';
     else
        marker.tooltip = '<div class="tooltip2" style="height:227px;width:270px;padding-left:0px;margin-left:0px;" align="left"><table cellspaning="0"  celspacing="0" class="toolTipTitle" style="width:270px;padding-left:0px;margin-left:0px;" ><tr><td>'+name+' </td></tr></table> <img src="http://info-hotels.ro/images/orase/'+name2[1].replace(" ","-")+'.jpg"  ><\/div>';
     
  }
                      
                         
   //  ======  The new marker "mouseover" and "mouseout" listeners  ======
        GEvent.addListener(marker,"mouseover", function() {
          showTooltip(marker);
        });
        GEvent.addListener(marker,"mouseout", function() {
        tooltip.style.visibility="hidden"
        });

    GEvent.addListener(marker, "click", function() {
          goto(''+link);
        });
 
  return marker;
}

function checkMapForm()
{
   if (document.getElementById('clickLat').value  == '' || document.getElementById('clickLong') == '')
   {
        alert('Latitudinea sau Longitudinea nu sunt definite!!!');
        return false;
   }

   return true;
}




