    var cal1;
        var cal2;
        var firstTime = false;
        var firstTime2 = false;
        var ab;
        YAHOO.widget.Calendar.prototype.onSelect = function  () {
         setDate1();
        };
        YAHOO.widget.Calendar.prototype.hide = function  () {
            this.oDomContainer.style.display = "none";
        };
        YAHOO.widget.Calendar.prototype.show = function  () {
            this.oDomContainer.style.display = "block";
        };
        YAHOO.widget.Calendar.prototype.customConfig = function() {
        this.Config.Locale.MONTHS_SHORT = ["Led", "Únor", "Bře", "Dub", "Kvě", "Čer", "Čec", "Srp", "Zář", "Říj", "Lis", "Pro"];
        this.Config.Locale.MONTHS_LONG = ["Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"];
        this.Config.Locale.WEEKDAYS_1CHAR = ["N", "P", "U", "S", "C", "P", "S"];
        this.Config.Locale.WEEKDAYS_SHORT = ["Ne", "Po", "Út", "St", "Čt", "Pá", "So"];
        this.Config.Locale.WEEKDAYS_MEDIUM = ["Ned", "Pon", "Úte", "Stř", "Čtv", "Pát", "Sob"];
        this.Config.Locale.WEEKDAYS_LONG = ["Neděle", "Pondělí", "Úterý", "Středa", "Čtvrtek", "Pátek", "Sobota"];         this.Config.Options.START_WEEKDAY = 1;
        }
        function initC(a) {
         if (!firstTime) {                                 
            cal1 = new YAHOO.widget.Calendar("cal1","cal1Container");
            cal1.render();
            firstTime = true;
            }
            else {
              cal1.show();
            }
            ab=a;
            
        }
        function initC2(a) {
         if (!firstTime2) {                                 
            cal2 = new YAHOO.widget.Calendar("cal2","cal2Container");
            cal2.render();
            firstTime2 = true;
            }
            else {
              cal2.show();
            }
             ab=a;

        }
                function setDate1() {
            
            
            if(ab=="od"){
            var date1 = cal1.getSelectedDates()[0];
            document.getElementById("od").value=getRightDate(date1);
            cal1.hide();
            }
				if(ab=="do") {
				var date1 = cal2.getSelectedDates()[0];
            document.getElementById("do").value=getRightDate(date1);
            cal2.hide();
            }
        }
                function getFullYear(d){
                 var y = d.getYear();
                 if(y<1000) y+= 1900;
                 return y;
                }
                function getRightDate(d){
                 var cele_datum;
                 var rok = getFullYear(d);
                 var mesic = d.getMonth();
                 var den = d.getDate();
                 
                 if (mesic<10)
          {
           cele_datum = "" + rok + "-" + "0" + (mesic+1) + "-" + den;
           }
          else
          {
           cele_datum = "" + rok + "-" + (mesic+1) + "-" + den;
           }
                   return cele_datum;
                }
