﻿//This function is for the RowClick of the document Selection table on the PlainEDI.aspx page
function InboxRowClickEvent(row) {
    var selRow = this.GetCellByColumnUniqueName(row, "UniqueID");
    showMessage(selRow.innerHTML);
}

//This function is for the RowClick of the document Selection table on the PlainEDI.aspx page
function SentRowClickEvent(row) {
    var selRow = this.GetCellByColumnUniqueName(row, "UniqueID");
    showMessage(selRow.innerHTML);
}

function showMessage(msgID) {
    try {
        var viewer = document.getElementById('ctl00_ContentPlaceHolder1_messageview');

        if (viewer) {
            viewer.src = 'MessageView.aspx?msgID=' + msgID;
        }
        else {
            alert('can not find the viewer Iframe');
        }
    }
    catch (Error) {

        alert(Error.value);
    }

}

//****************** LeagueAdmin.aspx ************//
function LeagueRowClickEvent(row) {
    var selRow = this.GetCellByColumnUniqueName(row, "UniqueId");
    window.location.href = "LeagueCreator.aspx?leagueId=" + selRow.innerHTML;
}
//************************************************//


//**************** EventAdmin.aspx ***************//
function EventRowClickEvent(row) {
    var selRow = this.GetCellByColumnUniqueName(row, "UniqueID");
    window.location.href = "EventCreator.aspx?eventID=" + selRow.innerHTML;
}
//************************************************//


//***************** UserAdmin.aspx *****************//
function UserRowClickEvent(row) {
    var selRow = this.GetCellByColumnUniqueName(row, "ID");
    window.location.href = "AdminMyProfile.aspx?Admin=true&ID=" + selRow.innerHTML;
}
//**************************************************//

//***************** ClassifiedAdmin.aspx **********//
function ClassifiedRowClickEvent(row) {
    var selRow = this.GetCellByColumnUniqueName(row, "UniqueID");
    window.location.href = "AdminSubmitClassified.aspx?ID=" + selRow.innerHTML;

}
//************************************************//

//**************** TeamAdmin.aspx **********//
function TeamRowClickEvent(row) {
    var selRow = this.GetCellByColumnUniqueName(row, "UniqueID");
    var leagueRow = this.GetCellByColumnUniqueName(row, "LeagueID");
    window.location.href = "AdminTeamCreator.aspx?ID=" + selRow.innerHTML + "&LeagueID=" + leagueRow.innerHTML;

}
//************************************************//


//***************** JerseyAdmin.aspx **********//
function JerseyRowClickEvent(row) {
    var selRow = this.GetCellByColumnUniqueName(row, "TeamID");
    window.location.href = "JerseyOrders.aspx?ID=" + selRow.innerHTML;
}
//************************************************//


//***************** JerseyAdmin.aspx **********//
function FieldRowClickEvent(row) {
    var selRow = this.GetCellByColumnUniqueName(row, "UniqueID");
    window.location.href = "FieldCreator.aspx?ID=" + selRow.innerHTML;
}
//************************************************//


function FP_changeProp() {//v1.0
    var args = arguments, d = document, i, j, id = args[0], o = FP_getObjectByID(id), s, ao, v, x;
    d.$cpe = new Array(); if (o) for (i = 2; i < args.length; i += 2) {
        v = args[i + 1]; s = "o";
        ao = args[i].split("."); for (j = 0; j < ao.length; j++) {
            s += "." + ao[j]; if (null == eval(s)) {
                s = null; break;
            } 
        } x = new Object; x.o = o; x.n = new Array(); x.v = new Array();
        x.n[x.n.length] = s; eval("x.v[x.v.length]=" + s); d.$cpe[d.$cpe.length] = x;
        if (s) eval(s + "=v");
    }
}

function FP_getObjectByID(id, o) {//v1.0
    var c, el, els, f, m, n; if (!o) o = document; if (o.getElementById) el = o.getElementById(id);
    else if (o.layers) c = o.layers; else if (o.all) el = o.all[id]; if (el) return el;
    if (o.id == id || o.name == id) return o; if (o.childNodes) c = o.childNodes; if (c)
        for (n = 0; n < c.length; n++) { el = FP_getObjectByID(id, c[n]); if (el) return el; }
    f = o.forms; if (f) for (n = 0; n < f.length; n++) {
        els = f[n].elements;
        for (m = 0; m < els.length; m++) { el = FP_getObjectByID(id, els[n]); if (el) return el; } 
    }
    return null;
}

function FP_changePropRestore() {//v1.0
    var d = document, x; if (d.$cpe) {
        for (i = 0; i < d.$cpe.length; i++) {
            x = d.$cpe[i];
            if (x.v == "") x.v = ""; eval("x." + x.n + "=String(x.v)");
        } d.$cpe = null;
    }
}

function FP_goToURL(url) {//v1.0
    window.location = url;
}





