﻿// JScript File
function calcSquareFootage(ctrlSquareFoot)
{
    if (ctrlSquareFoot.value != '')
    {
        var squareFeetRequested;
        var cartonsNeeded;
        var squareFeetCoverage;
        
        squareFeetCoverage = document.getElementById("ctl00_ContentPlaceHolder1_txtSquareFeetPerCarton").value;
        squareFeetRequested = ctrlSquareFoot.value;
        
        cartonsNeeded = Math.ceil(RoundToTwo(squareFeetRequested/squareFeetCoverage));
	
  
        //Now We need to Fill in the Cartons needed Box
        document.getElementById("ctl00_ContentPlaceHolder1_txtCartons").value = cartonsNeeded;
        
        
        //alert(ctrlSquareFootCoverage);
       
    }

}
    
function RoundToTwo(nStr)
{
	var n=parseFloat(nStr);
	nStr=n.toFixed(2);
	return nStr;
}

function ShowDialog()
{					
	//Force reload in order to guarantee that the onload event handler of the dialog which configures it executes on every show.
	var oWnd = window.radopen(null, "DialogWindow");
	
	oWnd.SetUrl(oWnd.GetUrl());
}

function OnClientClose(radWindow)
{					
	//Another option for passing a callback value
	//Set the radWindow.Argument property in the dialog
	//And read it here --> var oValue = radWindow.Argument;										
	//Do cleanup if necessary
	document.getElementById('ctl00_ContentPlaceHolder1_Button1').click();
}	

 function onRequestStart(sender, arguments)    
 {   
   window.scroll(0,150); 
 }   
