﻿//////////////////////////////////////////////////////////////////////////////////
//Browser name: BrowserDetect.browser 
//Browser version: BrowserDetect.version 
//OS name: BrowserDetect.OS 

var BrowserDetect = {
    init: function() {
        this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
        this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
        this.OS = this.searchString(this.dataOS) || "an unknown OS";
    },
    searchString: function(data) {
        for (var i = 0; i < data.length; i++) {
            var dataString = data[i].string;
            var dataProp = data[i].prop;
            this.versionSearchString = data[i].versionSearch || data[i].identity;
            if (dataString) {
                if (dataString.indexOf(data[i].subString) != -1)
                    return data[i].identity;
            }
            else if (dataProp)
                return data[i].identity;
        }
    },
    searchVersion: function(dataString) {
        var index = dataString.indexOf(this.versionSearchString);
        if (index == -1) return;
        return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
    },
    dataBrowser: [
		{
		    string: navigator.userAgent,
		    subString: "Chrome",
		    identity: "Chrome"
		},
		{ string: navigator.userAgent,
		    subString: "OmniWeb",
		    versionSearch: "OmniWeb/",
		    identity: "OmniWeb"
		},
		{
		    string: navigator.vendor,
		    subString: "Apple",
		    identity: "Safari"
		},
		{
		    prop: window.opera,
		    identity: "Opera"
		},
		{
		    string: navigator.vendor,
		    subString: "iCab",
		    identity: "iCab"
		},
		{
		    string: navigator.vendor,
		    subString: "KDE",
		    identity: "Konqueror"
		},
		{
		    string: navigator.userAgent,
		    subString: "Firefox",
		    identity: "Firefox"
		},
		{
		    string: navigator.vendor,
		    subString: "Camino",
		    identity: "Camino"
		},
		{		// for newer Netscapes (6+)
		    string: navigator.userAgent,
		    subString: "Netscape",
		    identity: "Netscape"
		},
		{
		    string: navigator.userAgent,
		    subString: "MSIE",
		    identity: "Explorer",
		    versionSearch: "MSIE"
		},
		{
		    string: navigator.userAgent,
		    subString: "Gecko",
		    identity: "Mozilla",
		    versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
		    string: navigator.userAgent,
		    subString: "Mozilla",
		    identity: "Netscape",
		    versionSearch: "Mozilla"
		}
	],
    dataOS: [
		{
		    string: navigator.platform,
		    subString: "Win",
		    identity: "Windows"
		},
		{
		    string: navigator.platform,
		    subString: "Mac",
		    identity: "Mac"
		},
		{
		    string: navigator.platform,
		    subString: "Linux",
		    identity: "Linux"
		}
	]

};
BrowserDetect.init();
var blogTvSupported = true;

if (BrowserDetect.browser == "Safari") {
    blogTvSupported = false;
}

var ff = false;
if (BrowserDetect.browser == "Firefox") {
    ff = true;
}

/////////////////////////////////////////////////////////////////////////////////
// General //
function $g(v){
    if(document.getElementById(v)) 
        return document.getElementById(v);    
    else
        return false;
}
function $n(v){
    if(document.getElementsByName(v))
        return document.getElementsByName(v);
    else
        return false;
}

function isIEbrowser() {
    if (window.ActiveXObject)
        return 1;
    else
        return 0;
}

function setObjXML() 
{
    if (window.XMLHttpRequest) 
    {
        objXML = new XMLHttpRequest();
    }
    else 
    {
        ie = true;
        objXML = new ActiveXObject("Microsoft.XMLHTTP");
    }
}
//=== check if key press was Enter key
function CheckForEnter(e) {
    var key = window.event ? e.keyCode : e.which;
    if (key == 13) {
        document.forms[0].submit();  
    }
}

//=== check if key press is English
function isEnglish(e) {    
    var key = window.event ? e.keyCode : e.which;
    if ((key != 0) && (key > 64) && (key < 123) && (key != 8) && (key != 91) && (key != 92) && (key != 93) && (key != 94) && (key != 96) && (key != 95)) { 
        return true;        
    }
    else {
        return false;
    }
}
function Chars_CheckStr4Tags(e) {
    var key = window.event ? e.keyCode : e.which;
    //Allow :English chars;numbers;space (Ucase & Lcaes)
    if (((key >= 65) && (key <= 90)) || ((key >= 97) && (key <= 122)) || ((key >= 48) && (key <= 57)) || (key == 32) || (key == 8) || (key == 45) || (key >= 1040 && key <= 1103)) {
        return true;
    }
    else {
        return false;
    }
}
function Chars_CheckValidString(Str, FlagText) {
    if (FlagText == 1) {
        AlertText1 = "You are not allowed to put minus after minus in the field: Tags";
        AlertText2 = "Only numbers, letters, spaces and minus&#39; are allowed in the field: Tags";
    }
    else {
        AlertText1 = "You are not allowed to put minus after minus in the field: Personal Tags ";
        AlertText2 = "Only numbers, letters, spaces and minus are allowed in the field: Personal Tags";
    }

    var keychar;
    var CharsFlag = true;
    for (i = 0; i < Str.length; i++) {
        keychar = Str.charCodeAt(i);
        if (((keychar >= 65) && (keychar <= 90)) || ((keychar >= 97) && (keychar <= 122)) || ((keychar >= 48) && (keychar <= 57)) || (keychar == 32) || (keychar == 8) || (keychar == 45) || (keychar >= 1040 && keychar <= 1103)) {
            if ((keychar == 45) && (i > 0)) {
                if (Str.charCodeAt(i - 1) == 45) {
                    blogtvAlert(AlertText1);
                    CharsFlag = false;
                    break;
                }
            }
        }
        else {
            blogtvAlert(AlertText2);
            CharsFlag = false;
            break;
        }
    }
    return CharsFlag;
}               
//=== check if key press was a number
function isNumber(e) {
    var key = window.event ? e.keyCode : e.which;
    var keychar = String.fromCharCode(key);
    strNumbers = new String();
    strNumbers = "1234567890";
    if ((strNumbers.indexOf(keychar) == -1) && (key != 8) && (key != 0))
        return false;
    else
        return true;
}

//=== check if key press is allowed sign
function isSigns(e, CaseNumber, InStr) {
    if (CaseNumber == "" || CaseNumber == null) {
        CaseNumber = 0;
    }
    var key = window.event ? e.keyCode : e.which;
    // event.keyCode (32) ==> " "
    // event.keyCode (45) ==> "-"
    // event.keyCode (95) ==> "_"
    // event.keyCode (64) ==> "@"
    // event.keyCode (46) ==> "."            
    switch (CaseNumber) {
        case 0: //General
            if (key == 0 || key == 59 || key == 32 || key == 95 || key == 46 || key == 64 || key == 45 || ((key > 64) && (key < 123)) && (key != 94) && (key != 91) && (key != 92) && (key != 93)) {
                return true;
            }
            else {
                return false;
            }
            break;
        case 1: //SignIn
            var KeyUnderscoreFlag = true;
            var KeyMinusFlag = true;
            if (key == 95) {
                if (InStr.indexOf("_") > -1) KeyUnderscoreFlag = false;
            }
            if (key == 45) {
                if (InStr.indexOf("-") > -1) KeyMinusFlag = false;
            }

            if (key == 0 || (key == 95 && KeyUnderscoreFlag) || (key == 45 && KeyMinusFlag)) {
                return true;
            }
            else {
                return false;
            }
            break;
        case 2: //free text 
            if ((key == 0) || (key == 32) || (key == 95) || (key == 45)) {
                return true;
            }
            else {
                return false;
            }
            break;
    }
}

function checkStrLen(string, e, MaxBR, MaxLen) {
    myString = new String(string);
    var key = window.event ? e.keyCode : e.which;
    splitstring = string.split(String.fromCharCode(13));
    if (myString.length <= MaxLen || key == 8 || key == 37 || key == 38 || key == 39 || key == 40 || key == 46) {
        if (key == 13) {
            return false;
        }
        return true;
    }
    else {
        return false;
    }
}

function isEnglishAndSigns4Emails(e) {
    var key = window.event ? e.keyCode : e.which;
    // event.keyCode (45) ==> "-"
    // event.keyCode (95) ==> "_"
    // event.keyCode (64) ==> "@"
    // event.keyCode (44) ==> ","
    // event.keyCode (46) ==> "."
    if (key == 59 || key == 95 || key == 46 || key == 64 || key == 45 || key == 44 || ((key > 64) && (key < 123)) && (key != 94) && (key != 91) && (key != 92) && (key != 93)) {
        return true;
    }
    else {
        return false;
    }
}

function isUserNameExtraSigns(e) {
    var key = window.event ? e.keyCode : e.which;
    return (key > 32 && key <= 126);
}

function SetLoginEnabled(objId) {
    $g(objId).disabled = false;
}

function copy_clip(meintext) {
    if (window.clipboardData) {
        // the IE-manier
        window.clipboardData.setData("Text", meintext);
        // waarschijnlijk niet de beste manier om Moz/NS te detecteren;
        // het is mij echter onbekend vanaf welke versie dit precies werkt:
    }
    else if (window.netscape) {
        // dit is belangrijk maar staat nergens duidelijk vermeld:
        // you have to sign the code to enable this, or see notes below 
        netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

        // maak een interface naar het clipboard
        var clip = Components.classes['@mozilla.org/widget/clipboard;1']
                     .createInstance(Components.interfaces.nsIClipboard);
        if (!clip) return;

        // maak een transferable
        var trans = Components.classes['@mozilla.org/widget/transferable;1']
                      .createInstance(Components.interfaces.nsITransferable);
        if (!trans) return;

        // specificeer wat voor soort data we op willen halen; text in dit geval
        trans.addDataFlavor('text/unicode');

        // om de data uit de transferable te halen hebben we 2 nieuwe objecten 
        // nodig om het in op te slaan
        var str = new Object();
        var len = new Object();

        var str = Components.classes["@mozilla.org/supports-string;1"]
                    .createInstance(Components.interfaces.nsISupportsString);

        var copytext = meintext;

        str.data = copytext;

        trans.setTransferData("text/unicode", str, copytext.length * 2);

        var clipid = Components.interfaces.nsIClipboard;

        if (!clip) return false;

        clip.setData(trans, null, clipid.kGlobalClipboard);

    }
    blogtvAlert("Your code was copied to your clipboard\n\n");
    return false;
}

