YAHOO.namespace("example.calendar");
 var navConfig = {
        strings : {
            month: "Choose Month",
            year: "Enter Year",
            submit: "OK",
            cancel: "Cancel",
            invalidYear: "Please enter a valid year"
        },
        monthFormat: YAHOO.widget.Calendar.SHORT,
        initialFocus: "year"
  };
  YAHOO.example.calendar.init = function() { 
  YAHOO.example.calendar.cal1 = new YAHOO.widget.CalendarGroup("cal1","calContainer", { navigator:navConfig, pages:1,title:"Select date:", close:true, mindate:new Date() } );
  YAHOO.example.calendar.cal1.render();
  YAHOO.example.calendar.cal1.selectEvent.subscribe(handleSelect, YAHOO.example.calendar.cal1, true);
  //Listener to show the 1-up Calendar when the button is clicked
  YAHOO.example.calendar.cal1.hide();
 }
 YAHOO.util.Event.onDOMReady(YAHOO.example.calendar.init);
 
 //Handle Selection of Date
 function handleSelect(type,args,obj) {
  var dates = args[0];
  var date = dates[0];
  var year = date[0], month = date[1], day = date[2]; 
  var selectedDates = YAHOO.example.calendar.cal1.getSelectedDates(); 
  var txtDate1 = document.getElementById(document.getElementById('calendarValue').value);
  txtDate1.value = day + "/" +  month + "/" + year;
  YAHOO.example.calendar.cal1.hide();
 }

function SetCurrentCalBox(id)
{  
    YAHOO.example.calendar.cal1.hide();
    document.getElementById("calendarValue").value=id;
    YAHOO.example.calendar.cal1.show();
    document.getElementById('calContainer').style.top = (YAHOO.util.Dom.getXY(id)[1] +18)+'px';
    document.getElementById('calContainer').style.left = '10px';
}