<!--

var animateQueue = new Array();

var desiredHeight = 0;
var minimumHeight = 0;

var elementsInSlideshow = null;
var shiftByPixels       = 180;

var interval = null;

function toggleArrowUp(button) {
    button.className = button.className.replace("-down", "");
}
function openURL(URL) {
    window.open(URL,'_null');
}
function toggleArrowDown(button) {
    if (!button.className.endsWith("-down")) {
        button.className = button.className + "-down";
    }
}

// Makes certain that when there are errors in the booking panel, the buttons do not get hidden.
function updateBookingPanelHeight(selectedIndex) {
    $('cSlideShowContainer' + (selectedIndex - 1)).getElementsByClassName('booking-panel-padded-container').each(function(element) {
        initBookingPanel(1, element.getHeight() + 108, 0);
    });
}

function initBookingPanel(selectedIndex, _desiredHeight, _minimumHeight) {
    elementsInSlideshow = $('container-booking-panel-content').getElementsByClassName('booking-panel-component-container');
    desiredHeight       = _desiredHeight;
    minimumHeight       = _minimumHeight;
    
    // IE6 does not allow a minimum height of zero.
    if (navigator.userAgent.indexOf('MSIE 6') > -1 && minimumHeight == 0) {
        minimumHeight = 1;
    }
    
    for (var i = 0; i < elementsInSlideshow.length; i++) {
        var element = elementsInSlideshow[i];
        var id      = i + 1;
        
        if (id == selectedIndex) { toggleArrowDown($('booking-panel-ticket-container-button-' + id)); }
          
        element.id   = "cSlideShowContainer" + i;       
        var children = element.getElementsByClassName('booking-panel-ticket-container-effect-wrapper');
        
        for (var ii = 0; ii < children.length; ii++) {
            children[ii].style.height = getDesiredHeight(i, selectedIndex) + "px";
        }
    }
    
    $('cSlideShow').style.overflow = "hidden";
    $('cSlideShow').style.position = "relative";
}


function selectIndex(index) {
    var slideShowElementsCompleted = 0;
    
    for (var i = 0; i < elementsInSlideshow.length; i++) {
        elementsInSlideshow[i].slideShowComplete = false;
        var button = $('booking-panel-ticket-container-button-' + (i + 1));
        
        if (i == (index - 1)) {
            toggleArrowDown(button);
        } else {
            toggleArrowUp(button);
        }
    }

    function moveIndex() {
        if (slideShowElementsCompleted >= elementsInSlideshow.length) {
            clearInterval(interval);
            
        } else {
    
            for (var i = 0; i < elementsInSlideshow.length; i++) {
                var element = elementsInSlideshow[i];
                var id      = i + 1;
                
                if (!element.slideShowComplete) {
                    var children = element.getElementsByClassName('booking-panel-ticket-container-effect-wrapper');
        
                    for (var ii = 0; ii < children.length; ii++) {
                        var child = children[ii];
                        
                        var desiredHeight = getDesiredHeight(i, index);
                        var currentHeight = parseInt(child.style.height);   
                        var newHeight     = getNewHeight(desiredHeight, currentHeight);
                    
                        child.style.height = newHeight + "px";
                        
                        if (newHeight == desiredHeight) {
                            element.slideShowComplete = true;
                            slideShowElementsCompleted += 1;
                        }
                    } 
                }             
            }
        }
    }

    clearInterval(interval);
    interval = setInterval(moveIndex, 85);    
}

function getNewHeight(desiredHeight, currentHeight) {
    var height = currentHeight;

    if (currentHeight > desiredHeight) {
        height = currentHeight - shiftByPixels;

        if (height < desiredHeight) {
            height = desiredHeight;
        }
    } else if (desiredHeight > currentHeight) {
        height = currentHeight + shiftByPixels;
        
        if (desiredHeight < height) {
            height = desiredHeight;
        }
    }
    
    return height;
}

function getDesiredHeight(index, selectedIndex) {
    if (index == selectedIndex - 1) {
        return desiredHeight;
    } else {
        return minimumHeight;
    }
}


function overBookingPanel(panelId) {
    var panel = $('booking-panel-' + panelId + '-button');
    if (!panel.className.endsWith('button-active')) {
        panel.className = panel.className + '-hover';
    }    
}


function outBookingPanel(panelId) {

    var panel = $('booking-panel-' + panelId + '-button');
    if (!panel.className.endsWith('button-active')) {
        panel.className = panel.className.replace('-hover', '');
    }
    
}

/* Code to do mouse over for Australia Map */
function overMapButton(panelId) {
    panelId.className = 'map_Over';
}
function outMapButton(panelId) {
    panelId.className = 'map';
}
function mapOpener() {
    var path = pathOffWebRoot + 'Help/types-of-passes/maps/map-australia.aspx';
    window.open(path,null,'width=670,height=570');
}

/* Code to do mouse over for Commercial Button */
function overCommercialButton(panelId) {
    panelId.className = 'commercial-over';
}
function outCommercialButton(panelId) {
    panelId.className = 'commercial';
}

/* Code to do button for Service Link */
function overServiceButton(panelId) {
    panelId.className = 'service_Over';
}
function outServiceButton(panelId) {
    panelId.className = 'service';
}
function serviceUpdateOpener() {
var path = pathOffWebRoot + 'ServiceInformation/service-updates.aspx';
    window.location = path;
}