function checkStrLenAnableEnter(string, e, MaxLen) 
{
    myString = new String(string);
    var key = window.event ? e.keyCode : e.which;
    if (myString.length < MaxLen || key == 8 || key == 37 || key == 38 || key == 39 || key == 40 || key == 46) {
        return true;
    }
    else {
        return false;
    }
}

function cutText(obj, str, maxLength) {
    if (ff) {
        if (str.length > maxLength) {
            str = obj.value + str;
            obj.value = str.substring(0, maxLength);
            return false;
        }
        else
            return true;
    }
    else {
        if ((str.length > maxLength) || ((obj.value.length + str.length) > maxLength)) {
            str = obj.value + str;
            obj.value = str.substring(0, maxLength);
            return false;
        }
        else
            return true;
    }
}

var insertFlag = 'false';
function claerMe(obj) {
    if (insertFlag == 'false') {
        obj.value = '';
        insertFlag = 'true';
    }
}

var _LogInLocation = 0;
function Login(backurl) {
    _Backurl = backurl;
    if (_Backurl == 1 || _Backurl == 4 || _Backurl == 6 || _Backurl == 16) {
        LoginName = "divUserName";
        LoginPsw = "divUserPsw";
        LoginRemember = true;
        if (_Backurl == 6) {
            _LogInLocation = 6;
        }
    }
    else if (_Backurl == 7) {
        _LogInLocation = 7;
        LoginName = "UserName";
        LoginPsw = "UserPsw";
        LoginRemember = $g("RememberMe").checked;
    }
    else {
        LoginName = "UserName";
        LoginPsw = "UserPsw";
        LoginRemember = $g("RememberMe").checked;
    }
    LoginName = $g(LoginName).value;
    LoginPsw = $g(LoginPsw).value;

    if (LoginRemember) {
        LoginRemember = 1;
    }
    else {
        LoginRemember = 0;
    }

    if (LoginName == "" || LoginName == "User Name") {
        if (_Backurl == 1 || _Backurl == 4 || _Backurl == 6 || _Backurl == 16)
            $g("divLoginErr").innerHTML = "Please enter a username";
        else
            blogtvAlert("Please enter a username");
        return false;
    }

    if (LoginPsw == "" || LoginName == "Password") {
        if (_Backurl == 1 || _Backurl == 4 || _Backurl == 6 || _Backurl == 16)
            $g("divLoginErr").innerHTML = "Please enter a password";
        else
            blogtvAlert("Please enter a password");
        return false;
    }

    xmlPage = "/Ajax/Users_Login.asp";
    parm = "UserName=" + LoginName + "&UserPsw=" + encodeURIComponent(LoginPsw) + "&RememberMe=" + LoginRemember + "&LogInLocation=" + _LogInLocation + "&BackUrl=" + encodeURI(backurl);

    objLogInXML = CreateObjXML();
    objLogInXML.open("POST", xmlPage, true);
    objLogInXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objLogInXML.onreadystatechange = CheckUserLogin
    objLogInXML.send(parm);
}

function CheckUserLogin() {
    if (objLogInXML && objLogInXML.readyState == 4) {
        if (objLogInXML.responseXML) {
            var UserBlock1 = objLogInXML.responseXML.getElementsByTagName("UserBlock");
            _UserBlock1 = UserBlock1[0].firstChild.data;
            var UserStatus = objLogInXML.responseXML.getElementsByTagName("UserStatus");
            _UserStatus = UserStatus[0].firstChild.data;
            var MyStr = objLogInXML.responseXML.getElementsByTagName("Str");
            _MyNav = MyStr[0].firstChild.data;
            var MyErrStr = objLogInXML.responseXML.getElementsByTagName("ErrStr");
            _MyErrStr = MyErrStr[0].firstChild.data;
            if (_MyErrStr == "False") { _MyErrStr = ""; }
            var UserNameObj = objLogInXML.responseXML.getElementsByTagName("LogInUserName");
            _UserName = UserNameObj[0].firstChild.data;
            var UserIdObj = objLogInXML.responseXML.getElementsByTagName("UserId");
            _UserId = UserIdObj[0].firstChild.data;

            var Activate = objLogInXML.responseXML.getElementsByTagName("Activate");
            _Activate = Activate[0].firstChild.data;

            if (_UserBlock1 == 2) {
                window.open("/Notification.asp?msg=7&BUN=" + _UserName, "_parent");
            }
            else {
                if (_Activate == 0 && _UserStatus == 3) {
                    if (_LogInLocation == 2) {
                        var win = window.open("/Notification.asp", "");
                        win.focus();
                    }
                    else {
                        window.location.href = "/thankYou/";
                    }
                }
                if (_UserStatus != 3) {
                    if (_UserStatus == 0 && _MyErrStr != "") {
                        if (_Backurl == 0 || _Backurl == 7) {
                            insertFlag = 'false';
                            $g("divMyPannel").innerHTML = _MyErrStr;
                            setTimeout("writeMy();", 2500);
                        } else if (_Backurl == 1 || _Backurl == 4 || _Backurl == 6 || _Backurl == 16) {
                            insertFlag = 'false';
                            $g("divLoginErr").innerHTML = _MyErrStr;
                        } else {
                            insertFlag = 'false';
                            $g("MyDiv").innerHTML = _MyErrStr;
                            setTimeout("writeMy();", 2500);
                        }
                    }
                    else {
                        UpdateToolbar();
                        if (_LogInLocation == 3) {
                            window.location.href = PARENT_URL + 'ForumLoginRefreshPage.asp';
                        }
                        else if (_Backurl == 16 || _Backurl == 4) {
                            window.location.reload();
                        }
                        else {
                            //bTV2N.LogAct(_UserName,"",82,""); 
                            if (_Backurl == 1) {
                                //$g("MyDiv").innerHTML = myStr;
                                setCustomAlertInnerHTML(GetDivInnerHTML(0));
                            }
                            else if (_Backurl == 6) {
                                //$g("MyDiv").innerHTML = myStr;

                                var JSShows = objXML.responseXML.getElementsByTagName("JSShows");
                                tmpAr = JSShows[0].firstChild.data.split(",");
                                if (tmpAr[0] != "") {
                                    for (var i = 0; i < tmpAr.length; i++)
                                        myShowsAr[i] = tmpAr[i];
                                } else {
                                    myShowsAr = new Array();
                                }
                                var JSTimeZone = objXML.responseXML.getElementsByTagName("JSTimeZone");
                                jsUserTimeZone = JSTimeZone[0].firstChild.data;
                                CookieUserName = _UserName;

                                if (myShowsAr.length > 0) {
                                    setCustomAlertInnerHTML(GetDivInnerHTML(7));
                                    show_calendar("Schedule_Date", "", "divCal");
                                    goToScheduleStep(0);
                                } else {
                                    setCustomAlertInnerHTML(GetDivInnerHTML(8));
                                    CreateShow(0);
                                }
                            }
                            else if (_Backurl == 0 || _Backurl == 7) {
                                window.location.reload();
                            }
                            else if (_Backurl == 8) {
                                window.location.href = "/";
                            }
                            else {
                                window.location.href = _Backurl;
                            }
                        }
                    }

                }
            }
        }
    }
}

function UpdateToolbar() {
    if ("createEvent" in document) {
        var element = document.createElement("blogtvdata");
        element.setAttribute("updateTB", "1");
        document.documentElement.appendChild(element);
        var ev = document.createEvent("Events");
        ev.initEvent("blogtv_tbEvent", true, false);
        element.dispatchEvent(ev);
    } else {
        try {
            var sh = new ActiveXObject("BlogTV.ScriptHelpers");
            if (sh) {
                sh.RefreshToolbar();
            }
        } catch (err)
        { }
    }

}
///////////////////// Chars Functions ///////////////////////
var reLetter = /^[a-zA-Z]$/;
var reDigit = /^\d/;
var reEmail = /^.+\@.+\..+$/;

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); };

function isLetter(c) {
    return reLetter.test(c);
}

function isEmail(s) {
    if (isEmpty(s))
        if (isEmail.arguments.length == 1) return false;
    else return (isEmail.arguments[1] == true);
    else {
        var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        return reEmail.test(s) && filter.test(s);
    }
}

function isDigit(c) {
    return reDigit.test(c);
}

function isEmpty(s) {
    return ((s == null) || (s.length == 0));
}

function EnterPress(e) {    
    var key = window.event ? e.keyCode : e.which;
    if (key == 13)
        return true;
    else
        return false;
}

var bUserNameKeyPress = "";
function disableEnterKey(e) {
    var key;
    
    if (window.event)
        key = window.event.keyCode; //IE
    else
        key = e.which; //firefox

    if (bUserNameKeyPress == "true") 
    {
        bUserNameKeyPress = "";
        return (key != 13);
    }
    else if (bUserNameKeyPress == "false") {
        bUserNameKeyPress = "";
        return false;
    }
    else {
        return (key != 13);
    }
}

