﻿function ZoomImage( source, name, properties ) {
    myWindow = window.open( source, name, properties );
}

function Toggle( targetID ) {
	if ( document.getElementById ) {
		target = document.getElementById( targetID );
		if ( target.style.display == 'none' ) {
			target.style.display = '';
		}
		else {
			target.style.display = 'none';
		}
	}
}

function Swap( mainImage, newImage ) {
	document.images[mainImage].src = newImage;
}

function Clear( theText ) {
    if ( theText.value == theText.defaultValue ) {
         theText.value = "";
         theText.style.color = "#000";
     }
 }

function SubmitButton( theButton ) {
	if ( event.which || event.keyCode ) {
	    if ( (event.which == 13) || (event.keyCode == 13) ) {
	        document.getElementById( theButton ).click();
	        return false;
	    }
	} 
	else {
	    return true;
	}
}

function Calculate() {
    var length;
    var width;
    var depth;
    var volume;
    var linerLength;
    var linerWidth;
    var num1;
    var num2;
    var num3;
    var num4;

    length = document.getElementById( 'length' ).value;
    width = document.getElementById( 'width' ).value;
    depth = document.getElementById( 'depth' ).value;

    volume = length * width * depth * 7.5;
    document.getElementById( 'vol' ).value = volume;
    num1 = document.getElementById( 'length' ).value * 1;
    num2 = document.getElementById( 'depth' ).value * 1;
    num1 = num1 + 4;
    num2 = num2 * 2;
    linerLength = num1 + num2;
    document.getElementById( 'linLength' ).value = linerLength;
    num3 = document.getElementById( 'width' ).value * 1;
    num4 = document.getElementById( 'depth' ).value * 1;
    num3 = num3 + 4;  num4 = num4 * 2;
    linerWidth = num3 + num4;
    document.getElementById( 'linWidth' ).value = linerWidth;
    document.getElementById( 'pump' ).value = volume / 2;
}  

