//
//
//

var highlight_class = 'none';
var mouse_class = 'none';

var hl_tags = new Array();
hl_tags[0] = "hl_sunday";
hl_tags[1] = "hl_monday";
hl_tags[2] = "hl_tuesday";
hl_tags[3] = "hl_wednesday";
hl_tags[4] = "hl_thursday";
hl_tags[5] = "hl_friday";
hl_tags[6] = "hl_saturday";



function initialize_hours(server_time)
{
    initialize_status(server_time);

    day_calculated++;
    change_hours();
    day_calculated--;
}


function change_hours()
{
    calculate_day()

    day_calculated++;
    change_status();
    day_calculated--;

    highlight_class = hl_tags[business_day];

    var hl_element;
 
    hl_element = getElementsByClass("hl.*day");
 
    for (i = 0; i < hl_element.length; i++) {
        hl_element[i].style.backgroundColor = "transparent";
    }
 
    hl_element = getElementsByClass(hl_tags[business_day]);
    for (i = 0; i < hl_element.length; i++) {
        if (business_opened) {
            hl_element[i].style.backgroundColor = "#a0ffa0";
        } else {
            hl_element[i].style.backgroundColor = "#ffa0a0";
        }
    }

    if (mouse_class != 'none') {
        var ids = getElementsByClass(mouse_class);

        for (i = 0; i < ids.length; i++) {
            ids[i].style.backgroundColor = "#A0A0FF";
        }
    }
}

function hours_color(h_class)
{
    var ids = getElementsByClass(h_class);
    mouse_class = h_class;

    for (i = 0; i < ids.length; i++) {
        ids[i].style.backgroundColor = "#A0A0FF";
    }
}

function hours_uncolor(h_class)
{
    var ids = getElementsByClass(h_class);
    mouse_class = 'none';

    for (i = 0; i < ids.length; i++) {
        if (highlight_class == h_class) {
            if (business_opened) {
                ids[i].style.backgroundColor = "#a0ffa0";
            } else {
                ids[i].style.backgroundColor = "#ffa0a0";
            }
        } else {
            ids[i].style.backgroundColor = "transparent";
        }
    }
}
