﻿var openpages = new Array();
openpages[0] = 'cat_jr_syn_open-1.htm';
openpages[1] = 'cat_jr_syn_open-2.htm';

var monopages = new Array();
monopages[0] = "cat_jr_syn_mono_top-1.htm";
monopages[1] = "cat_jr_syn_mono_top-2.htm";
monopages[2] = "cat_jr_syn_mono_top-3.htm";

function GetURL(pageIndex) {
    var currPath = window.location.pathname;
    var currPage = currPath.substring(currPath.lastIndexOf('/') + 1);

    var collection = currPath.substring(currPath.lastIndexOf('_') + 1);
    collection = collection.substring(0, 1);

    if (collection == 't') {
        location.href = monopages[pageIndex];
    }
    else if (collection == 'o') {
        location.href = openpages[pageIndex];
    }
}

function LoadModules(id) {

    /* Hover Menu   */
    var a = document.getElementById(id);
    for (var i = 1; i <= 2; i++) {
        if (document.getElementById('hmenu' + i)) { document.getElementById('hmenu' + i).style.display = 'none'; document.getElementById('hmenu' + i).style.visibility = 'visible'; }
    }
    if (a) { a.style.display = 'inline'; }


    /* Pagination */
    var j = 0;
    var k = 0;
    var currPath = window.location.pathname;
    var currPage = currPath.substring(currPath.lastIndexOf('/') + 1);
    var collection = currPath.substring(currPath.lastIndexOf('_') + 1);
    collection = collection.substring(0, 1);

    if (collection == 't') {

        for (j = 0; j <= monopages.length - 1; j++) {

            if (document.getElementById('ppg' + j + '-top' || document.getElementById('ppg' + j + '-bottom')) && currPage == 'cat_jr_syn_mono_top-1.htm') {
                document.getElementById('ppg1-top').className += " active";
                document.getElementById('ppg1-top').style.color = '#ffffff';
                document.getElementById('ppg1-bottom').className += " active";
                document.getElementById('ppg1-bottom').style.color = '#ffffff';
            }
            else {
                document.getElementById('ppg1-top').className += " last";
                document.getElementById('ppg1-bottom').className += " last";
            }

            if (document.getElementById('ppg' + j + '-top' || document.getElementById('ppg' + j + '-bottom')) && currPage == 'cat_jr_syn_mono_top-2.htm') {
                document.getElementById('ppg2-top').className += " active";
                document.getElementById('ppg2-top').style.color = '#ffffff';
                document.getElementById('ppg2-bottom').className += " active";
                document.getElementById('ppg2-bottom').style.color = '#ffffff';
            }
            else {
                document.getElementById('ppg2-top').className += " last";
                document.getElementById('ppg2-bottom').className += " last";
            }

            if (document.getElementById('ppg' + j + '-top' || document.getElementById('ppg' + j + '-bottom')) && currPage == 'cat_jr_syn_mono_top-3.htm') {
                document.getElementById('ppg3-top').className += " active";
                document.getElementById('ppg3-top').style.color = '#ffffff';
                document.getElementById('ppg3-bottom').className += " active";
                document.getElementById('ppg3-bottom').style.color = '#ffffff';
            }
            else {
                document.getElementById('ppg3-top').className += " last";
                document.getElementById('ppg3-bottom').className += " last";
            }

        }
    }
    else if (collection == 'o') {


        for (k = 0; k <= openpages.length - 1; k++) {
            if (document.getElementById('ppg' + k + '-top' || document.getElementById('ppg' + k + '-bottom')) && currPage == 'cat_jr_syn_open-1.htm') {
                document.getElementById('ppg1-top').className += " active";
                document.getElementById('ppg1-top').style.color = '#ffffff';
                document.getElementById('ppg1-bottom').className += " active";
                document.getElementById('ppg1-bottom').style.color = '#ffffff';
            }
            else {
                document.getElementById('ppg1-top').className += " last";
                document.getElementById('ppg1-bottom').className += " last";
            }

            if (document.getElementById('ppg' + k + '-top' || document.getElementById('ppg' + k + '-bottom')) && currPage == 'cat_jr_syn_open-2.htm') {
                document.getElementById('ppg2-top').className += " active";
                document.getElementById('ppg2-top').style.color = '#ffffff';
                document.getElementById('ppg2-bottom').className += " active";
                document.getElementById('ppg2-bottom').style.color = '#ffffff';
            }
            else {
                document.getElementById('ppg2-top').className += " last";
                document.getElementById('ppg2-bottom').className += " last";
            }

        }
    }

}

function Previous() {

    var currPath = "";
    var currPage = "";

    currPath = window.location.pathname;
    currPage = currPath.substring(currPath.lastIndexOf('/') + 1);
    var pageIndex = currPath.substring(currPath.lastIndexOf('-') + 1);

    pageIndex = pageIndex.substring(0, 1);
    pageIndex = pageIndex - 2;
    GetURL(pageIndex);


}

function Next() {
    var currPath = "";
    var currPage = "";

    currPath = window.location.pathname;
    currPage = currPath.substring(currPath.lastIndexOf('/') + 1);
    var pageIndex = currPath.substring(currPath.lastIndexOf('-') + 1);

    pageIndex = pageIndex + 1;
    pageIndex = pageIndex.substring(0, 1);
    GetURL(pageIndex);

}

function Submit(form) {

    if (form.os1.value.length == 0) {
        alert("Please select a color");
        return false
    }
    else {
        form.action = "https://www.paypal.com/cgi-bin/webscr";
        document.form.submit();
    }

}