function loadBookingPanelImages() {

    var path = pathOffWebRoot + "App_Assets/images/";

    var img1  = new Image();
    var img2  = new Image();
    var img3  = new Image();
    var img4  = new Image();
    
    img1.src = path + "button-booking-engine-blue-hover.gif";
    img2.src = path + "button-booking-engine-red-hover.gif";
    img3.src = path + "button-booking-engine-green-hover.gif";
    img4.src = path + "button-booking-engine-orange-hover.gif";

}
/*

function getTopOffset(index, selectedIndex) {
    var preceedingElements = index - 1;
    var topOffset          = 0;
    
    if (index > selectedIndex) {
        preceedingElements -= 1;
        topOffset          += correctHeight;
    }
 
    topOffset += visibleHeight * preceedingElements;
    return topOffset;
}
*/

/*

function hidePanels() {
    $('container-body').getElementsByClassName('booking-panel-ticket-container').each(function(element) {
        animateBookingPanelUp(element, 0.001);
    });
}

function togglePanels(showId) {
    $('container-body').getElementsByClassName('booking-panel-ticket-container').each(function(element) {
        if (!element.id.endsWith(showId)) {
            //animateQueue.push(element.id);
            animateBookingPanelUp(element, 1);
        } else {
            animateBookingPanelDown(element, 1);
        }
    }); 
}

function toggleArrowUp(button) {
    button.className = button.className.replace("-down", "");
}

function toggleArrowDown(button) {
    if (!button.className.endsWith("-down")) {
        button.className = button.className + "-down";
    }
}

function animateBookingPanelDown(bookingPanel, duration) {
    var endPoint = -2;
    
    toggleArrowDown(getButton(bookingPanel));

    function slideDown() {
        if (animateQueue.length == 0) {
        
            // If menu is down, stop animating.  
            if (parseInt(bookingPanel.style.marginTop) == endPoint) {
                clearInterval(bookingPanel.interval);
                
                // Redraw content being displaced by Netscape and IE 6 so these elements get correctly positioned.
                if (navigator.userAgent.indexOf('Netscape') > -1|| navigator.userAgent.indexOf('Netscape')) {
                    $('container-body-corner-bottomleft').style.position = "relative";
                    $('container-body-corner-bottomleft').style.position = "absolute";
                    
                    $('container-body-corner-bottomright').style.position = "relative";
                    $('container-body-corner-bottomright').style.position = "absolute";   
                
                    $('container-booking-panel-content-bottomright').style.position        = "relative";
                    $('container-booking-panel-content-bottomright').style.position        = "absolute";
                }
            
            } else {  
                $(bookingPanel.id).show(); 
                var step = animationGetStep(bookingPanel, duration);
                
                // If the next step would exceed the end point, adjust the step.
                if (parseInt(bookingPanel.style.marginTop) + step > endPoint) {
                    step = endPoint - parseInt(bookingPanel.style.marginTop);
                }
                
                bookingPanel.style.marginTop = (parseInt(bookingPanel.style.marginTop) + step) + "px";  
            }
        }
    }

    clearInterval(bookingPanel.interval);
    bookingPanel.interval = setInterval(slideDown, animationIntervalDelay);
}

function animateBookingPanelUp(bookingPanel, duration) {
    var endPoint = bookingPanel.getHeight(); 
       
    animationBookingPanelInitUp(bookingPanel);
    toggleArrowUp(getButton(bookingPanel));
    
    function slideUp() {  
    
        // If the menu is up, stop animating.
        if (parseInt(bookingPanel.style.marginTop) * -1 == endPoint) {
            clearInterval(bookingPanel.interval);       
            animateQueue = animateQueue.without(bookingPanel.id);
            $(bookingPanel.id).hide();
            
            if (navigator.userAgent.indexOf('Netscape') > -1|| navigator.userAgent.indexOf('Netscape')) {
                $('container-body-corner-bottomleft').style.position = "relative";
                $('container-body-corner-bottomleft').style.position = "absolute";
                
                $('container-body-corner-bottomright').style.position = "relative";
                $('container-body-corner-bottomright').style.position = "absolute";
            } 
            
        } else {     
            var step = animationGetStep(bookingPanel, duration);
            
            // If the next step would exceed the end point, adjust the step.
            if ((parseInt(bookingPanel.style.marginTop) - step) * -1 > endPoint) {
                step = step - (((parseInt(bookingPanel.style.marginTop) - step) * -1) - endPoint);
            }
          
            bookingPanel.style.marginTop = (parseInt(bookingPanel.style.marginTop) - step) + "px";    
            
            
        }  
    }

    clearInterval(bookingPanel.interval);
    bookingPanel.interval = setInterval(slideUp, animationIntervalDelay);
}

function animationBookingPanelInitUp(bookingPanel) {
    if (bookingPanel.effectInit == null) { 
        $(bookingPanel.id + "EffectWrapper").show();
    
        // Do this so it doesn't flicker as we adjust heights and so forth.
        bookingPanel.originalMarginLeft = bookingPanel.style.marginLeft;
        bookingPanel.style.marginLeft   = "-3000px";
             
        bookingPanel.style.marginTop  = "0px";
        bookingPanel.style.marginLeft = bookingPanel.originalMarginLeft;
         
        bookingPanel.effectInit = true;
    }
}

function getButton(element) {
    var type   = element.id.substr(element.id.indexOf("cBookingEngine") + 14, element.id.length);
    var button = $('booking-panel-ticket-container-button-' + type);
    
    return button;
}

*/

//-->