var IMAGE_FOLDER = "./images/";
var CalendarMonths = new Array ("January","February","March","April","May","June",
                                "July","August","September","October","November","December");
var STAFFING = {
    'infant': [ ['Cang','7am - 3pm'],
                ['Mirjana','8am - 4pm'],
                ['Hasiba','10am - 6pm'],
                ['Marsha','11:30pm - 6pm'] ],
    'toddler': [ ['Trez','7am - 3pm'],
                 ['Melody','8am - 3pm'],
                 ['Acacia','8:15am - 3:15pm'],
                 ['Kailie','11am - 6pm'],
                 ['Roxanne','2pm - 6pm'] ],
    'preschool1': [ ['Rosalind','7am - 3pm'],
                    ['Catherine','8am - 4pm'],
                    ['Melissa','9am - 5pm'],
                    ['Amy','3pm - 6pm'],
                    ['Selim','12pm - 3pm','M,W,Th'] ],
    'preschool2': [ ['Allison','7am - 3pm'],
                    ['Lindsay','8am - 4pm'],
                    ['Michelle','9:30am - 1:30pm'],
                    ['Anna','11am - 6pm'],
                    ['Ebony','2pm - 6pm'],
                    ['Stephanie','3pm - 6pm'] ]
};

function staffingSchedule(which,title)
{
    var s = '<table style="background-color:#eff285; border:solid black 1px;" cellspacing="0" cellpadding="0">';
    s += '<tr style="background-color:#c9cc70;"><td colspan="2" style="padding:2px; text-align:center; border-bottom:solid black 1px;"><strong>Staffing Schedule';
    if (title) {
        s += ' - ' + title;
    }
    s += '</strong></td></tr>';
    for (var i=0; i<STAFFING[which].length; i++) {
        s += '<tr><td style="padding-top:2px; padding-bottom:2px; padding-left:2px; padding-right:10px;">' + STAFFING[which][i][0] + '</td>';
        s += '<td style="padding-top:2px; padding-bottom:2px; padding-right:2px;" align="right">' + STAFFING[which][i][1];
        if (STAFFING[which][i][2]) s += ' (' + STAFFING[which][i][2] + ')';
        s += '</td></tr>';
    }
    s += '</table>';
    return s;
}

// Get a reference to an element of the document based on id
function documentElement(which)
{
    if (document.getElementById) return document.getElementById(which);
    if (document.all) return document.all[which];
    return null;
}

// Display a popup window with the specified photograph
function popup(pname,width,height)
{
    var w = window.open("","_blank","height="+height+",width="+width);
    var d = w.document;
    d.open();
    d.writeln('<div align="center">');
    d.writeln('<img src="' + pname + '" border="0"><br>');
    d.writeln('<em><a href="javascript:self.close();">close window</a></em></div>');
    d.close();
}

// Display classroom photos
function photos(classroom,columns,title)
{
    var i, photo, bigphoto;

    // Output the table and header row
    document.writeln('<table align="center"><tr><td colspan="' + (columns*2-1) + '" align="center" class="subHeader">' + title + '</td></tr>');

    // Output each photo - assume two columns, one for "Parent view" the other for "Child view"
    for (i=0; i<arguments.length-3; i++) {
        photo = "./images/facility/" + classroom + (arguments[i+3]);
        bigphoto = photo + ".jpg";
        photo = photo + "x.jpg";
        if (i % columns == 0) document.writeln('<tr>');
        document.writeln('<td><a href="javascript:popup(\'' + bigphoto + '\',450,350);"><img src="' + photo + '" width="240" height="180" alt="" border="0"></a></td>');
        if (i % 2 != (columns-1)) {
            document.writeln('<td>&nbsp;</td>');
        } else {
            document.writeln('</tr>');
        }
    }
    if ((arguments.length-1) % columns != 0) {
        document.writeln('</tr>');
    }
    document.writeln('<tr><td align="center" colspan="' + (columns*2-1) + '"><em>(Click for a larger version)</em></td></tr></table>');
}