function CheckForEnterDiv(e, divNum) {
    var key = window.event ? e.keyCode : e.which;
    if (key == 13)
        Login(divNum);

}
///////////////////// End Chars Functions ///////////////////////

function removeAllSpaces(string) {
    if (string == "" || typeof string == "undefined")
        return "";
    return string.replace(" ", "");
}

function removeSpaces(string) {
    var temp = "";
    if (string.indexOf(" ") > 0) {
        splitstring = string.split(" ");
        for (var i = 0; i < splitstring.length; i++) {
            if (splitstring[i] != "")
                temp += splitstring[i] + " ";

        }
    }
    else {
        temp = string;
    }
    return temp;
}
function SetSpaces(string, MaxLen) {
    return string;
    var temp = "";
    string = '' + string;
    splitstring = string.split(" ");
    var i;
    for (i = 0; i < splitstring.length; i++) {
        myString = new String(splitstring[i]);
        if (myString.length > MaxLen) {
            while (myString.length >= MaxLen) {
                Fstr = myString.substr(0, MaxLen);
                Lstr = myString.substr(MaxLen, myString.length);
                temp += Fstr + " ";
                myString = new String(Lstr);
            }
            temp += Lstr + " ";
        }
        else {
            if (splitstring[i] != "") {
                temp += splitstring[i] + " ";
            }
        }
        while (temp.indexOf("--") != -1) {
            temp = temp.replace("--", "- -");
        }
    }
    return temp;
}
function CheckMinAge(year, Month, Day, MinAge) {
    now = new Date();
    born = new Date(year, Month * 1 - 1, Day);
    years = Math.floor((now.getTime() - born.getTime()) / (365.25 * 24 * 60 * 60 * 1000));

    if (years < MinAge) {
        return false;
    }
    else {
        return true;
    }
}

function ChangeBackPassHP(obj, Act) {
    if (Act == 2) {
        obj.style.background = '';
        obj.style.backgroundImage = 'url("' + _storageImagesURL + 'bg_text_fild.gif")';
    }
    else {
        if (obj.value == "") {
            obj.style.background = '';
            obj.style.backgroundImage = 'url("' + _storageImagesURL + 'NewAge/n_enter_pass.gif")';
        }
    }
}

function CreateObjXML() {
    if (window.XMLHttpRequest) {
        return (new XMLHttpRequest());
    }
    else {
        ie = true;
        return (new ActiveXObject("Microsoft.XMLHTTP"));
    }
}

var HeasderSearchTermFlag = false;
var FooterSearchTermFlag = false;
function SearchIt() {
    var SearchTermFlag = false;
    var str = $n("SearchStr");    
    var strV = "";
    if (HeasderSearchTermFlag) {
        strV = str[0].value;
        SearchTermFlag = true;
    }
    else if (FooterSearchTermFlag) {
    if (str.length > 1) strV = str[1].value;
        else strV = str[0].value;
        SearchTermFlag = true;
    }

    if ((SearchTermFlag) && strV != "" ) {
        document.location.href = "/SearchResults.aspx?SearchStr=" + strV;
    }
    else {
        SiteAlert("Please enter keywords to search field");
    }
}

function ChangeLangDmain(lang, iAct) {
    url = "/Ajax/Language_ChangeLanguage.asp";
    str = "Lang=" + lang + "&iAct=" + iAct;
    objLangXML = CreateObjXML();
    objLangXML.open("POST", url, true);
    objLangXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objLangXML.onreadystatechange = batchChangeLang;
    objLangXML.send(str);
}

function batchChangeLang() {
    if (objLangXML && objLangXML.readyState == 4) {
        if (objLangXML.responseXML) {
            var Str = objLangXML.responseXML.getElementsByTagName("Str");
            Str = Str[0].firstChild.data;
            var BackUrl = objLangXML.responseXML.getElementsByTagName("BackUrl");
            BackUrl = BackUrl[0].firstChild.data;
            if (Str == "True") window.location.href = BackUrl;
        }
    }
}


function changeRegion(CountryId) {
    xmlPage = "/Ajax/SignIn_GetRegion.asp?CountryId=" + CountryId;
    RegionObjXml = CreateObjXML();
    RegionObjXml.open("GET", xmlPage, true);
    RegionObjXml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    RegionObjXml.onreadystatechange = batchRegionChange;
    RegionObjXml.send(null);
}

function batchRegionChange() {
    if (RegionObjXml && RegionObjXml.readyState == 4) {
        if (RegionObjXml.responseXML) {
            var RegionObj = RegionObjXml.responseXML.getElementsByTagName("Region");

            $g("Region").options.length = 0;
            $g("Region").options[0] = new Option("--------", 0);

            if (RegionObj.length > 0) {

                for (R = 0; R < RegionObj.length; R++) {
                    RegId = RegionObj[R].attributes.getNamedItem("Id").value;
                    RegName = RegionObj[R].attributes.getNamedItem("Name").value;
                    $g("Region").options[R + 1] = new Option(RegName, RegId);
                }
                HadRegionValue = 1;
                $g("Region").disabled = false;
            }
            else {
                HadRegionValue = 0;
                $g("Region").disabled = true;
            }
            if ($g("HadRegion")) {
                $g("HadRegion").value = HadRegionValue;
            }
        }
    }
}

//////////////////////////////// My Subscription ///////////////////////////////////////////////
function My_GetUserSubscriptions(p) {
    var SearchTerm = "";
    if ($g("mysubSearch")) {
        SearchTerm = $g("mysubSearch").value;
    }
    url = "/Ajax/My_GetUserSubscriptions.asp";
    str = "P=" + p + "&S=" + SearchTerm;
    objUserSubXML = CreateObjXML();
    objUserSubXML.open("POST", url, true);
    objUserSubXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objUserSubXML.onreadystatechange = batchMy_GetUserSubscriptions;
    objUserSubXML.send(str);
}
function batchMy_GetUserSubscriptions() {
    if (objUserSubXML && objUserSubXML.readyState == 4) {
        if (objUserSubXML.responseXML) {
            var Str = objUserSubXML.responseXML.getElementsByTagName("Str");
            aInnerHtml = Str[0].firstChild.data;
            awidth = 752
            aheight = 470
            writeCustomAlert("Your Subscriptions", aInnerHtml, awidth, aheight, "", "");
        }
    }
}

function Alerts_SetUserAlerts(ShowId, Obj) {
    var BR = 0;
    var SR = 0;
    var RV = 0;
    var ByM = 0;
    var ByE = 0;
    var ByT = 0;
    var ByA = 0;
    var iAction = 0;
    if (ShowId != 0) {
        var StartRemind = $g("StartRemind_" + ShowId);
        var RemindBef = $g("RemindBef_" + ShowId);
        var RemindVod = $g("RemindVod_" + ShowId);

        var ByMobile = $g("ByMobile_" + ShowId);
        var ByEmail = $g("ByEmail_" + ShowId);
    }
    else {
        var StartRemind = $g("StartRemind");
        var RemindBef = $g("RemindBef");
        var RemindVod = $g("RemindVod");

        var ByMobile = $g("ByMobile");
        var ByEmail = $g("ByEmail");
    }

    if (Obj == 1) {
        SR = 1;
        ByE = 1;
        if (StartRemind.checked) {
            iAction = 1;
            ByEmail.checked = true;
        }
        else {
            ByM = 1;
            ByMobile.checked = false;
            if ((!RemindVod.checked) && (!RemindBef.checked)) ByEmail.checked = false;
        }
    }
    else if (Obj == 2) {
        BR = 1;
        ByE = 1;
        if (RemindBef.checked) {
            iAction = 1;
            ByEmail.checked = true;
        }
        else {
            if ((!RemindVod.checked) && (!StartRemind.checked)) ByEmail.checked = false;
        }
    }
    else if (Obj == 3) {
        RV = 1;
        ByE = 1;
        if (RemindVod.checked) {
            iAction = 1;
            ByEmail.checked = true;
        }
        else {
            if ((!RemindBef.checked) && (!StartRemind.checked)) ByEmail.checked = false;
        }
    }
    else if (Obj == 4) {
        ByM = 1;
        SR = 1;
        if (ByMobile.checked) {
            iAction = 1;
            StartRemind.checked = true;
        }
        else {
            if (!ByEmail.checked) StartRemind.checked = false;
        }
    }
    else if (Obj == 5) {
        ByE = 1;
        SR = 1;
        RV = 1;
        if (ByEmail.checked) {
            iAction = 1;
            StartRemind.checked = true;
            RemindVod.checked = true;
        }
        else {
            BR = 1;
            if (!ByMobile.checked) StartRemind.checked = false;
            RemindVod.checked = false;
            RemindBef.checked = false;
        }
    }
    if (ShowId == 0) return;

    url = "/Ajax/My_SetUserSubscribe.asp";
    str = "ShowId=" + ShowId + "&SR=" + SR + "&BR=" + BR + "&RV=" + RV + "&ByM=" + ByM + "&ByE=" + ByE + "&ByT=" + ByT + "&ByA=" + ByA + "&action=" + iAction;
    objUserSubXML = CreateObjXML();
    objUserSubXML.open("POST", url, true);
    objUserSubXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objUserSubXML.onreadystatechange = batchMy_SetUserSubscriptions;
    objUserSubXML.send(str);
}

function batchMy_SetUserSubscriptions() {
    if (objUserSubXML && objUserSubXML.readyState == 4) {
        if (objUserSubXML.responseXML) {
            var ShowId = objUserSubXML.responseXML.getElementsByTagName("ShowId");
            ShowId = ShowId[0].firstChild.data;
            var Action = objUserSubXML.responseXML.getElementsByTagName("Action")
            Action = Action[0].firstChild.data;
            var ByMobile = objUserSubXML.responseXML.getElementsByTagName("ByMobile")
            ByMobile = ByMobile[0].firstChild.data;
            var MobileActive = objUserSubXML.responseXML.getElementsByTagName("MobileActive")
            MobileActive = MobileActive[0].firstChild.data;
            if (ByMobile == "1" && Action == "1" && MobileActive == "0")
                getSmsUserDetailsDiv()

        }
    }
}

