
var imageLinks
var productTabs
var origFeaturesHeight
var man1Savings
var man2Savings
var man3Savings
var man3Price
var productFlashVersion = 9

function pageInit(){
    // Features Tabs
    // ------------------------------
    // 

	if ($('navTabs')){
//	    downloadLinks();
     
        // Dynamically set the height of the initial tab to stop the flicker when clicking on a link
        var tabHeight = $('tabsContent').offsetHeight;
        $('tabsDivContainer').style.height = tabHeight+'px';

        // If the features height hasn't been set then save the height of it - this is so that we can return
        // the features to the corerct height when closing it
        if (origFeaturesHeight == undefined){
            origFeaturesHeight = tabHeight;
        }

        productTabs = $('navTabs').getElementsByTagName("a");   
        
        if (productTabs.length>0){
           for (var i=0; i < productTabs.length; i++) {
           
                productTabs[i].onclick = function() {
                     $('tabsDivContainer').style.overflow = 'hidden';
                    // Reset the class on each of the tabs
                    for (var x=0; x < productTabs.length; x++) {
                        $(productTabs[x]).className = "";
                        this.className = "selected"; // Set the class of the selected tab to on
                    }    
                    var tabURL = this.getAttribute('rel'); // Url to display
                 
                    // Load Tab via AJAX

                    Effect.Fade('tabsContent', { duration: 0.2,afterFinish: function(){
																					 
																					 
                        new Ajax.Updater('tabsContent',tabURL,{onComplete: function(){
                            
                            Effect.Appear('tabsContent', { duration: 0.2, afterFinish:function(){
                                tabHeight = $('tabsContent').offsetHeight;

								new Effect.Morph('tabsDivContainer', {
                                  style: 'height:'+tabHeight+'px;', // CSS Properties
                                  duration: 0.2,
                                  afterFinish:function(){
                                    externalLinks();
                                    //pageInit();
                                  }
                                });

								
								
                             }});
                        }});
                    }});
                    return(false);
                }
            }
        }
	}
}

document.observe("dom:loaded",function() {pageInit();});
