function initializeJQueryCode() {
    $(".validate").click(function() {
        $.validity.start();
        $(".requiredfield").require();
        $(".datefield").match("date");
        $(".emailfield").match("email");
        $(".integerfield").match("number");
        $(".numberfield").match("number");
        $(".numericfield").match("number");
        $(".decimalfield").match("number");
        $(".moneyfield").match("number");
        var result = $.validity.end();
        if (!result.valid) {
            $(".validity-summary-container").show();
            $('html, body').animate({ scrollTop: 0 }, 'fast');
        }
        return result.valid;
    });
    try {
        $(".datefield").datepicker({ changeMonth: true, changeYear: true, numberOfMonths: 1, showOtherMonths: true, selectOtherMonths: true, showButtonPanel: true, showOn: 'focus' });
        $(".datefield").datepicker('option', '{showAnim: slideDown}');
    } catch (err) { }
    try {
        $(".datefield").attr('autocomplete', 'off');
    } catch (err) { }

    $('.marquee').cycle({
        fx: 'fade',
        speed: 1500,
        timeout: 5000
    });


    // Decrease Font Size
    $(".btnTextSml").click(function() {
        var currentFontSize = $('.main-content').css('font-size');

        var currentFontSizeNum = parseFloat(currentFontSize, 10);

        var newFontSize = currentFontSizeNum * 0.8;

        $('.main-content').css('font-size', newFontSize);
        return false;
    });

    $('.btnTextLrg').click(function() {
        var currentFontSize = $('.main-content').css('font-size');

        var currentFontSizeNum = parseFloat(currentFontSize, 10);

        var newFontSize = currentFontSizeNum * 1.2;

        $('.main-content').css('font-size', newFontSize);
        return false;
    });

   


}

$(document).ready(function() {
    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 = "";
        }
    }
}
