﻿
var imageLinks
var productTabs
var origFeaturesHeight
var man1Savings
var man2Savings
var man3Savings
var man3Price
var productFlashVersion = 9

function pageInitSavings(){
    // Features Tabs
    // ------------------------------
    // 

if ($('revealSaving1')){man1Savings = $('revealSaving1').value; }
if ($('revealSaving2')){man2Savings = $('revealSaving2').value; }
if ($('revealSaving3')){man3Savings = $('revealSaving3').value; }

if ($('revealSavingCyl1')){man1CylSavings = $('revealSavingCyl1').value; }
if ($('revealSavingCyl2')){man2CylSavings = $('revealSavingCyl2').value; }
if ($('revealSavingCyl3')){man3CylSavings = $('revealSavingCyl3').value; }

if ($('revealSaving1')){
	man1Width = man1Savings * 1.4;
	man2Width = man2Savings * 1.4;
	man3Width = man3Savings * 1.4;
}

if ($('revealSavingCyl1')){
	man1CylWidth = man1CylSavings * 1.4;
	man2CylWidth = man2CylSavings * 1.4;
	man3CylWidth = man3CylSavings * 1.4;
}



    if ($('savingsRevealUp')) {
	
		document.getElementById('savingsRevealUp').style.display='block';
		// The following statements have if statements around them to check if there are competitors on the page
		if($('savingsRevealUp1')){document.getElementById('savingsRevealUp1').style.display='block';}
		if($('savingsRevealUp2')){document.getElementById('savingsRevealUp2').style.display='block';}
		if($('savingsRevealUp3')){document.getElementById('savingsRevealUp3').style.display='block';}
		document.getElementById('graphAxisUp').style.display='block';
		if($('savingsMan1Bar')){document.getElementById('savingsMan1Bar').style.width='0px';}
		if($('savingsMan2Bar')){document.getElementById('savingsMan2Bar').style.width='0px';}
		if($('savingsMan3Bar')){document.getElementById('savingsMan3Bar').style.width='0px';}

		if ($('savingsMan1Bar')) {
		   
		    new Effect.Morph('savingsMan1Bar', {
			
				style: 'background:#ee1122; width:'+man1Width+'px', // CSS Properties
				duration: 1.2, // Core Effect properties
				queue: {position: 'end', scope: 'upright'}
			});
		}
		if ($('savingsMan2Bar')) {		
			new Effect.Morph('savingsMan2Bar', {
				style: 'background:#ee1122; width:'+man2Width+'px', // CSS Properties
				duration: 1.2, // Core Effect properties
				queue: {position: 'end', scope: 'upright'}
			});
		}
		if($('savingsMan3Bar')){
			new Effect.Morph('savingsMan3Bar', {
				style: 'background:#ee1122; width:'+man3Width+'px', // CSS Properties
				duration: 1.2, // Core Effect properties
				queue: {position: 'end', scope: 'upright'}
			});
		}
		new Effect.Opacity('man1UpPrice', { from: 0, to: 1.0, duration: 1.2});
		new Effect.Opacity('man2UpPrice', { from: 0, to: 1.0, duration: 2.4});
		new Effect.Opacity('man3UpPrice', { from: 0, to: 1.0, duration: 3.6});
	}
	if($('savingsRevealCyl')){
		document.getElementById('savingsRevealCyl').style.display='block';
		if($('savingsRevealCyl1')){document.getElementById('savingsRevealCyl1').style.display='block';}
		if($('savingsRevealCyl2')){document.getElementById('savingsRevealCyl2').style.display='block';}
		if($('savingsRevealCyl3')){document.getElementById('savingsRevealCyl3').style.display='block';}
		document.getElementById('graphAxisCyl').style.display='block';
		if($('savingsMan1CylBar')){document.getElementById('savingsMan1CylBar').style.width='0px';}
		if($('savingsMan2CylBar')){document.getElementById('savingsMan2CylBar').style.width='0px';}
		if($('savingsMan3CylBar')){document.getElementById('savingsMan3CylBar').style.width='0px';}
		
		if($('savingsMan1CylBar')){
		    
			new Effect.Morph('savingsMan1CylBar', {
				style: 'background:#ee1122; width:'+man1CylWidth+'px', // CSS Properties
				duration: 1.2, // Core Effect properties
				queue: { position: 'end', scope: 'cyl' }
			});
		}
		if($('savingsMan2CylBar')){
			new Effect.Morph('savingsMan2CylBar', {
				style: 'background:#ee1122; width:'+man2CylWidth+'px', // CSS Properties
				duration: 1.2, // Core Effect properties
				queue: {position: 'end', scope: 'cyl'}
			});
		}
		if($('savingsMan3CylBar')){
			new Effect.Morph('savingsMan3CylBar', {
				style: 'background:#ee1122; width:'+man3CylWidth+'px', // CSS Properties
				duration: 1.2, // Core Effect properties
				queue: {position: 'end', scope: 'cyl'}
			});
		}
		new Effect.Opacity('man1Price', { from: 0, to: 1.0, duration: 1.2 });
		new Effect.Opacity('man2Price', { from: 0, to: 1.0, duration: 2.4 });
		new Effect.Opacity('man3Price', { from: 0, to: 1.0, duration: 3.6 });
		}
}

//Event.observe(window, "load", pageInitSavings);
document.observe("dom:loaded",function() { pageInitSavings();});
