/*© 1999 Dancecats.com Incorporated. All rights reserved. */
var defResponseString = "Doesn't matter";
function setupStartDate()
{
    var d;
    d = new Date();
    var frm;
    frm = getFormByName("frmInputDC");
    if (frm != null) 
    {	    
        with (frm) 
        {
            selectItem( startYear, d.getFullYear());
            var Opt =   startMonth.options[d.getMonth()];
            Opt.selected = true;         

            populateDate( startYear, startMonth, startDay);
            Opt =       startDay.options[d.getDate()];        
            Opt.selected = true;         
        }                       
     }
}
function setupToDate()
{
  var d;
  d = new Date();  
  d.setMonth(d.getMonth()+1);

    var frm;
    frm = getFormByName("frmInputDC");
    if (frm != null) 
    {	    
        with (frm) 
        {
            selectItem( stopYear, d.getFullYear());
            var Opt =   stopMonth.options[d.getMonth()];
            Opt.selected = true;         

            populateDate( stopYear, stopMonth, stopDay);
            Opt =       stopDay[d.getDate()];        
            Opt.selected = true;         
	        country.focus();
        }                       
     }
}

function initPage()
{ 
    setupStartDate();
    setupToDate(); 
    InitSelectBoxs();
}

function populateDate(selYear, selMonth, selDate)
{
var yy, mm, i
    with(selYear)
    {        
        yy = options[selectedIndex].value;
    }
    with(selMonth)
    {        
        mm = options[selectedIndex].value;
    }

    mm = mm-1;
    calMonth = new Date(yy, mm, 1);
    calNextMonth = new Date(yy, mm +1, 1);


    calNextMonth.setDate(calNextMonth.getDate()-1);
    nLastDay = calNextMonth.getDate()+1;    

    //calculate and insert the opttions for the date
    with(selDate)    
    {
        for( i = options.length - 1; i > 0; i--) 
            options[i] = null;

        for (i = 0; i < nLastDay -1 ; i++)    
            options[i] = new Option(i+1 , i+1); 

        options[0].selected = true;
    }
}
function setUpDate(frm, bFrom)
{       
    with(frm)
    {
        if (bFrom == 0 )
            populateDate( startYear, startMonth, startDay );
        else    
            populateDate( stopYear, stopMonth, stopDay );        
    }    
}