function getSmsUserDetailsDiv() {
    url = "/Ajax/SMS_UserDetailsDiv.asp";
    str = "null";
    objSMSXML = CreateObjXML();
    objSMSXML.open("POST", url, true);
    objSMSXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objSMSXML.onreadystatechange = batchSMSUserDetailsDiv;
    objSMSXML.send(str);
}

function batchSMSUserDetailsDiv() {
    if (objSMSXML && objSMSXML.readyState == 4) {
        if (objSMSXML.responseXML) {
            var SMSUserDiv = objSMSXML.responseXML.getElementsByTagName("Str");
            aInnerHtml = SMSUserDiv[0].firstChild.data;
            writeCustomAlert("Your SMS alerts Settings", aInnerHtml, "752", "320", "", "")
        }
    }
}

function My_SetUserUnSubscribe(ShowId, P) {
    url = "/Ajax/My_SetUserUnSubscribe.asp";
    str = "ShowId=" + ShowId + "&P=" + P;
    objUserSubXML = CreateObjXML();
    objUserSubXML.open("POST", url, true);
    objUserSubXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objUserSubXML.onreadystatechange = batchMy_SetUserUnSubscribe;
    objUserSubXML.send(str);
}

function batchMy_SetUserUnSubscribe() {
    if (objUserSubXML && objUserSubXML.readyState == 4) {
        if (objUserSubXML.responseXML) {
            var Page = objUserSubXML.responseXML.getElementsByTagName("Page");
            Page = Page[0].firstChild.data;
            My_GetUserSubscriptions(Page);
        }
    }
}

function SetMobileDetails() {
    var CountryId = 256;
    //$g("Mobile_Country").value;
    var NetworkPrefix = $g("MobileNetworkPrefix").value;
    if (NetworkPrefix == "") {
        alert("You must enter a valid cell phone number ")
        $g("MobileNetworkPrefix").focus();
        return;
    }
    var PhoneNumber = $g("MobilePhoneNumber").value;
    if (PhoneNumber == "") {
        alert("You must enter a valid cell phone number ")
        $g("MobilePhoneNumber").focus();
        return;
    }
    var SmsAmount = $g("MaxWeeklySmsAmount").value;

    var Day_1 = 0;
    var Day_2 = 0;
    var Day_3 = 0;
    var Day_4 = 0;
    var Day_5 = 0;
    var Day_6 = 0;
    var Day_7 = 0;
    var FromHour = $g("FromHour").value;
    var ToHour = $g("ToHour").value;

    if (parseInt(FromHour) >= parseInt(ToHour)) {
        alert("Oops! Please choose a start time that is earlier than your finish time.");
        $g("FromHour").focus();
        return;
    }
    if ($g("Day_1").checked) Day_1 = 1;
    if ($g("Day_2").checked) Day_2 = 1;
    if ($g("Day_3").checked) Day_3 = 1;
    if ($g("Day_4").checked) Day_4 = 1;
    if ($g("Day_5").checked) Day_5 = 1;
    if ($g("Day_6").checked) Day_6 = 1;
    if ($g("Day_7").checked) Day_7 = 1;
    NoDays = true;
    for (d = 1; d <= 7; d++) {
        if (eval("Day_" + d) == 1) {
            NoDays = false;
            break;
        }
    }
    if (NoDays) {
        alert("You must choose at least 1 day to receive SMS messages");
        return;
    }
    url = "/Ajax/SMS_SetUserDetails.asp";
    str = "CountryId=" + CountryId + "&NetworkPrefix=" + NetworkPrefix + "&PhoneNumber=" + PhoneNumber + "&SmsAmount=" + SmsAmount + "&Sun=" + Day_1 + "&Mon=" + Day_2 + "&Tue=" + Day_3 + "&Wed=" + Day_4 + "&Thu=" + Day_5 + "&Fri=" + Day_6 + "&Sat=" + Day_7 + "&FromHour=" + FromHour + "&ToHour=" + ToHour;
    objSMSXML = CreateObjXML();
    objSMSXML.open("POST", url, true);
    objSMSXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objSMSXML.onreadystatechange = batchSmsUserDetails;
    objSMSXML.send(str);

}

function batchSmsUserDetails() {
    if (objSMSXML && objSMSXML.readyState == 4) {
        if (objSMSXML.responseXML) {
            var ErrCode = objSMSXML.responseXML.getElementsByTagName("ErrCode");
            ErrCode = ErrCode[0].firstChild.data;
            if (ErrCode == 2) {
                aInnerHtml = '' +
                '<div class="posRel">' +
                    '<div class="posAbs FB" style="top:10px;left:10px;">' +
                        'We have just sent you a sms message with a code, please enter the code below:' +
                    '</div>' +
                    '<div class="posAbs" style="top:45px;left:10px;">' +
                        'Confirmation code: ' +
                        '<input type="text" name="SMS_ActiveKey" id="SMS_ActiveKey" style="width:100px;" maxlength="10" />' +
                    '</div>' +
                    '<!--div class="posAbs" style="top:90px;left:10px;">' +
                        '<a onclick=alert("ask Daniel") class="UnLine" title="I did not get the message! Why?">I did not get the message! Why?</a>' +
                    '</div-->' +
                    '<div class="posAbs" style="top:140px;left:300px;">' +
                        writeGreenButtonJS(120, "Confirm", "Sms_ConfirmKey();") +
                    '</div>' +
                    '<div class="posAbs" style="top:140px;left:500px;">' +
                        writeGreenButtonJS(120, "Close", "removeCustomAlert();") +
                    '</div>' +
                '</div>';
            
                awidth = 752
                aheight = 250
                writeCustomAlert("Your SMS alerts Settings", aInnerHtml, awidth, aheight, "", "");
            }
            else {
                if (_MobileSubscribe == 0) {
                    DivTitle = "Your SMS alerts Settings"
                    DivContent = "<center><div class='posRel FB' style='top:10px;height:20px;'>Thank you for updating your SMS details!</div></center>";
                    writeGeneralDiv(DivTitle, DivContent, "752", "360", 4000)

                }
                else {
                    aInnerHtml = '<center><div class="posRel FB" style="top:10px;height:20px;">You are now subscribed to SubscribeUserName Show</div></center>';
                    awidth = 752
                    aheight = 350
                    writeCustomAlert("Your SMS alerts Settings", aInnerHtml, awidth, aheight, "", "");
                }
            }
        }
    }
}

function Sms_ConfirmKey() {
    ActiveKey = $g("SMS_ActiveKey").value;
    if (ActiveKey == "") {
        alert("The confirmation code you have entered is invalid ")
        $g("SMS_ActiveKey").focus();
        return;
    }

    url = "/Ajax/SMS_Active.asp";
    str = "ActiveKey=" + ActiveKey;
    objSMSXML = CreateObjXML();
    objSMSXML.open("POST", url, true);
    objSMSXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objSMSXML.onreadystatechange = batchSms_ConfirmKey;
    objSMSXML.send(str);
}
function batchSms_ConfirmKey() {
    if (objSMSXML && objSMSXML.readyState == 4) {
        if (objSMSXML.responseXML) {
            var ErrCode = objSMSXML.responseXML.getElementsByTagName("ErrCode");
            ErrCode = ErrCode[0].firstChild.data;
            if (ErrCode == 1) {
                writeTnxSMSDiv();
            }
            else {
                alert("The confirmation code you have entered is invalid ")
                $g("SMS_ActiveKey").value = "";
                $g("SMS_ActiveKey").focus();
                return;
            }
        }
    }
}

function writeTnxSMSDiv() {
    DivTitle = "Your SMS alerts Settings"
    aInnerHtml = '' +
            '<center><div class="posRel FB" style="top:10px;height:20px;">Thank you for activating your SMS account</div></center>';
    writeCustomAlert(DivTitle, aInnerHtml, "752", "360", "", "");
    setTimeout("removeCustomAlert();", 4000);
}

function writeGreenButtonJS(width, text, jsText) {
    Str = "" +
"<div class='GreenMidBtn' style='width:" + width + "px;' Title='" + text + "' onclick='" + jsText + "'>" +
     "<div class='GreenRightBlackBtn' style='position:absolute;left:" + (width - 3) + "px;'></div>" +
     "<div class='FB F12 LH13 CursorP C_W posAbs TxtC CCase' style='width:" + (width - 6) + "px;left:3px; top:5px;' >" +
        text +
    "</div>" +
    "<div class='GreenLeftBlackBtn posAbs' style='left:-1px'></div>" +
"</div>";
    return (Str);
}
//////////////////////////////// End My Subscription ///////////////////////////////////////////////

