﻿/*
* Functionality for microform. 
* Requires:
*   - prototype.js
*   - scriptaculous
*   - microform-slide-controller
*   - microform-progress-controller
* Tom Elmore
*/


Event.observe(window, 'load',
    function main() {
        // if ($('ctl00_ContentHolder_SlidingForm_ButtonContinue') != null && $('ctl00_ContentHolder_SlidingForm_ButtonFinish') == null) {

        if (typeof SlidingForm == 'object') {
            uxProgressBar.setTotalPages(SlidingForm.maxPages);

            var setPageEvent = function(value) { uxProgressBar.setPage(value); }

            if (typeof ReturningFromContactPage == "undefined" || ReturningFromContactPage == false) {
                SlidingForm.observe(setPageEvent); // links the progress controller to the form controller
            }
        }

        displayHiddenFieldsets(); // to prevent flicker, all fieldsets are initialised as hidden then displayed onload
    }
);
