
function get_num(pint)
{
  var S=""
  S=String(pint);
  S=S.substring(0,6);
  S=S.replace(".",",")
  return S
}


function loadM(GenerovaniSouradnic_Nazev,GenerovaniSouradnic,ElementMap,Zomm,CenterX,CenterY,PoleX,PoleY,PoleIcon,PoleMista,PoleHTML) 
{

if (GBrowserIsCompatible()) {

      var iconX = new GIcon();

function TYP_IKONY(typi){
  switch (typi)
  {
  case 0 :
  iconX = icon0;
  break;
  case 1 :
  iconX = icon1;
  break;
  case 2 :
  iconX = icon2;
  break;
  case 3 :
  iconX = icon3;
  break;
  default :
  iconX = icon;
  }
  return iconX
}

      
function createMarker4(point,name,html,infoUrl,TypIkony) {

        var marker = new GMarker(point,{ title: name, icon: TYP_IKONY(TypIkony) }  );
        GEvent.addListener(marker, "click", 
        function() {

        marker.openInfoWindowHtml(html);
        });
        
        return marker;
      } 
      
      

//-------------------------------------------------------------------------------      

var map = new GMap2(document.getElementById(ElementMap));
map.addControl(new GSmallMapControl());
map.setCenter(new GLatLng(CenterX,CenterY), Zomm);
//-------------------------------------------------------------------------------      


var icon = new GIcon();
icon.image = "http://labs.google.com/ridefinder/images/mm_20_black.png";
icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icon.iconSize = new GSize(12, 20);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);


var icon0 = new GIcon();
icon0.shadow = icon.shadow
icon0.iconSize = icon.iconSize
icon0.shadowSize = icon.shadowSize
icon0.iconAnchor = icon.iconAnchor
icon0.infoWindowAnchor = icon.infoWindowAnchor

icon0.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";


var icon1 = new GIcon();
icon1.shadow = icon.shadow
icon1.iconSize = icon.iconSize
icon1.shadowSize = icon.shadowSize
icon1.iconAnchor = icon.iconAnchor
icon1.infoWindowAnchor = icon.infoWindowAnchor

icon1.image = "http://labs.google.com/ridefinder/images/mm_20_blue.png";


var icon2 = new GIcon();
icon2.shadow = icon.shadow
icon2.iconSize = icon.iconSize
icon2.shadowSize = icon.shadowSize
icon2.iconAnchor = icon.iconAnchor
icon2.infoWindowAnchor = icon.infoWindowAnchor

icon2.image = "http://labs.google.com/ridefinder/images/mm_20_green.png";

var icon3 = new GIcon();
icon3.shadow = icon.shadow
icon3.iconSize = icon.iconSize
icon3.shadowSize = icon.shadowSize
icon3.iconAnchor = icon.iconAnchor
icon3.infoWindowAnchor = icon.infoWindowAnchor

icon3.image = "http://labs.google.com/ridefinder/images/mm_20_brown.png";



// ****************************************************************************

if (GenerovaniSouradnic=='True')
{
  if (GenerovaniSouradnic_Nazev!="")
  {
  geocoder = new GClientGeocoder();
  
  GenerovaniSouradnic_Nazev=GenerovaniSouradnic_Nazev.replace(", GB",", uk") //nefunguje
  
  
  geocoder.getLatLng(GenerovaniSouradnic_Nazev, 
  function(point)
  {
  if (!point)
  {
    document.getElementById('ctl00_ContentPlaceHolder1_longitudeYY').value=""
    document.getElementById('ctl00_ContentPlaceHolder1_longitudeXX').value=""
    document.getElementById('ctl00_ContentPlaceHolder1_Label9').innerHTML = "Automatick&eacute; vypln&#283;n&iacute; sou&#345;adnic se nepoda&#345;ilo! Najd&#283;te po&#382;adovan&eacute; m&iacute;sto v map&#283; a poklepejte na n&#283;m my&#353;&iacute;. P&#345;e&#269;t&#283;te si pokyny pro p&#345;id&aacute;ni nov&eacute;ho m&iacute;sta"                                   
  }
  else
  {
  
    document.getElementById('ctl00_ContentPlaceHolder1_longitudeYY').value=get_num(point.x);
    document.getElementById('ctl00_ContentPlaceHolder1_longitudeXX').value=get_num(point.y);
    
    document.getElementById('ctl00_ContentPlaceHolder1_Label9').innerHTML =""
    
     map.setCenter(point, Zomm);
     var marker = new GMarker(point,{title:GenerovaniSouradnic_Nazev});
     map.addOverlay(marker);
  }
  });
  PoleX.length=0;
  
  }



GEvent.addListener(map, "click", 
function(overlay, point) 
{
   document.getElementById('ctl00_ContentPlaceHolder1_longitudeYY').value=get_num(point.x);
   document.getElementById('ctl00_ContentPlaceHolder1_longitudeXX').value=get_num(point.y);
   
   map.clearOverlays();		
   map.addOverlay(new GMarker(point, icon));
});



};   
  //------------------------------------
  for(i=0;i<PoleX.length;i++)
  {

  var point1 = new GLatLng(PoleX[i],PoleY[i]);

  map.addOverlay(new GMarker(point1, TYP_IKONY(PoleIcon[i])));  


if (PoleMista[i]=='')
{
}
else
{
      
  var marker = createMarker4(point1,PoleMista[i],PoleHTML[i],"koule.htm",PoleIcon[i])      
  map.addOverlay(marker);
}
 

  }



}
else
{
alert("Sorry, the Google Maps API is not compatible with this browser")
}

}

function Jcalendar(Typex,Namex)
{
var address="calendar3.aspx?Type_date="+Typex+"&Name_date="+Namex
//alert(address)

win4 = window.open(address, "","width=180,height=230,menubar=no,resizable=no,status=no");

window.blur;
win4.focus;

}


