﻿var cph = "ctl00_ContentPlaceHolder1_";

function LoadGroupTitle(GroupID) {
    var strParams = "Action=getGroupTitle&GroupID=" + GroupID + "&History=" + document.getElementById(cph + "hdnHistory").value;
    var loader1 = new net.ContentLoader("showline.aspx", LoadGroupTitleResult, null, "POST", strParams);
}

function LoadGroupTitleResult() {
    var sResult = this.req.responseText;
    document.getElementById("divGT_Title").innerHTML = sResult;
}

function LoadBackTitle(GroupID) {
    var prevGroupID = getPrevGroupID();
    //var strParams = "Action=getBackTitle&GroupID=" + prevGroupID + "&History=" + document.getElementById(cph + "hdnHistory").value;
    var strParams = "Action=getBackTitle&GroupID=" + GroupID + "&History=" + document.getElementById(cph + "hdnHistory").value;
    //var strParams = "Action=getBackTitle&GroupID=" + GroupID + "&History=" + document.getElementById("hdnHistory").value;
    //alert(strParams);
    if (isNaN(prevGroupID) == false && prevGroupID != "") {
        var loader1 = new net.ContentLoader("showline.aspx", LoadBackTitleResult, null, "POST", strParams);
    }
}

function doOfferLogin(url) {
    var sHttp = window.location.hostname;
    var sURL = "";
    
    sURL = "/apps/customerlogin/customerlogin.aspx?Redirect=" + url;
    alert("http://" + sHttp + sURL);
    location = "http://" + sHttp + sURL;    
}

function LoadBackTitleResult() {
    var sResult = this.req.responseText;
    document.getElementById("a_backtitle").innerHTML = " " + sResult;
}

function getPrevGroupID() {
    var hdnHistory = document.getElementById(cph + "hdnHistory").value;
    hdnHistory = hdnHistory + ":";
    var arrHistory = hdnHistory.split(":");
    var i = 0;
    var GroupID = 0;

    hdnHistory = "";
    if (arrHistory[arrHistory.length - 3]) {
        for (i = 0; i < arrHistory.length; i++) {
            if (hdnHistory == "") {
                hdnHistory = arrHistory[i];
            } else {
                hdnHistory = hdnHistory + ":" + arrHistory[i];
            }
            if (arrHistory[arrHistory.length - 3] == arrHistory[i]) { break; }
        }
        GroupID = arrHistory[arrHistory.length - 3];
    }
    return GroupID;
}