var customAlertClose;
function writeCustomAlert(divTitle, aInnerHtml, aWidth, aHeight, aBorderColor, aBgColor) {
    //clears the page refresh
    if (_setPageRefresh == true)
        clearInterval(_winInterval);
    // shortcut reference to the document object
    d = document;
    // if resize div keep the _onDivCloseRefresh into temp var
    var _temponDivCloseRefresh = _onDivCloseRefresh;
    _onDivCloseRefresh = false;
    // if the modalContainer object already exists in the DOM, bail out.
    //if(d.getElementById("modalContainer")) return;
    if (d.getElementById("modalContainer")) removeCustomAlert();
    _onDivCloseRefresh = _temponDivCloseRefresh;
    // create the modalContainer div as a child of the BODY element
    fObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
    fObj.id = "modalContainerOpacity";
    // make sure its as tall as it needs to be to overlay all the content on the page
    //fObj.style.height = document.documentElement.scrollHeight + "px";
    fObj.style.height = d.body.scrollHeight + "px";

    // create the modalContainer div as a child of the BODY element
    mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
    mObj.id = "modalContainer";
    // make sure its as tall as it needs to be to overlay all the content on the page
    //mObj.style.height = document.documentElement.scrollHeight + "px";
    mObj.style.height = d.body.scrollHeight + "px";

    // create the DIV that will be the alert 
    alertObj = mObj.appendChild(d.createElement("div"));
    alertObj.id = "alertBox";
    // MSIE doesnt treat position:fixed correctly, so this compenDay_7es for positioning the alert
    //if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px";
    if (_AIMPlayer == 1) {
        if (d.all && !window.opera) alertObj.style.top = (d.body.scrollTop - 40) + "px";
    }
    else {
        if (d.all && !window.opera) alertObj.style.top = d.body.scrollTop + "px";
    }
    // center the alert box
    aWidth = (aWidth == "") ? 605: aWidth;
    aHeight = (aHeight == "") ? 405 : aHeight;

    if (BrowserDetect.browser == "Chrome") {
        alertObj.style.top = (((document.body.scrollTop + document.documentElement.clientHeight / 2) - (aHeight / 2)) - 45) + "px";
    }
    else {
        //alertObj.style.top = document.body.scrollTop + "px";
        //alertObj.style.top = (((document.body.scrollTop + document.documentElement.clientHeight / 2) - (aHeight / 2)) - 45) + "px";
        alertObj.style.top = (((document.documentElement.scrollTop + document.documentElement.clientHeight / 2) - (aHeight / 2)) - 45) + "px";
    }
    //else 
    //{
    //    alertObj.style.top = (((document.documentElement.clientHeight - (aHeight)) / 2) - 45) + "px";       
    //}
    
    alertObj.style.left = (d.body.scrollWidth - aWidth) / 2 + "px";
    var Sel = d.getElementsByTagName("select");
    for (i = 0; i < Sel.length; i++) {
        Sel[i].disabled = true;
    }
    BasicAlertStr =
    '<iframe id="iframeBox" style="position:absolute;display:none;" frameborder=0 scrolling=no marginwidth=0 src="" marginheight=0></iframe>' +
    '<div id="divAlertBorder" style="position:absolute;display:none;">' +
        '<div id="divAlertBox">' +
            '<div id="divAlertTitleBg" class="BGGR">' +
                '<div id="divAlertTitle" class="C_W FB F14 UCase BGGR" style="height:17px;"></div>' +
                '<div id="divAlertTitleClose"  class="BGGR CCase" onclick="clearTimeout(customAlertClose);removeCustomAlert();" style="height:17px;" title="Close">Close</div>' +
                '<div id="divAlertTitleCloseImg" class="xIcon" onclick="clearTimeout(customAlertClose);removeCustomAlert();" title="Close"></div>' +
            '</div>' +
            '<div id="divAlertContent">' +
                '<div id="DivBorderContent">' +
                    '<div id="DivBGContent">' +
                        '<div id="InnerContent"></div>' +
                    '</div>' +
                '</div>' +
            '</div>' +
        '</div>' +
    '</div>';

    $g("alertBox").innerHTML = BasicAlertStr;
    
    var objBorder = $g("divAlertBorder");
    var objBox = $g("divAlertBox");
    var objTitleBg = $g("divAlertTitleBg");
    var objTitle = $g("divAlertTitle");
    var objContent = $g("divAlertContent");
    var objIframe = $g("iframeBox");
    var objBorderContent = $g("DivBorderContent");
    var objDivBGContent = $g("DivBGContent");
    var objInnerContent = $g("InnerContent");

    if (objBorder) {
        with (objBorder.style) {
            display = "block";
            width = (aWidth == "") ? 605: aWidth;
            height = (aHeight == "") ? 405: aHeight;
            backgroundColor = (aBorderColor == "") ? "#515151" : aBorderColor;
        }
    }
    if (objBox) {
        with (objBox.style) {
            width = (aWidth - 2) + "px";
            height = (aHeight - 2) + "px";
            left = "1px";
            top = "1px";
            backgroundColor = (aBgColor == "") ? "#EDEDED" : aBgColor;
        }
    }

    if (objIframe) {
        with (objIframe.style) {
            width = aWidth + "px";
            height = aHeight + "px";
            display = "block";
            backgroundColor = "Black";
        }
    }
    if (objTitleBg) {
        objTitleBg.style.width = aWidth - 12 + "px";
        //if(!_ShowInnerDiv){
        //objTitleBg.style.display = "none";  
        with (objContent.style) {
            top = "30px";
            left = "5px";
            width = (aWidth - 12) + "px";
            height = (aHeight - 38) + "px";
        }
        //objContent.style.border = "solid 1px #FF0000";
        //}   
    }
    if (objBorderContent) {
        with (objBorderContent.style) {
            top = "31px";
            left = "6px";
            width = (aWidth - 13) + "px";
            height = (aHeight - 38) + "px";
            backgroundColor = "#D7D7D7";
        }
    }
    if (objDivBGContent) {
        with (objDivBGContent.style) {
            position = "relative";
            top = "1px";
            left = "1px";
            width = (aWidth - 15) + "px";
            height = (aHeight - 40) + "px";
            backgroundColor = "#FFFFFF";
        }
    }
    if (objInnerContent) {
        with (objInnerContent.style) {
            position = "relative";
            left = "8px";
            top = "3px";
            width = (aWidth - 30) + "px";
            height = (aHeight - 50) + "px";
            //backgroundColor = "#FF0000";
        }
    }
    if (objTitle) {
        objTitle.innerHTML = divTitle;
    }
    if (objInnerContent) {
        objInnerContent.innerHTML = aInnerHtml;
    }
    _ShowInnerDiv = true;
}

// removes the custom alert from the DOM;
function removeCustomAlert() 
{
    _onDivCloseRefresh = false;
    // Close color Picker  
    color_picker_div = false;
    if (($g("modalContainer") != null) && ($g("modalContainer")))
    {
        document.getElementsByTagName("body")[0].removeChild($g("modalContainer"));
    }
    if (($g("modalContainerOpacity") != null) && ($g("modalContainerOpacity")))
    {
        document.getElementsByTagName("body")[0].removeChild($g("modalContainerOpacity"));
    }

    var Sel = document.getElementsByTagName("select");
    for (i = 0; i < Sel.length; i++) 
    {
        Sel[i].disabled = false;
    }
    // set the page refresh

    if (_setPageRefresh==true) {
        _winInterval = setInterval('location.reload(true)', 300000);
    }
    else {
        clearInterval(_winInterval);
    }
    if (_onDivCloseRefresh == true) {
        location.reload(true);
    }
    else {
        clearInterval(_onDivCloseRefresh);
    }
}

function SiteAlert(txt) {
    aInnerHtml = "<div class='siteAlert'>"
                   + "<img src='" + _storageImagesURL + "logInDiv!.jpg' title='' alt=''/>"
                   + "<span>" + txt + "</span>"
                   + "<div class='innersiteAlert'>"
                        + writeGreenButtonJS(120, "Close", "removeCustomAlert();")
                   + "</div>";
                 + "</div>";
    writeCustomAlert("blogTV Alert", aInnerHtml, "450", "200", "", "");
}

var _StartDiv = 0;
function setSignIn() {
    _ShowInnerDiv = false;
    _onDivCloseRefresh = false;
    _StartDiv = 6;
    xmlPage = '/Ajax/SignIn_Div.asp';
    param = 'BackId=' + _StartDiv;
    objRegXml = CreateObjXML();
    objRegXml.open('POST', xmlPage, true);
    objRegXml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objRegXml.onreadystatechange = batchJoinUsDiv;
    objRegXml.send(param);
}

function batchJoinUsDiv() {    
    if (objRegXml && objRegXml.readyState == 4) {
        if (objRegXml.responseXML) {
            var Str = objRegXml.responseXML.getElementsByTagName("Str");
            Str = Str[0].firstChild.data;
            var DivType = objRegXml.responseXML.getElementsByTagName("type");
            var _DivType = DivType[0].firstChild.data;  
            var divH = "490";
            if (_DivType == 2) { divH = "600"; }
            DivTitle = "join us";
            aInnerHtml = Str;
            writeCustomAlert(DivTitle, aInnerHtml, "760", divH, "", "");
            var head = document.getElementsByTagName("head")[0];
            if (_DivType == 2) {                
                script = document.createElement('script');
                script.id = 'solvemediaScript';
                script.type = 'text/javascript';
                script.src = "http://api.solvemedia.com/papi/challenge.ajax";
                head.appendChild(script);
                setTimeout("joinUsSolveMediaKaptcha();", 2000);
            } 
            if (self.regScript) { // Already exists
                return;
            }
            script = document.createElement('script');
            script.id = 'regScript';
            script.type = 'text/javascript';
            script.src = _iisServerUrl + "include/signin.js";
            head.appendChild(script);
            script = document.createElement('script');
            script.id = 'PassStrength';
            script.type = 'text/javascript';
            script.src = _iisServerUrl + "include/PassStrength.js";
            head.appendChild(script);            
        }
    }
}

