var CalendarDateField; // init a date field for popup
var CalendarDateFormat = "dd mmm yyyy";
var CalendarEvent = "";

// ASP, HTM version ---- open the calendar and return the value to Object
function open_calendar(ThisObject)
{
    var urlstring = '../jsdb/wincalendar/calendar.htm';
    do_open_calendar(ThisObject, urlstring);
}

// DLL version ---- open the calendar and return the value to Object
function open_calendar_DLL(ThisObject)
{
    var urlstring = '../../jsdb/wincalendar/calendar.htm';
    do_open_calendar(ThisObject, urlstring);
}

// do open the calendar and return the value to Object
function do_open_calendar(ThisObject, urlstring)
{
    var newWindow;
    var ScreenY = document.body.clientHeight;
    var ScreenX = document.body.clientWidth;

    var posX = (ScreenX) / 2;
    var posY = (ScreenY) / 2;

//    var posX = (window.event.x) + 20;
//    var posY = (window.event.y) + 85;
   
    // defined at the top
    CalendarDateField = ThisObject;
     
     newWindow = window.open(urlstring,'',
               'height=220,width=225,toolbar=no,minimize=no,status=no,memubar=no,location=no,scrollbars=no,top=' + posY + ',left=' + posX);
               
}

// ASP, HTM version ----  open the calendar and return the value to Object and calls the trigger function
function open_calendar_trigger(ThisObject,triggername)
{
    var urlstring = '../jsdb/wincalendar/calendar.htm';
    do_open_calendar_trigger(ThisObject,triggername, urlstring);
}
// DLL version ---- open the calendar and return the value to Object and calls the trigger function
function open_calendar_trigger_DLL(ThisObject,triggername)
{
     var urlstring = '../../jsdb/wincalendar/calendar.htm';
     do_open_calendar_trigger(ThisObject,triggername, urlstring);
               
}

// do open the calendar and return the value to Object and calls the trigger function
function do_open_calendar_trigger(ThisObject,triggername, urlstring)
{
    var newWindow;
    var ScreenY = document.body.clientHeight;
    var ScreenX = document.body.clientWidth;

    var posX = (ScreenX) / 2;
    var posY = (ScreenY) / 2;

//    var posX = (window.event.x) + 20;
//    var posY = (window.event.y) + 85;
   
    // defined at the top
    CalendarDateField = ThisObject;
    CalendarEvent = triggername;
     
    newWindow = window.open(urlstring,'',
               'height=220,width=225,toolbar=no,minimize=no,status=no,memubar=no,location=no,scrollbars=no,top=' + posY + ',left=' + posX);
               
}


