       function cale(year,month)
       {
                $.ajax({
                         url: "http://www.clubjimbeam.com/ajax.php?calendar=1&month="+month+'&year='+year
                        ,success: function(data){
                                                    $('#cal').html(data);
                                                }
                        ,error: function()
                        {   
                            //$('#cal').html('Съжелявам но календара не може да бъде отворен от вашият броусър');
                            $.ajax({
                                        url: "http://www.clubjimbeam.com/ajax.php?calendar=1&month="+month+'&year='+year
                                        ,success: function(data)
                                        {
                                          $('#cal').html(data);
                                        }
                                        ,error: function()
                                        {
                                            alert('wtf');
                                        }
                                    });
                        }
                       });
        
       }
       function event_date(year,month,day,offset_left,offset_top)
       {
           
           $('#tooltip_div').stop(true,true); //stops the animations currently running on the tooltip
           
           take_date(year,month,day); //put content in the tooltip
           var new_offset_top = offset_top+50;
           
           $("#tooltip_div").css('left',offset_left);
           $('#tooltip_div').css('top',new_offset_top);
           $('#tooltip_div').css('opacity',0);
           $('#tooltip_div').css('display','block');
          // $('#clip').find('embed').css('opacity',0.5).css('z-index',0);
           $('#tooltip_div').css('z-index',21)
                            //.css('background-color','gray');  
           $('#tooltip_div').animate({
                                        opacity: 0.9,
                                        top: '-=50'
                                        }, 500, function() {
    // Animation complete.
  });;
       }
       function take_date(year,month,day)
       {
            if (window.XMLHttpRequest)
            {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }
            else
            {// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function()
            {
                if (xmlhttp.readyState==4 && xmlhttp.status==200)
                {
                    $("#tooltip_div").html(xmlhttp.responseText);
                }
            }
            xmlhttp.open("GET","../ajax.php?date=1&month="+month+'&year='+year+'&day='+day,true);
            xmlhttp.send();
       }
       function event_date_out()
       {
           $("#tooltip_div").stop(true,true);
           $('#tooltip_div').fadeOut('slow');
       }
       function find_left(item,clas)
       {
            var pos=item.position();
            /*if(clas=='twoNumber'){var offset=20;}
            if(clas=='oneNumber'){var offset=20;}
            if(clas!='oneNumber' && clas!='twoNumber'){var offset=0;}*/
            var offset=-15;
            var ret = parseInt(pos.left)+parseInt(offset);
            return ret;
       }
       function find_top(item)
       {
           var pos=item.position();
           var offset=18;
           var ret = parseInt(pos.top)+parseInt(offset);
           return ret;
       }
              
    var gdir;

    function initialize() {   
      if (GBrowserIsCompatible()) {
        //var map = new GMap2(document.getElementById("map_canvas"));     
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(42.6483985, 23.3420645), 13);
        map.setUIToDefault();  
        gdir = new GDirections(map, document.getElementById("directions"));
        GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleErrors); 

        setDirections("България, София, ул. Атанас Манчев 1", "България, София, ул. Атанас Манчев 1");
      }
    }

    function setDirections(fromAddress, toAddress) {
      gdir.load("from: " + fromAddress + " to: " + toAddress);
    }

    function handleErrors(){
     if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
       alert("Не е открит географски обект за указания адрес. Това може да е поради факта, че адреса е относително нов или е погрешен.");
     else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
       alert();

     else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
       alert("Подаден е празен адрес!");

     else if (gdir.getStatus().code == G_GEO_BAD_KEY)
       alert("Маршрута не може да бъде обработен. Точната причина е неизвестна.");

     else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
       alert("Подаденият ключ е или невалиден или не отговаря на домейна, за който е бил издаден.");

     else alert("Неизвестна грешка.");

  }

  function onGDirectionsLoad(){}       
