/* BEGIN FUNCTION "CALCULATE TLL-16" */
function calculateTLL16()
{
X = document.calculator.brkrQty.value
Z = document.calculator.multiplier.value

X = Number(X)
Z = Number(Z)

if (Z <= 1 && Z > 0)
  {
 
	 if (X >= 1 && X <= 16)
        {
         Y = ((Math.round(X) * 38 + 370) * Z)
         document.calculator.totalPrice.value = ('$' + Y.toFixed(2))
        }

     else if(X > 16  && X <=32) 
        {
         alert("Breaker quantity is beyond the capacity of a TLL-16 Panel." + '\n' + "Try using a TLL-32 Panel.")
        }

     else if(X > 32) 
        {
         alert("Breaker quantity is beyond the capacity of either a TLL-16 or TLL-32 Panel.")
        }

     else
        {
         alert("Please Enter a Breaker Quantity")
        }
   
  }

else
   {
	 alert("Please enter a value for the multiplier which is less than or equal to '1'.")  
   }

}
/* END FUNCTION "CALCULATE TLL-16" */


/* BEGIN FUNCTION "CALCULATE TLL-32" */
function calculateTLL32()
{
X = document.calculator.brkrQty.value
Z = document.calculator.multiplier.value

X = Number(X)
Z = Number(Z)

if (Z <= 1 && Z > 0)
  {

     if (X > 16 && X <= 32) 
        {
         
		 Y = ((Math.round(X) * 38 + 404) * Z)
		 
		      if (Y < 1000)
			     {
                   document.calculator.totalPrice.value = ('$' + Y.toFixed(2))
				 }
			  
			  else if (Y >= 1000 && Y <= 1100)
			     {
				   document.calculator.totalPrice.value = ('$1,0' + (Y - 1000).toFixed(2))	 
				 }
			  
			  else
			     {
				   document.calculator.totalPrice.value = ('$1,' + (Y - 1000).toFixed(2))
				 }
		}

     
	 else if (X <= 16 && X >= 1) 
        {
          var C = confirm("The breaker quantity can be used with a TLL-16 Panel."  + '\n' + "Are you sure you want to use a TLL-32 Panel?");
	      
		  if (C==true)
           {
            
			Y = ((Math.round(X) * 38 + 404) * Z)
			
		      if (Y >= 1000)
			     {
                   document.calculator.totalPrice.value = ('$1,0' + (Y - 1000).toFixed(2))
				 }

			  
			  else
			     {
				   document.calculator.totalPrice.value = ('$' + Y.toFixed(2))
				 }			

           }
         
		 else
           {
            alert("Please Enter a Breaker Quantity")
           }
        
		}

     else if(X > 32) 
        {
         alert("Breaker quantity is beyond the capacity of a TLL-32 Panel.")
        }

     else 
        {
         alert("Please Enter a Breaker Quantity")
        }

   }

else
   {
	 alert("Please enter a value for the multiplier which is less than or equal to '1'.")  
   }


}
// END FUNCTION "CALCULATE TLL-32" 


// BEGIN FUNCTION "CLEARQTY"
function ClearQty(form)
{
form.brkrQty.value = "";
form.totalPrice.value = "$0.00";
}
// END FUNCTION "CLEARQTY"


// BEGIN FUNCTION "CLEARMULTIPLIER"
function ClearMultiplier(form)
{
form.multiplier.value = "1.0";
form.totalPrice.value = "$0.00";
}
// END FUNCTION "CLEARMULTIPLIER"
