// Livechat.js SPH 20080402 
// dont display live chat icon (even for 'leave message') if nobody is here to
// answer it
var _WORKING_HOURS = {
    // 0: {}, sunday
    1: [900,1730],
    2: [900,1730],
    3: [900,1730],
    4: [900,1730],
    5: [900,1730],
    6: [900,1230]
};
var _LIVE_CHAT_SRC = 'https://web.chat4support.com/Weboperator/Operator/banner.aspx?sid=3478&sTag=BESTOFMOROCCO&style=1&online=1&nFloat=0&nInvite=1&nMode=0&nPos=0';

function in_working_hours () {
    var yes = false;
    var now = new Date();
    //now = new Date(2008,01,01,8,0); //0800 Tue
    var day = now.getDay();
    if (_WORKING_HOURS[day]) {
	var from = _WORKING_HOURS[day][0];	
	var till = _WORKING_HOURS[day][1];
	var tz = now.getTimezoneOffset();
	// guesswork to get time approx same as ours
	var hours = (tz>-61 && tz<1) ? now.getHours() : now.getUTCHours();
	var time = hours * 100 + now.getMinutes();
	if (from <= time && time <= till) {
	    yes = true;
	}
    }
    return yes;
}
//if (in_working_hours()) {
//    var html ='<script src="'+_LIVE_CHAT_SRC+'"><\/script>';
//    document.write(html);
//}


