function Calculate()
{
	var realSquareFoot = document.getElementById('SqFt').value;
	var realStories = document.getElementById('numStories').value;
	
	for (i = 0; i <= 2; i++){
		if (document.calcForm.pitch[i].checked == true)
			var realPitch = document.calcForm.pitch[i].value; 
	}
	
	//alert ("Pitch = " + realPitch);
	var calcSquareFoot;
	var calcQuoteLow;
	var calcQuoteHigh;
	var userFriendlyPitch;


	var medPitchLow = 2.0;
	var medPitchHigh = 3.0;
	var fltPitchLow = 3.0;
	var fltPitchHigh = 5.0;
	var stpPitchLow = 3.0;
	var stpPitchHigh = 5.0;



    if (realStories == '1') {
    	var realPct = realSquareFoot * .1;
    	calcSquareFoot = (+realSquareFoot) + (+realPct);
    	//alert ("Sqaure Footage + 10%: " + calcSquareFoot);

    }

     if (realStories == '2') {
	    calcSquareFoot = realSquareFoot / 2;
	   // alert("Square Footage / 2: " + calcSquareFoot);
    }

     if (realStories == '3') {
		    calcSquareFoot = realSquareFoot / 3;
		 //   alert("Square Footage / 3: " + calcSquareFoot);
	   }


	 if (realPitch == '1') {
	 	//flat roof
	 	calcSquareFoot = ((calcSquareFoot * .10) + (+calcSquareFoot));
	 	calcQuoteLow = calcSquareFoot * fltPitchLow;
	 	calcQuoteHigh = calcSquareFoot * fltPitchHigh;
	 	userFriendlyPitch = "Flat Roof";
	 	//alert("Adding 10% to sqft of one floor: " + calcSquareFoot);
	 	//alert("Flat Roof Pricing: 3.00 - 5.00");
	 	//alert ("low is:" + calcQuoteLow + "    High is: " + calcQuoteHigh);
	 	
	 	
	 }


	 if (realPitch == '2') {
	 	 //medium, walkable roof
	 	 calcSquareFoot = ((calcSquareFoot * .47) + (+calcSquareFoot));
	 	 calcQuoteLow = calcSquareFoot * medPitchLow;
	 	 calcQuoteHigh = calcSquareFoot * medPitchHigh;
	 	 userFriendlyPitch = "Medium - Walkable Roof";
	 	 //alert("Adding 30% to sqft of one floor: " + calcSquareFoot);
	 	 //alert("Flat Roof Pricing: 2.00 - 3.00");
	 	 //alert ("low is: " + calcQuoteLow + "    High is: " + calcQuoteHigh);

	 }

	  if (realPitch == '3') {
	 	 //steep roof
	 	 calcSquareFoot = ((calcSquareFoot * .63) + (+calcSquareFoot));
	 	 calcQuoteLow = calcSquareFoot * stpPitchLow;
	 	 calcQuoteHigh = calcSquareFoot * stpPitchHigh;
	  	 userFriendlyPitch = "Steep Roof";
	  	 //alert("Adding 40% to sqft of one floor: " + calcSquareFoot);
	 	 //alert("Flat Roof Pricing: 3.00 - 5.00");
	 	 //alert ("low is: " + calcQuoteLow + "    High is: " + calcQuoteHigh);

	 }

	/*Round and write the numbers to hidden form elements*/
	document.calcForm.lowQuote.value = (Math.round(calcQuoteLow*100)/100);
	document.calcForm.hghQuote.value = (Math.round(calcQuoteHigh*100)/100);
	document.calcForm.quote.value = "$" + (document.calcForm.lowQuote.value) + " -  $" 
		+ (document.calcForm.hghQuote.value) ;
	document.calcForm.stories.value = realStories;
	document.calcForm.roofPitch.value = userFriendlyPitch;
	document.calcForm.squareFootage.value = realSquareFoot;
	
}

