function AmendPageAdsRedir() 
{
    var page = GetDisplayedPage();
    //var title = GetPageTitle();
    //alert(page);
    
    
    window.parent.tbmain.location.href = "/plugins/cgolfer/admin/cgadsredir.php?ref=" + page;
}

function AmendPageSEORedir() 
{
    var page = GetDisplayedPage();
    //var title = GetPageTitle();
    //alert(page);


    window.parent.tbmain.location.href = "/plugins/cgolfer/admin/cgpagemetaredir.php?ref=" + page;
}

function GetDisplayedPage() {
    return (window.parent.tbmain.location.href);
}

function GetPageTitle() {
    return (window.parent.tbmain.document.title);
}

function ToggleReview(id, show)
{
    var lnk = document.getElementById("showrev" + id);
    var rev = document.getElementById("rev" + id);
    lnk.style.display = (show) ? "none" : "inline";
    rev.style.display = (show) ? "inline" : "none";

    var $scrlinner = $('#tab1_' + crTab + 'inner');
    $scrlinner.jScrollPane({ scrollbarWidth: 13, reinitialiseOnImageLoad: true, arrowSize: 15, showArrows: true });
    //var targetElementSelectorString = $(this).attr('rel');
    $scrlinner[0].scrollTo('rev' + id);
}

function ToggleReviewForm(show)
{
    var theForm = document.getElementById("revform");
    theForm.style.display = (show) ? "block" : "none";
}


function CGSwitchTabsDivSwap(strForm, arrFlds, strTabCtl, intTab, callback) {
    var tabUBound = arrTabs.length - 2;
    for (var i = 0; i <= tabUBound; i++) {
        var theDiv = document.getElementById(strTabCtl + "_" + i);
        theDiv.style.marginLeft = "0px";
        theDiv.style.display = (intTab == i ? "block" : "none");
    }

    //Switch tabs
    eval("intCur" + strTabCtl + " = intTab;");
    for (var i = 0; i <= tabUBound; i++) {
        objTabText = document.getElementById("tabText_" + strTabCtl + "_" + i);
        objTabTop = document.getElementById("tabtop_" + strTabCtl + "_" + i);
        var tabHdr = "";
        eval("tabHdr = arrTabHdrs" + strTabCtl + "[i];");
        if (i == intTab) {
            objTabText.innerHTML = tabHdr;
            objTabText.className = "seltab";
            objTabTop.className = "tabsbottomborder";
        }
        else {
            objTabText.innerHTML = "<a class=tablnk href=\"JavaScript:CGSwitchTabsDivSwap('" + strForm + "', arr" + strTabCtl + "Inputs, '" + strTabCtl + "', " + i + ", " + (callback == null ? "null" : "'" + callback + "'") + ")\">" + tabHdr + "</a>";
            objTabText.className = "tab";
            objTabTop.className = "";
        }
    }

    if (callback != null) {
        eval(callback + "(" + intTab + ")");
    }
}


function CGSwitchVidTabsDivSwap(strForm, arrFlds, strTabCtl, intTab, callback) {
    var tabUBound = arrVidTabs.length - 2;
    for (var i = 0; i <= tabUBound; i++) {
        var theDiv = document.getElementById(strTabCtl + "_" + i);
        theDiv.style.display = (intTab == i ? "block" : "none");
    }

    //Switch tabs
    eval("intCur" + strTabCtl + " = intTab;");
    for (var i = 0; i <= tabUBound; i++) {
        objTabText = document.getElementById("tabText_" + strTabCtl + "_" + i);
        objTabTop = document.getElementById("tabtop_" + strTabCtl + "_" + i);
        var tabHdr = "";
        eval("tabHdr = arrTabHdrs" + strTabCtl + "[i];");
        if (i == intTab) {
            objTabText.innerHTML = tabHdr;
            objTabText.className = "seltab";
            objTabTop.className = "tabsbottomborder";
        }
        else {
            objTabText.innerHTML = "<a class=tablnk href=\"JavaScript:CGSwitchVidTabsDivSwap('" + strForm + "', arr" + strTabCtl + "Inputs, '" + strTabCtl + "', " + i + ", " + (callback == null ? "null" : "'" + callback + "'") + ")\">" + tabHdr + "</a>";
            objTabText.className = "tab";
            objTabTop.className = "";
        }
    }

    if (callback != null) {
        eval(callback + "(" + intTab + ")");
    }
}

function ToggleBlockEntry(blockid)
{
    var block = document.getElementById('blockentrydesc' + blockid);
    var curstyle = block.style.display;
    block.style.display = (curstyle == 'block') ? 'none' : 'block';
    var arrow = document.getElementById('arrow' + blockid);
    arrow.innerHTML = (curstyle == 'block') ? '&gt;' : 'v';
}
