﻿try { var UserOnlineNo = document.getElementById('UserOnlineNo'); } catch (e) { }

if (CurrentURL.toLowerCase().indexOf("/knowledgebase/getresource.aspx") != -1) {
    GetChatDiscussionStatus();
    if (chat == true || discussion == true)
        document.getElementById('tdBackHelp_Top').style.display = "";
    if (discussion == true)
        document.getElementById('tdBackHelp_Discussion').style.display = "";
    if (chat == true)
        document.getElementById('tdBackHelp_Chat').style.display = "";
}
else {

    document.getElementById('tdBackHelp_Top').style.display = "none";
    document.getElementById('tdBackHelp_Discussion').style.display = "none";
    document.getElementById('tdBackHelp_Chat').style.display = "none";
}

function Event_GoToTop() {
    document.getElementById('divContents').scrollTop = 0;
}
function Event_GoToChat() {
    document.getElementById('divContents').scrollTop = 10000;
    ShowChat();
}
function Event_GoToDiscussion() {
    document.getElementById('divContents').scrollTop = 10000;
    ShowDiscussion();
}
function Event_GoToHelp() {
    Event_GoToURL('http://homebasedemo.asiaonline.net/AboutAsiaOnline/CustomerSupport/AboutAsiaOnline_CustomerSupport_Home.aspx');
}
function Event_GoToHome() {
    Event_GoToURL('http://homebasedemo.asiaonline.net/default.aspx');
}

var chat = false;
var discussion = false;

function GetChatDiscussionStatus() {
    var s = window.location.search.replace("?", "");

    if (s == "") {
        //disable chat & discussion
        return;
    }
    else {
        var arrs = s.split("&");
        for (index = 0; index < arrs.length; index++) {
            var tmp = arrs[index].split("=");
            if (tmp[0].toLowerCase() == "key1")
                key = tmp[1];
            else if (tmp[0].toLowerCase() == "c") {
                if (tmp[1] == "1") {
                    chat = true;

                }
            }
            else if (tmp[0].toLowerCase() == "d") {
                if (tmp[1] == "1") {
                    discussion = true;

                }
            }

        }
        if (key == "") {
            //disable chat & discussion
            return;
        }
    }
}
