var popDelayTimer = 0;
var checkStatusTimer;
var flashTimer;
var firstTime = true;
var dow = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];

function mouseoutfunction(bId) {
clearTimeout(popDelayTimer);
var popObj = $find(bId);
if (popObj && popObj.get_PopupVisible()) popObj.hidePopup();
}

function ShowWithDelay(bId) {
popDelayTimer = setTimeout(function () { showPop(bId); }, 1000);
}

function showPop(bId) {
try {
if (window.event) window.event.cancelBubble = true;
var popObj = $find(bId);
if (popObj) {
if (bId == 'lnpc') {
var tn = $get('ctl00_newsFlash');
if (tn) tn.style.color = '#FFFFFF';
var maxNews = $get('ctl00_maxNews');
var seenNews = $get('ctl00_seenNews');
if (maxNews && seenNews && seenNews.value != maxNews.value) {
seenNews.value = maxNews.value;
CallServer(maxNews.value + "|SetSeenNews", 'Set SeenNews');
}
}
if (!popObj._popupVisible) popObj.showPopup();
}
}
catch (ex) {
}
}

function CancelDelay() {
if (popDelayTimer != 0) clearTimeout(popDelayTimer);
popDelayTimer = 0;
}

function onBodyLoad() {
flashTimer = setInterval('flashNews()', 500);
checkStatusTimer = setInterval(function () { try { CallServer('|StatusCheck', 'Status Check'); } catch (ex) { } }, 60000);
Init_Ticker();
}

function flashNews() {
var tn = $get('ctl00_newsFlash');
if (tn)
if (tn.style.color == '#ffff00')
tn.style.visibility = (tn.style.visibility != "hidden") ? "hidden" : "visible";
else tn.style.visibility = "visible";
try {
if (firstTime && CallServer) {
firstTime = false;
CallServer(getIEVersionNumber() + "|SetIEVersion", 'Set IEVersion');
}
}
catch (ex) {
}
}

function ServerReply(rValue, context) {
if (context === 'Status Check' && rValue != '') {
try {
var parts = rValue.split('|');
if (!isNaN(parts[0])) {
if (parseInt(parts[0]) < 0) window.open('default.aspx', '_self');
else {
var nf = $get('ctl00_newsFlash');
var mn = $get('ctl00_maxNews');
var sn = $get('ctl00_seenNews');
var td = $get("ctl00_TodaysDate");
if (nf && mn && sn && td) {
mn.value = parts[0];
nf.style.color = (parseInt(sn.value) < parseInt(mn.value)) ? '#FFFF00' : '#FFFFFF';
var today = new Date()
var dateStr = dow[today.getDay()] + ", " + today.toLocaleDateString();
if (td.innerText != dateStr) td.innerText = dateStr;
var mqit = (parts[1] == 'False') ? "Recent News" : "Today's News";
if (nf.innerText != mqit) nf.innerText = mqit;
}
}
}
if (parts[2]) Update_Ticker(parts[2]);
}
catch (ex) {
}
}
}