function joinUsSolveMediaKaptcha() {
    var ACPuzzleOptions = { theme: 'custom', size: '300x150', lang: 'en' };
    ACPuzzle.create(_SIGNIN_CAPTCHA_CKEY, 'adcopy-pixel-image', ACPuzzleOptions);
}
//////////////////////  Err Div  //////////////////////////
var _LAST_ERR_DIV = "";
var _LAST_ERR_BOREDE_COLOR = "";
function SetDivErr(str, DivName, BC, ClassN) {
    if (ClassN == "") {
        ClassN = "ErrMsg";
    }
    if (BC == "") {
        BC = "red";
    }
    _LAST_ERR_DIV = DivName;
    DivErrContentObj = $g(DivName + "_Err");
    DivErrObj = $g(DivName);
    if (DivErrObj) {
        _LAST_ERR_BOREDE_COLOR = DivErrObj.style.borderColor;
        if (DivErrContentObj) {
            DivErrContentObj.innerHTML = "<font class='" + ClassN + "'>" + str + "</font>";
        }
        if (DivErrObj) {
            if (DivErrObj.tagName == "INPUT") {
                DivErrObj.style.borderColor = BC;
            }
            else {
                DivErrObj.style.border = "solid 1px " + BC;
            }
        }
    }
}

function RemoveDivErr(BC) {
    if (_LAST_ERR_DIV != "") {
        if (_LAST_ERR_BOREDE_COLOR != "") {
            BC = _LAST_ERR_BOREDE_COLOR;
            _LAST_ERR_BOREDE_COLOR = "";
        }
        if (BC == "") {
            BC = "#848484";
        }
        DivErrContentObj = $g(_LAST_ERR_DIV + "_Err");
        DivErrObj = $g(_LAST_ERR_DIV);
        if (DivErrContentObj) {
            DivErrContentObj.innerHTML = "";
        }
        if (DivErrObj) {
            if (DivErrObj.tagName == "INPUT" || BC != "") {
                DivErrObj.style.borderColor = BC;
            }
            else {
                DivErrObj.style.border = "";
            }
        }
    }
}
//////////////////////  Err Div  //////////////////////////

// General //

// Home Page //
function thisMovie(movieName) {
    try {
        var isIE = navigator.appName.indexOf("Microsoft") != -1;
        return (isIE) ? window[movieName] : document[movieName];
    }
    catch (e) {
        return false;
    }
}
function writeHPPlayer() {
    var so = new SWFObject(_flashURL + _hpPlayerName, "BlogTvPanel", "506", "422", "9", "");
        so.addParam("wmode", "transparent");
        so.addParam("allowScriptAccess", "always");
        so.addVariable("iniLocation", _flashXML);
        so.addVariable("liveEnc", _liveEnc);
        so.addVariable("noShowTxt", _noShowTxt);
        so.addVariable("fme", "1");
        so.addVariable("db", _setDebug);
        so.write("divFlashTV");
}

//spotLight Banners

var currentBanner=0;
var _setInterval;
var _bbslide
var bigBannerWidth=539;
//var bigBannerWidth = 239;
function spotLightBannerSlider(dir) {
    
    if(_setInterval) return;
    clearInterval(_bbslide);    
    objBB = $n("imgBigBanner")[0];
    objTBB = $n("imgTempBigBanner")[0];
    
    if (objTBB) {
        objBB.style.left = 0 + "px";
        if (dir == 1) {
            currentBanner++;
            if (currentBanner >= arBigBanners.length)
                currentBanner = 0;
        } else {
            currentBanner--;
            if (currentBanner < 0)
                currentBanner = arBigBanners.length - 1;
        }

        objTBB.style.left = dir * bigBannerWidth + "px";
        objTBB.src = arBigBanners[currentBanner];
        
        _setInterval = setInterval('mov(objBB,objTBB,' + parseInt(-dir) + ')', 10);
        var objA = $n("aBigBanner")[0];
        if (arBigBannersHref[currentBanner] != "")
            objA.style.cursor = "pointer";
        else
            objA.style.cursor = "default";
        objA.setAttribute("href",arBigBannersHref[currentBanner]);
    }
}

var w=0;n=20;
function mov(objO,objT,dir){			
    if(w<bigBannerWidth){
        if (w > bigBannerWidth - 30) 
            n = 2
	    w+=n;
	    objO.style.left = parseInt(objO.style.left) + (dir*n) + "px";
	    objT.style.left = parseInt(objT.style.left) + (dir*n) + "px";
	}else{
	    w = 0; n = 20;	    
	    objT.style.left = 0 + "px";    
		clearInterval(_setInterval);
		_bbslide=setInterval('spotLightBannerSlider(1);',10000);
		_setInterval = null;
		objO.src = objT.src;
		objO.style.left = 0 + "px";			
    }
}

function OpenChatR(ProgramId) 
{
    if (secureid == 0) 
    {
        SiteAlert("In order to broadcast please sign into your account or <a onclick='setSignIn();'>click here</a> to <a onclick='setSignIn();'>sign up</a> for a new account.");
    }
    else 
    {
        window.location = _iisUrl + "people/" + CookieUserName;
        
    }
}

_bbslide = setInterval('spotLightBannerSlider(1);', 10000);

// initialise plugins
jQuery(function() {
    if (eval(_setPageRefresh)) _winInterval = setInterval('location.reload(true)', 300000);
    jQuery('ul.sf-menu').superfish();
});


////////////////  My Check Msgs ////////////////////////

function GlobalCheckNewMsgs() {
    xmlPage = "/Ajax/My_GetMy.asp";
    objMsgXml = CreateObjXML();
    objMsgXml.open("POST", xmlPage, true);
    objMsgXml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objMsgXml.onreadystatechange = MyCheckUserMsgs;
    objMsgXml.send("");
}

function MyCheckUserMsgs() {
    if (objMsgXml && objMsgXml.readyState == 4) {
        if (objMsgXml.responseXML) {
            var TotalMsgs = objMsgXml.responseXML.getElementsByTagName("TotalMsgs");
            _TotalMsgs = TotalMsgs[0].firstChild.data;
            if ($n("MyMsgCount")) {
                var MyMsgCount;
                if (_TotalMsgs > 0) {
                    $n("MsgImg_envelope")[0].src = _storageImagesURL + "newage/inbox_blink.gif";                    
                    MyMsgCount = _TotalMsgs;
                } else {
                $n("MsgImg_envelope")[0].src = _storageImagesURL + "newage/inbox.png";
                    MyMsgCount = "0";
                }
                $n("MyMsgCount")[0].innerHTML = MyMsgCount;
            }
        }
    }
}

//////////////// My Check Msgs ////////////////////////

//////////////// Players Functions ///////////////////////
var HPPlayerFlag = false;
var _count = 0;

function onFlashInit(appName) {    
    switch (appName)
    {
        case "hpPlayer":            
            HPPlayerFlag = true;
            break;             
    }
}

function iab_rma_start() {
    if (HPPlayerFlag) {
        thisMovie("BlogTvPanel").muteAllStreams();
    }
}
function iab_rma_stop() {
    if (HPPlayerFlag) {
        thisMovie("BlogTvPanel").unMuteAllStreams();
    }
}

function MutePlayer(status) {
    if (HPPlayerFlag) {
        if (status) {
            thisMovie("BlogTvPanel").muteAllStreams();
        } else {
            thisMovie("BlogTvPanel").unMuteAllStreams();
        }
    }
}


//////////////// Players Functions ///////////////////////

/*------------------------------------------- Custom Alerts ------------------------------------------------*/
function blogtvConfirm(displayText) {
    return showDialog(displayText, "confirm");
}

function blogtvAlert(displayText) {
    showDialog(displayText, "alert");
}

