function initializeJQueryCode() {

    $('.marquee_cycle').cycle({
        fx: 'fade',
        speed: 1500,
        timeout: 6000
    });

    $('.news_cycle').cycle({
        fx: 'blindY',
        speed: 750,
        timeout: 20000,
        pager: '#news_cycle_nav',
        pagerAnchorBuilder: function(idx, slide) {
            return '<a href="#"></a>';
        }
    });

    $('.athlete_cycle').cycle({
        fx: 'fade',
        speed: 1500,
        timeout: 6000
    });

    $('.tabs').tabs();

    $(".collapsible-body-default-hide").hide();
    $(".collapsible-body-default-show").show();
    $(".collapsible-header").click(function() {
        var body = $(this).next(".collapsible-body");
        $(body).toggle();
    });
}

$(document).ready(function() {
    initializeJQueryCode();
});

function pageLoad() {
    initializeJQueryCode();
}

function PopupWindow(aUrl, w, h, sb, rs, tb, dir, st, mnu) {
    if (!sb) sb = "yes"; if (!rs) rs = "yes"; if (!tb) tb = "no"; if (!dir) dir = "no"; if (!st) st = "no"; if (!mnu) mnu = "no";
    popupWin = window.open(aUrl, "PopupWin", "scrollbars=" + sb + ",resizable=" + rs + ",toolbar=" + tb + ",directories=" + dir + ",status=" + st + ",menubar=" + mnu + ",width=" + w + ",height=" + h + ",resizable=yes");
    popupWin.self.focus();
}

function PopupNamedWindow(aName, aUrl, w, h, sb, rs, tb, dir, st, mnu) {
    if (!sb) sb = "yes"; if (!rs) rs = "yes"; if (!tb) tb = "no"; if (!dir) dir = "no"; if (!st) st = "no"; if (!mnu) mnu = "no";
    popupWin = window.open(aUrl, aName, "scrollbars=" + sb + ",resizable=" + rs + ",toolbar=" + tb + ",directories=" + dir + ",status=" + st + ",menubar=" + mnu + ",width=" + w + ",height=" + h + ",resizable=yes");
    popupWin.self.focus();
}

function PopupUniqueWindow(aUrl, w, h, sb, rs, tb, dir, st, mnu) {
    if (!sb) sb = "yes"; if (!rs) rs = "yes"; if (!tb) tb = "no"; if (!dir) dir = "no"; if (!st) st = "no"; if (!mnu) mnu = "no";
    popupWin = window.open(aUrl, "PopupWin" + (new Date()).getTime(), "scrollbars=" + sb + ",resizable=" + rs + ",toolbar=" + tb + ",directories=" + dir + ",status=" + st + ",menubar=" + mnu + ",width=" + w + ",height=" + h + ",resizable=yes");
    popupWin.self.focus();
}

function HideShowControl(ctrlid) {
    var ctrl = document.getElementById(ctrlid);
    if (ctrl.style.display == "none") {
        ctrl.style.display = "";
    }
    else {
        ctrl.style.display = "none";
    }
}

function HideControl() {
    var ctrl;

    for (i = 0; i < arguments.length; i++) {
        ctrl = document.getElementById(arguments[i]);
        if (ctrl.style.display != "none") {
            ctrl.style.display = "none";
        }
    }
}

function ShowControl() {
    var ctrl;

    for (i = 0; i < arguments.length; i++) {
        ctrl = document.getElementById(arguments[i]);

        if (ctrl.style.display == "none") {
            ctrl.style.display = "";
        }
    }
}

function rollLeft(speed) {
    if (document.getElementById('scrollHold').value < 0) {
        document.getElementById('scrollHold').value = parseInt(document.getElementById('scrollHold').value) + parseInt(speed);
        document.getElementById('interior_images').style.marginLeft = document.getElementById('scrollHold').value + 'px';
    }
}

function rollRight(speed) {
    if (document.getElementById('scrollHold').value > 0 - 0) {
        document.getElementById('scrollHold').value = parseInt(document.getElementById('scrollHold').value) - parseInt(speed);
        document.getElementById('interior_images').style.marginLeft = document.getElementById('scrollHold').value + 'px';
    }
}
