function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function GetUnits(form) {
        var item, lengthunitsValue, widthunitsValue, depthunitsValue;
        	
        item = form.lengthunits.selectedIndex;
        L = form.length.value;
        lengthunitsValue = eval(form.lengthunits.options[item].value)
        if(isNaN(L) || L == 0){
        alert("Please input the LENGTH");
        document.Calculator.length.focus();
        return;}
        
	//Convert the length entered into metric
		//metres	        
			        if(lengthunitsValue == 1){
			        metriclength = L;}
		//yards
			         else if(lengthunitsValue == 2){
			         metriclength = (L*0.9144);}
		//feet
			         else if(lengthunitsValue == 3){
			         metriclength = (L*0.3048);
				   }
		//inches
			         else if(lengthunitsValue == 4){
			         metriclength = (L*0.0254);
				   }
										
        item = form.widthunits.selectedIndex;
        W = form.width.value;
        widthunitsValue = eval(form.widthunits.options[item].value)
        if(isNaN(W) || W == 0){
        alert("Please input the WIDTH");
        document.Calculator.width.focus();
        return;}

        
	//Convert the width entered into metric
		//metres	        
			        if(widthunitsValue == 5){
			        metricwidth = W;}
       //yards
			         if(widthunitsValue == 6){
			         metricwidth = W*0.9144;}
		//feet
			         if(widthunitsValue == 7){
			         metricwidth = W*0.3048;}
		//inches
			         if(widthunitsValue == 8 ){
			         metricwidth = W*0.0254;}

        item = form.depthunits.selectedIndex;
        D = form.depth.value;
        depthunitsValue = eval(form.depthunits.options[item].value)
        if(isNaN(D) || D == 0){
        alert("Please input the DEPTH");
        document.Calculator.depth.focus();
        return;}


	//Convert the depth entered into metric
		//metres	        
			        if(depthunitsValue == 9){
			        metricdepth = D;}
       //yards
			         if(depthunitsValue == 10){
			         metricdepth = D*0.9144;}
		//feet
			         if(depthunitsValue == 11){
			         metricdepth = D*0.3048;}
		//inches
			         if(depthunitsValue == 12){
			         metricdepth = D*0.0254;}
		//centimetres
			         if(depthunitsValue == 13){
			         metricdepth = D*0.01;}
		//millimetres
			         if(depthunitsValue == 14){
			         metricdepth = D*0.001;}
			         			         
			         			         
			         		//{alert(metriclength)}	         
			         		//{alert(metricwidth)}	         
			         		//{alert(metricdepth)}	         
			         		
		form.Volume.value = Math.round((metriclength*metricwidth*metricdepth)*10)/10 +" m3"

                  }

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}