﻿function initScroller() {
    $('.scrollingContentContainer').jScrollPane({ scrollbarWidth: 14, dragMinHeight: 29, dragMaxHeight: 29, scrollbarMargin: 5 });
}

var nCurrentHomepageTime = 0;
var nCurrentDisplayImage = 1;
var nHomepageSwitchTime = 5;
var homepageImageSwitchIsPaused = false;

function toggleHomePageImage(ImgNo) {

    $("#masterContainerContentDual .decoration .layout .contentArea #billRotation").css("background-image", "url(images/bill/" + ImgNo + ".png)");

    resetHomepageTime();

}

function resetHomepageTime() {
    nCurrentHomepageTime = 0;
}

function doHomePageSwitcheroo() {

    if (homepageImageSwitchIsPaused) {
        setTimeout("doHomePageSwitcheroo()", 1000);
        return;
    }

    if (nCurrentHomepageTime == nHomepageSwitchTime) {

        if (nCurrentDisplayImage == 5) {
            nCurrentDisplayImage = 1;
        } else {
            nCurrentDisplayImage += 1;
        }

        toggleHomePageImage(nCurrentDisplayImage);

    } else {
        nCurrentHomepageTime += 1;
    }

    setTimeout("doHomePageSwitcheroo()", 1000);

}

function toggleFooter() {

    var pageElements;

    if (pageMode == "single") {
        pageElements = 187 + 410;

        if (pageElements < $(window).height()) {
            $(".menuBackgroundFooter").css("display", "block");
            $(".masterContainer").css("height", $(document).height() + "px");
        } else {
            $(".menuBackgroundFooter").css("display", "none");
            $(".masterContainer").css("height", "597px");
        }
    } else {
        pageElements = 187 + 454;



//        }

        if (pageElements < $(window).height()) {
            $(".menuBackgroundFooter").css("display", "block");
            $(".masterContainer").css("height", $(document).height() + "px");
            $("#footerHide").css("height", (($(document).height() - 454) - 2) + "px");
        } else {
            $(".menuBackgroundFooter").css("display", "none");
            $(".masterContainer").css("height", "642px");
            $("#footerHide").css("height", "186px");
        }

        if ($(window).height() > pageElements) {
            $(".menuBackgroundFooter").css("display", "block");
            $(".masterContainer").css("height", $(window).height() + "px");
            $("#footerHide").css("height", (($(window).height() - 454) - 2) + "px");

            //alert("Win height > pageElements");
        }
    }
}

$(document).ready(
    function() {
        toggleFooter();
        $(window).resize(function() {
            toggleFooter();
        });
    }
)

		    function toggleOther(dropdown) {
		        if (dropdown.value == "Other") {
		            $("#divOther").css("display", "block");
		        } else {
		            $("#divOther").css("display", "none");
		        }
		    }