function IsLiveChatServerDown() {
	return false;
}

function IsLiveChatAvailable()
{
   // Convert today to UTC
   var nowUTC = new Date();
   nowUTC.setMinutes(nowUTC.getMinutes() + nowUTC.getTimezoneOffset());

   // Convert today to CST, factoring in DST
   var cst = new Date(nowUTC);
   cst.setMinutes(cst.getMinutes() - (60 * (IsCentralInDST() ? 5 : 6)));
       
   // Chat's available Monday-Friday, between certain hours
   var dayOfWeek = cst.getDay();
   var chatStart = new Date(cst.getFullYear(), cst.getMonth(), cst.getDate(), 7, 30, 0);
   var chatEnd = new Date(cst.getFullYear(), cst.getMonth(), cst.getDate(), 17, 29, 0);

   return (dayOfWeek >= 1 && dayOfWeek <= 5) && (cst >= chatStart && cst <= chatEnd);
}

function GetLiveChatHref() {
	return "https://chat.renlearn.com/chat/chatstart.htm?domain=widgets.renlearn.com";
}

function StartLiveChat() {
	window.open(GetLiveChatHref(), 'new_win', 'width=484,height=361');
}

function IsCentralInDST()
{
   // Convert today to UTC
   var nowUTC = new Date();
   nowUTC.setMinutes(nowUTC.getMinutes() + nowUTC.getTimezoneOffset());

   // 2nd Sunday in March and first Sunday in November mark start/end of Central's DST.
   var march14 = new Date(nowUTC.getFullYear(), 2, 14);
   var november7 = new Date(nowUTC.getFullYear(), 10, 7);
   
   // DST starts in March at 8:00 AM GMT, and ends in November at 7:00 AM GMT
   var dstStart = new Date(nowUTC.getFullYear(), 2, 14 - march14.getDay(), 8, 0, 0);
   var dstEnd = new Date(nowUTC.getFullYear(), 10, 7 - november7.getDay(), 7, 0, 0);

   return (nowUTC >= dstStart && nowUTC <= dstEnd);
}