function showDialog(displayText, dialogType) {
    displayText = new String(displayText);
    displayTextFF = displayText.replace(/&#39;/gi, "'");
    displayText = encodeURI(displayText.replace(/&#39;/gi, "'"));


    // checking the input variables:
    if (typeof displayText == "undefined" || typeof dialogType == "undefined") {
        alert("Javascript function showDialog() Error - function has to get 2 variables.");
        return;
    }
    dialogType = dialogType.toLowerCase();
    // checking the dialogType string:
    // (must be 'question' , 'inform' or 'input'
    if (dialogType != "alert" && dialogType != "confirm" && dialogType != "input") {
        alert("Javascript function showDialog() Error - dialogType value incorrect.");
        return;
    }
    // checking the displayText string 
    // (can't be empty)
    if (displayText == "") {
        alert("Javascript function showDialog() Error - displayText value can't be empty.");
        return;
    }

    if (isIEbrowser()) /// This is Internet Explorer browser:
    {
        // setting the features of the dialog box:
        /////////////////////////////////////////
        var dialogHeight = "280";
        var dialogWidth = "315";
        var scroll = "no";
        var resizable = "no";
        var help = "no";
        var status = "0";
        var dialogFeatures = "";
        var returnVal = 0;
        dialogFeatures = "dialogHeight:" + dialogHeight + "px";
        dialogFeatures += ";dialogWidth:" + dialogWidth + "px";
        dialogFeatures += ";scroll:" + scroll;
        dialogFeatures += ";help:" + help;
        dialogFeatures += ";resizable:" + resizable;
        dialogFeatures += ";status:" + status;
        dialogFeatures += ";unadorned:no";
        /////////////////////////////////////////
        // opening the dialog box and getting the 
        // returned value:
        returnVal = window.showModalDialog("/Include/modalDialog/dialog.asp?dt=" + dialogType + "&t=" + displayText, window, dialogFeatures);
    }
    else /// Other browser:
    {
        switch (dialogType) {
            case "confirm":
                returnVal = confirm(displayTextFF);
                break;
            case "alert":
                alert(displayTextFF);
                break;
            case "input":
                returnVal = prompt(displayTextFF);
                break;
        }
    }
    /////////////////////////////////////////
    // in any case, the returned value of this function 
    // will be 0, 1 or a string (not empty)
    if (typeof returnVal == "undefined" || returnVal == "")
        return false;
    else
        return returnVal;
}

/*------------------------------------------- Custom Alerts ------------------------------------------------*/
var _SetMyProgId = 0;
var _SetMyStatus = 0;
var _SetMyUserId = 0;
var _SetOwnerUserId = 0;
var _SetOwnerUserName = "";
function ChangeSubscribeDiv() {
    if (_SetMyStatus == 0) {
        SubscriptionStr = "UnSubscribe";
        aInnerHtml = SetInnerDivContent(0);
    } else {
        SubscriptionStr = "Subscribe";
    }
    SubObj = $n("Subscribe")
    for (s = 0; s < SubObj.length; s++) {
        SubObj[s].onclick = function() { SetMyProgramHpDiv(_SetMyProgId, (1 - _SetMyStatus), _SetMyUserId, _SetOwnerUserName) };
        SubObj[s].title = SubscriptionStr;
        if (SubObj[s].innerHTML != "")
            SubObj[s].innerHTML = SubscriptionStr;
    }


}

function SetMyProgramHpDiv(ProgramId, MyProgramStatus, TuserId, TuserName) {
    aInnerHtml = "";
    _SetMyProgId = ProgramId;
    _SetMyStatus = MyProgramStatus; ;
    _SetMyUserId = TuserId;
    _SetOwnerUserName = TuserName;
    insertFlag = 'false';

    if (TuserId != 0) {
        if (MyProgramStatus == 0) {
            url = "/Ajax/My_CheckUserSubscriptions.asp";
            str = "ShowId=" + _SetMyProgId;
            objMyXML = CreateObjXML();
            objMyXML.open("POST", url, true);
            objMyXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
            objMyXML.onreadystatechange = batchCheckSubScribe;
            objMyXML.send(str);

        } else {
            User_UnSubscribe(_SetMyProgId)
        }

    }
    else {
        LogInDiv()
    }

}

function batchCheckSubScribe() {
    if (objMyXML && objMyXML.readyState == 4) {
        if (objMyXML.responseXML) {
            var MySub = objMyXML.responseXML.getElementsByTagName("MySub")
            MySub = MySub[0].firstChild.data;

            if (MySub == "1")
                writeUnSubDiv();
            else
                writeSubDiv();
        }
    }

}


function User_UnSubscribe(ShowId) {
    url = "/Ajax/My_SetUserUnSubscribe.asp";
    str = "ShowId=" + ShowId;
    objUserSubXML = CreateObjXML();
    objUserSubXML.open("POST", url, true);
    objUserSubXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objUserSubXML.onreadystatechange = batchUser_UnSubscribe;
    objUserSubXML.send(str);
}

function batchCheckSubScribe() {
    if (objMyXML && objMyXML.readyState == 4) {
        if (objMyXML.responseXML) {
            var MySub = objMyXML.responseXML.getElementsByTagName("MySub")
            MySub = MySub[0].firstChild.data;

            if (MySub == "1")
                writeUnSubDiv();
            else
                writeSubDiv();
        }
    }

}

function writeSubDiv() {
    var SubscribeUserName = _SetOwnerUserName + "'s";
    var DivTitle = "Subscribe to UserName show";
    DivTitle = DivTitle.replace("UserName", SubscribeUserName);
    aInnerHtml = SetInnerDivContent(0);
    writeCustomAlert(DivTitle, aInnerHtml, "752", "360", "", "");
}

function writeUnSubDiv() {
    var SubscribeUserName = _SetOwnerUserName + "'s";
    var DivTitle = "UnSubscribe from UserName show";
    DivTitle = DivTitle.replace("UserName", SubscribeUserName);
    aInnerHtml = SetInnerDivContent(2);
    writeCustomAlert(DivTitle, aInnerHtml, "752", "360", "", "");
}

function writeTnxSubDiv() {
    var OwnerUserName = _SetOwnerUserName + "'s";
    var DivTitle = "Your subscription to UserName show";
    DivTitle = DivTitle.replace("UserName", OwnerUserName);
    aInnerHtml = SetInnerDivContent(1);
    aInnerHtml = aInnerHtml.replace("SubscribeUserName", OwnerUserName);
    writeCustomAlert(DivTitle, aInnerHtml, "752", "360", "", "");
    setTimeout("removeCustomAlert();", 4000);
}

function batchUser_UnSubscribe() {
    if (objUserSubXML && objUserSubXML.readyState == 4) {
        if (objUserSubXML.responseXML) {
            ChangeSubscribeDiv();
            removeCustomAlert();
        }
    }
}

function ChangeSubscribeDiv() {
    if (_SetMyStatus == 0) {
        SubscriptionStr = "UnSubscribe";
        aInnerHtml = SetInnerDivContent(0);
    }
    else {
        SubscriptionStr = "Subscribe";
    }
    SubObj = $n("Subscribe")
    for (s = 0; s < SubObj.length; s++) {
        SubObj[s].onclick = function() { SetMyProgramHpDiv(_SetMyProgId, (1 - _SetMyStatus), _SetMyUserId, _SetOwnerUserName) };
        SubObj[s].title = SubscriptionStr;
        if (SubObj[s].innerHTML != "")
            SubObj[s].innerHTML = SubscriptionStr;
    }


}

function SetInnerDivContent(item) {
    var InnerDivHtm = "";

    switch (item) {
        case 0: // subscribe div 
            InnerDivHtm = '' +
            '<div class="posRel">' +
                '<div class="posAbs FB" style="top:10px;height:20px;">What kind of alerts would you like to receive about this show?</div>' +
                '<div class="posAbs StartRemindDiv">' +
                    '<input type="checkbox" onclick="Alerts_SetUserAlerts(0,1);" id="StartRemind" name="StartRemind" value="' + _SetMyProgId + '" checked/> When show starts' +
                '</div>' +
                '<div class="posAbs RemindBefDiv">' +
                    '<input type="checkbox" onclick="Alerts_SetUserAlerts(0,2);" id="RemindBef" name="RemindBef" value="' + _SetMyProgId + '" /> 5 Mins before show starts' +
                '</div>' +
                '<div class="posAbs RemindVodDiv">' +
                    '<input type="checkbox" onclick="Alerts_SetUserAlerts(0,3);" id="RemindVod" name="RemindVod" value="' + _SetMyProgId + '" checked/> New VOD alert' +
                '</div>' +
                '<div class="posAbs FB" style="top:10px; top:120px;">Where would you like to receive them?</div>' +
                '<div class="posAbs ByMobileDiv">' +
                    '<input type="checkbox" onclick="Alerts_SetUserAlerts(0,4);" name="ByMobile" id="ByMobile" checked/> My cellphone ' +
                '</div>' +
                '<div class="posAbs ByEmailDiv">' +
                    '<input type="checkbox" onclick="Alerts_SetUserAlerts(0,5);" name="ByEmail" id="ByEmail" checked/> My email' +
                '</div>' +
                '<!--div class="posAbs" style="left:10px; top:200px;">' +
                    '<input type="checkbox" onclick="Alerts_SetUserAlerts(0,6);" name="ByToolbar" id="ByToolbar" checked/> My blogTV toolbar (coming soon)' +
                '</div>' +
                 '<div class="posAbs ByAimDiv">' +
                    '<input type="checkbox" onclick="Alerts_SetUserAlerts(0,7);" name="ByAim" id="ByAim" checked/> My IM (coming soon)' +
                '</div-->' +
                '<div class="posAbs" style="width:130px; left:200px; top:210px;">' +
                    writeGreenButtonJS(120, "Subscribe", "SetMyProgramHP(" + _SetMyProgId + "," + _SetMyStatus + "," + _SetMyUserId + ");") +
                '</div>' +
                '<div class="posAbs" style="width:130px; left:400px;top:210px;">' +
                    writeGreenButtonJS(120, "Close", "removeCustomAlert();") +
                '</div>' +
            '</div>';
            break;

        case 1: // Thanks - subscribe div 
            InnerDivHtm = '' +
            '<center><div class="posRel FB" style="top:10px;height:20px;">You are now subscribed to SubscribeUserName Show</div></center>';
            break;
        case 2: // UnSubscribe - subscribe div
            InnerDivHtm = '' +
            '<div class="posRel">' +
                '<div class="posAbs" style="top:140px;left:300px;">' +
                    writeGreenButtonJS(120, "UnSubscribe", "User_UnSubscribe(" + _SetMyProgId + ");") +
                '</div>' +
                '<div class="posAbs" style="top:140px;left:500px;">' +
                    writeGreenButtonJS(120, "Close", "removeCustomAlert();") +
                '</div>' +
            '</div>';
            break;

        case 3: //SMS_Activation
            InnerDivHtm = '' +
            '<div class="posRel">' +
                '<div class="posAbs FB" style="top:10px;left:10px;">' +
                    'We have just sent you a sms message with a code, please enter the code below:' +
                '</div>' +
                '<div class="posAbs" style="top:45px;left:10px;">' +
                    'Confirmation code: ' +
                    '<input type="text" name="SMS_ActiveKey" id="SMS_ActiveKey" style="width:100px;" maxlength="10" />' +
                '</div>' +
                '<!--div class="posAbs" style="top:90px;left:10px;">' +
                    '<a onclick=alert("ask Daniel") class="UnLine" title="I did not get the message! Why?">I did not get the message! Why?</a>' +
                '</div-->' +
                '<div class="posAbs" style="top:140px;left:300px;">' +
                    writeGreenButtonJS(120, "Confirm", "Sms_ConfirmKey();") +
                '</div>' +
                '<div class="posAbs" style="top:140px;left:500px;">' +
                    writeGreenButtonJS(120, "Close", "removeCustomAlert();") +
                '</div>' +
            '</div>';
            break;

        case 4: //Login
            InnerDivHtm = '' +
            '<div class="posRel">' +
                '<div class="posAbs F12 FB C_GD loginDivMust">You must be logged in to use this feature</div>' +
                '<div class="posAbs F12 FB C_GD loginDivName">Username:</div>' +
                '<div class="posAbs loginInName">' +
                    '<input type="Text" tabindex="10" name="divUserName" id="divUserName" onkeypress="return isEnglish(event) || isNumber(event) || isSigns(event,1,this.value);" alt="Enter Username" title="Enter Username" value="Enter Username" onfocus="claerMe(this);" autocomplete="on" class="Standard_white" style="width:195px; height:20px;" />' +
                '</div>' +
                '<div class="posAbs F12 FB C_GD loginDivPass">Password:</div>' +
                '<div class="posAbs loginInPass">' +
                    '<input type="Password" tabindex="11" name="divUserPsw" id="divUserPsw" onkeypress="CheckForEnterDiv(event,16)" value="" alt="Enter Password" title="Enter Password" onfocus=ChangeBackPass("divUserPsw"); autocomplete="on" class="Standard_white" style="width:195px; height:20px;" />' +
                    '<a onclick="ForgotPswDiv();" class="posAbs UnLine CursorP F9 LH10 C_GD loginForgotPass" tabindex="3" title="Forgot your password?">Forgot your password?</a>' +
                '</div>' +
                '<div id="divLoginErr" class="posAbs F11 FB loginErrDiv"></div>' +
                '<div class="posAbs F10 C_GD loginNewUser">NEW USER? <a class="UnLine CursorP" onclick="setSignIn();" title="join us">join us!</a></div>' +
                '<div class="posAbs loginButton">' +
                    writeGreenButtonJS(91, 'GO!', 'Login(16);') +
                '</div>' +
                '<div class="posAbs loginDivImg">' +
                    '<img src="' + _storageImagesURL + 'logInDiv!.jpg" title="" alt="" width="80" height="100" />' +
                '</div>' +
            '</div>';
            break;
        case 5: //forgot Psw
            switch (ContentLangID) {
                case "1":
                    InputLeft = 220;
                    LinkLeft = InputLeft + 150;
                    break;
                case "2":
                    InputLeft = 340;
                    LinkLeft = InputLeft + 120;
                    break;
                default:
                    InputLeft = 220;
                    LinkLeft = InputLeft + 150;
                    break;
            }
            InnerDivHtm = '' +
            '<div class="posRel >' +
               '<div class="posAbs forgotPassDiv">' +
                    'Please enter the e-mail you gave during your registration. The username and password will be sent to your e-mail shortly:' +
               '</div>' +
               '<div class="posAbs forgotPassInput">' +
                   '<input type="text" class="posAbs" style="width:300px;" tabindex="2" name="divAlertEmail" id="divAlertEmail" value=""  onkeypress="return isEnglishAndSigns4Emails(event) || isNumber(event)" autocomplete="on">' +
               '</div>' +
                '<div class="posAbs forgotPassSend">' +
                    writeGreenButtonJS(100, 'Send', 'sendForgotPwd()') +
                '</div>' +
                '<div id="divLoginErr" class="posAbs F12 FB LH14 C_R" style="top:80px; left:10; width:585px;"></div>' +
                '<div class="posAbs F16 LH17 FB C_GD forgotPassNewUser">NEW USER?</div>' +
                '<div class="posAbs" style="left:' + InputLeft + 'px; top:120px;">' +
                    writeGreenButtonJS(100, 'SIGN UP HERE', 'JoinUsDiv();') +
                '</div>' +
                '<div class="posAbs BGW BOGL" style="left:' + LinkLeft + 'px; top:120px;">' +
                    writeGreenButtonJS(100, 'Back', 'LogInDiv();') +
                '</div>' +
            '</div>';
            break;
        case 6: //Sms - thank you
            InnerDivHtm = '' +
            '<center><div class="posRel FB" style="top:10px;height:20px;">Thank you for activating your SMS account</div></center>';
            break;
    }
    return InnerDivHtm;
}
var _MobileSubscribe = 0;
var _isSubscribe = false;
function SetMyProgramHP(ProgramId, MyProgramStatus, TuserId) {
    ChangeSubscribeDiv()
    var BR = 0;
    var SR = 0;
    var RV = 0;
    var ByM = 0;
    var ByE = 0;
    var ByT = 0;
    var ByA = 0;

    var StartRemind = $g("StartRemind");
    var RemindBef = $g("RemindBef");
    var RemindVod = $g("RemindVod");

    var ByMobile = $g("ByMobile");
    var ByEmail = $g("ByEmail");
    var ByToolbar = $g("ByToolbar");
    var ByAim = $g("ByAim");

    if (!_isSubscribe) {
        _isSubscribe = true;
        if (StartRemind.checked) SR = StartRemind.value;
        if (RemindBef.checked) BR = RemindBef.value;
        if (RemindVod.checked) RV = RemindVod.value;

        if (ByMobile.checked) ByM = 1;
        if (ByMobile.checked) _MobileSubscribe = 1;
        if (ByEmail.checked) ByE = 1;
        //if(ByToolbar.checked) ByT=1;
        //if(ByAim.checked)     ByA=1;

        //bTV2N.LogAct("",ProgramId,219,"");
        url = "/Ajax/My_SetProgram.asp";
        str = "ProgramId=" + ProgramId + "&Status=" + MyProgramStatus + "&SR=" + SR + "&BR=" + BR + "&RV=" + RV + "&ByM=" + ByM + "&ByE=" + ByE + "&ByT=" + ByT + "&ByA=" + ByA;
        objMyXML = CreateObjXML();
        objMyXML.open("POST", url, true);
        objMyXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
        objMyXML.onreadystatechange = batchMyChange;
        objMyXML.send(str);
    }
}

function batchMyChange() {
    if (objMyXML && objMyXML.readyState == 4) {
        if (objMyXML.responseXML) {
            _isSubscribe = false;
            var Str = objMyXML.responseXML.getElementsByTagName("Str");
            Str = Str[0].firstChild.data;
            if (Str == 'True') {
                var ShowId = objMyXML.responseXML.getElementsByTagName("ShowId");
                ShowId = ShowId[0].firstChild.data;
                //if(_ownerUserName=="undefined")
                //{
                var _ownerUserName = objMyXML.responseXML.getElementsByTagName("OwnerUserName");
                _ownerUserName = _ownerUserName[0].firstChild.data;
                //}
                var ByMobile = objMyXML.responseXML.getElementsByTagName("ByMobile");
                ByMobile = ByMobile[0].firstChild.data;
                var MobileActive = objMyXML.responseXML.getElementsByTagName("MobileActive");
                MobileActive = MobileActive[0].firstChild.data;
                var MobileErr = objMyXML.responseXML.getElementsByTagName("MobileErr");
                MobileErr = MobileErr[0].firstChild.data;
                var ByEmail = objMyXML.responseXML.getElementsByTagName("ByEmail");
                ByEmail = ByEmail[0].firstChild.data;
                var ByToolbar = objMyXML.responseXML.getElementsByTagName("ByToolbar");
                ByToolbar = ByToolbar[0].firstChild.data;
                var ToolbarErr = objMyXML.responseXML.getElementsByTagName("ToolbarErr");
                ToolbarErr = ToolbarErr[0].firstChild.data;
                var ByAim = objMyXML.responseXML.getElementsByTagName("ByAim");
                ByAim = ByAim[0].firstChild.data;
                var AimErr = objMyXML.responseXML.getElementsByTagName("AimErr");
                AimErr = AimErr[0].firstChild.data;

                if (ByMobile == 1 && MobileActive == 0) {
                    //aInnerHtml = SetInnerDivContent(2);		        
                    getSmsUserDetailsDiv()
                }
                else {
                    _SetOwnerUserName = _ownerUserName;
                    writeTnxSubDiv();
                }
            }
        }
    }
}
function getRndShow() {
    str = null;
    url = "/ajax/Program_getShow.asp"
    objRndShowXML = CreateObjXML();
    objRndShowXML.open("POST", url, true);
    objRndShowXML.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    objRndShowXML.onreadystatechange = batchChangegetRndShow;
    objRndShowXML.send(str);
}
function batchChangegetRndShow() {
    if (objRndShowXML && objRndShowXML.readyState == 4) {
        if (objRndShowXML.responseXML) {
            var UserName = objRndShowXML.responseXML.getElementsByTagName("UserName");
            UserName = UserName[0].firstChild.data;
            var RNDShowURL = "/liveNow";
            if (UserName != "") {
                if (_RndShowCampaign == "") { _RndShowCampaign = "Shuffle_Misc"; }
                RNDShowURL = "/people/" + UserName + "/?utm_source=Shuffle&utm_medium=site&utm_campaign=" + _RndShowCampaign;
            }
            location.href = RNDShowURL;



        }
    }
}
function changeMainFrm(newAction,newTarget) {
    if (newAction != "") { $g("aspnetForm").action = newAction; }
    if (newTarget != "") { $g("aspnetForm").target = newTarget; }
    document.forms[0].submit();
}
function signInDiv() {
    SiteAlert("In order to broadcast please sign into your account or <a onclick='setSignIn();'>click here</a> to <a onclick='setSignIn();'>sign up</a> for a new account.");
}
function LogInDiv() {
    DivTitle = "Login  <span class='FN LCase'>or</span> <a onclick='setSignIn();' title='join us' class='FN UnLine C_W CCase'>join us</a>";
    aInnerHtml = SetInnerDivContent(4);
    _onDivCloseRefresh = true;
    writeCustomAlert(DivTitle, aInnerHtml, "570", "250", "", "");
}
function ChangeBackPass(idName) {
    obj = $g(idName);
    obj.style.backgroundImage = "";
    obj.style.background = "";
    obj.style.background = "#404040";
}
