// JavaScript Document

//from index.php
function SoftFlooringCalculator(theDiv, style,costSF,costERSF1,costERSF2,costSW,costSC,costESC,costST,costSR,costJRSF2,costJRSF2by1,costJRSF1mby1m,costJRSF4,costPL1310,costPL1311,costSM,costSR2,costSBN1,costSBN2,costSBW){
	
		if(style=='1A' || style=='1a'){
		var html = '<div id="form1A" height="40px" style="position:relative; padding:0; margin:0;"><img src="http://www.alessco.com/images/CalcLayout1A.png"/>';
		html+= '<div style="position:absolute; top:10px; left:309px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px;  border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
		html+= '<div style="position:absolute; top:10px; left:349px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px;  border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
		html+= '<div style="position:absolute; top:10px; left:408px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px;  border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
		html+= '<div style="position:absolute; top:10px; left:448px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px;  border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
		html+= '<div style="position:absolute; top:4px; left:484px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/SoftFlooringCalculatorGo.png" value="Submit" onMouseOver="goButtonOver(this);" onMouseOut="goButtonOut(this);" onClick="newWindow(\'1A\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+');" tabindex="5"></div>';
		html+= '</div>';
		}
		
		else if(style=='1B' || style=='1b'){	
		var html = '<div id="form1B" height="40px" style="position:relative; padding:0; margin:0;"><img src="http://www.alessco.com/images/CalcLayout1B.png"/>';
		html+= '<div style="position:absolute; top:10px; left:309px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px;  border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
		html+= '<div style="position:absolute; top:10px; left:349px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px;  border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
		html+= '<div style="position:absolute; top:10px; left:408px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px;  border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
		html+= '<div style="position:absolute; top:10px; left:448px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px;  border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
		html+= '<div style="position:absolute; top: 4px; left:484px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/SoftFlooringCalculatorGo.png" value="Submit" onMouseOver="goButtonOver(this);" onMouseOut="goButtonOut(this);" onClick="newWindow(\'1B\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+');" tabindex="5"></div>';
		html+= '</div>';
		}
		
		else if(style=='2A' || style=='2a'){
		var html = '<div id="form2A" height="59px" style="position:relative; padding:0; margin:0;"><img src="http://www.alessco.com/images/CalcLayout2A.png"/>';
		html+= '<div style="position:absolute; top:30px; left: 39px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
		html+= '<div style="position:absolute; top:30px; left: 79px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
		html+= '<div style="position:absolute; top:30px; left:138px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
		html+= '<div style="position:absolute; top:30px; left:178px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
		html+= '<div style="position:absolute; top:24px; left:230px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/SoftFlooringCalculatorGo.png" value="Submit" onMouseOver="goButtonOver(this);" onMouseOut="goButtonOut(this);" onClick="newWindow(\'2A\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+');" tabindex="5"></div>';
		html+= '</div>';
		}
		
		else if(style=='2B' || style=='2b'){
		var html = '<div id="form2A" height="59px" style="position:relative; padding:0; margin:0;"><img src="http://www.alessco.com/images/CalcLayout2B.png"/>';
		html+= '<div style="position:absolute; top:30px; left: 39px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
		html+= '<div style="position:absolute; top:30px; left: 79px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
		html+= '<div style="position:absolute; top:30px; left:138px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
		html+= '<div style="position:absolute; top:30px; left:178px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
		html+= '<div style="position:absolute; top:24px; left:230px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/SoftFlooringCalculatorGo.png" value="Submit" onMouseOver="goButtonOver(this);" onMouseOut="goButtonOut(this);" onClick="newWindow(\'2B\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+');" tabindex="5"></div>';
		html+= '</div>';
		}
		
		else if(style=='3A' || style=='3a'){
		var html = '<div id="form3A" height="136px" style="position:relative; padding:0; margin:0;"><img src="http://www.alessco.com/images/CalcLayout3A.png"/>';
		html+= '<div style="position:absolute; top: 78px; left:15px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
		html+= '<div style="position:absolute; top: 78px; left:53px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
		html+= '<div style="position:absolute; top:103px; left:15px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
		html+= '<div style="position:absolute; top:103px; left:53px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
		html+= '<div style="position:absolute; top: 97px; left:88px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/SoftFlooringCalculatorGo.png" value="Submit" onMouseOver="goButtonOver(this);" onMouseOut="goButtonOut(this);" onClick="newWindow(\'3A\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+');" tabindex="5"></div>';
		html+= '</div>';
		}
		
		else if(style=='3B' || style=='3b'){
		var html = '<div id="form3B" height="136px" style="position:relative; padding:0; margin:0;"><img src="http://www.alessco.com/images/CalcLayout3B.png"/>';
		html+= '<div style="position:absolute; top: 78px; left:15px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
		html+= '<div style="position:absolute; top: 78px; left:53px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
		html+= '<div style="position:absolute; top:103px; left:15px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
		html+= '<div style="position:absolute; top:103px; left:53px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
		html+= '<div style="position:absolute; top: 97px; left:88px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/SoftFlooringCalculatorGo.png" value="Submit" onMouseOver="goButtonOver(this);" onMouseOut="goButtonOut(this);" onClick="newWindow(\'3A\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+');" tabindex="5"></div>';
		html+= '</div>';
		}
		
		else if(style=='4A' || style=='4a'){
		var html = '<div id="form4A" height="154px" style="position:relative; padding:0; margin:0;"><img src="http://www.alessco.com/images/CalcLayout4A.png"/>';
		html+= '<div style="position:absolute; top: 87px; left:24px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
		html+= '<div style="position:absolute; top: 87px; left:62px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
		html+= '<div style="position:absolute; top:112px; left:24px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
		html+= '<div style="position:absolute; top:112px; left:62px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
		html+= '<div style="position:absolute; top:106px; left:97px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/SoftFlooringCalculatorGo.png" value="Submit" onMouseOver="goButtonOver(this);" onMouseOut="goButtonOut(this);" onClick="newWindow(\'4A\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+');" tabindex="5"></div>';
		html+= '</div>';
		}
		
		else if(style=='4B' || style=='4b'){
		var html = '<div id="form4B" height="154px" style="position:relative; padding:0; margin:0;"><img src="http://www.alessco.com/images/CalcLayout4B.png"/>';
		html+= '<div style="position:absolute; top: 87px; left:24px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
		html+= '<div style="position:absolute; top: 87px; left:62px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
		html+= '<div style="position:absolute; top:112px; left:24px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
		html+= '<div style="position:absolute; top:112px; left:62px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
		html+= '<div style="position:absolute; top:168px; left:46px; line-height:16px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/SoftFlooringCalculatorGo.png" value="Submit" onMouseOver="goButtonOver(this);" onMouseOut="goButtonOut(this);" onClick="newWindow(\'4B\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+');" tabindex="5"></div>';
		html+= '</div>';
		}
		
		else if(style=='5A'){
			var html ='<div id="form" style="padding: 4px 0px 0px 0px;">';
				html+='<table class="calculatorInput" border="0" cellpadding="0" cellspacing="0">';
					html+='<tr>';
						html+='<td style="padding: 0px 15px 2px 0px;" width="499px" >';
							html+='<img name="image1" src="http://www.alessco.com/images/SoftFloorsCalculator.png" ></td>';
						html+='<td style="border:1px solid white; padding: 6px 0px 0px 5px; background: url( http://www.alessco.com/images/Calculator01.png) no-repeat;" width="46" height="35" valign="top">';
							html+='<input class="dim" id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1"></td>';
					   html+=' <td style="padding: 6px 0px 0px 5px; background: url(http://www.alessco.com/images/Calculator02.png) no-repeat;" width="62" height="35" valign="top">';
						  html+='  <input class="dim" id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2"></td>';
						html+='<td style="padding: 6px 0px 0px 5px; background: url(http://www.alessco.com/images/Calculator03.png) no-repeat;" width="46" height="35" valign="top">';
							html+='<input class="dim" id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3"></td>';
					   html+=' <td style="padding: 6px 0px 0px 5px; background: url(http://www.alessco.com/images/Calculator04.png) no-repeat;" width="51" height="35" valign="top">';
						   html+=' <input class="dim" id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4"></td>';
					  html+='  <td>';
						   html+=' <input id="goButton" type="image" src="http://www.alessco.com/images/CalculatorGo.png" value="Submit" onMouseOver="goButtonBlue(this);" onMouseOut="goButtonGrey(this);" onClick="newWindow(\'5A\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+');" tabindex="5">        </td>';
					html+='</tr>';
					 html+='<tr>';           
					 html+='<td style="padding: 0px 0px 0px 0px;" colspan="11">';
					 html+='<a href="http://www.alessco.com/OrderForm"><img border="0" id="buttonLink1" src="http://www.alessco.com/images/buttonOrderHere.gif" onMouseOver="orderHereButtonBlue(\'1\');" onMouseOut="orderHereButtonGrey(\'1\');" /></a>';
					 html+='</td>';
					html+=' </tr>';
				html+='</table>';
			html+='</div>';
			}
			else if(style=='5B'){
			var html ='<div id="form" style="padding: 4px 0px 0px 0px;"  >';
				html+='<table class="calculatorInput" border="0" cellpadding="0" cellspacing="0">';
					html+='<tr>';
						html+='<td style="padding: 0px 15px 2px 0px;" width="499">';
							html+='<img name="image1" src="http://www.alessco.com/dealers/images/SoftFloorsCalculator.png" border="0"></td>';
						html+='<td style="padding: 6px 0px 0px 5px; background: url( http://www.alessco.com/images/Calculator01.png) no-repeat;" width="46" height="35" valign="top">';
							html+='<input class="dim" style="font-size: 16px; color: #6e6e6e;" id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1"></td>';
					   html+=' <td style="padding: 6px 0px 0px 5px; background: url(http://www.alessco.com/images/Calculator02.png) no-repeat;" width="62" height="35" valign="top">';
						  html+='  <input class="dim" style="font-size: 16px; color: #6e6e6e;" id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2"></td>';
						html+='<td style="padding: 6px 0px 0px 5px; background: url(http://www.alessco.com/images/Calculator03.png) no-repeat;" width="46" height="35" valign="top">';
							html+='<input class="dim" style="font-size: 16px; color: #6e6e6e;" id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3"></td>';
					   html+=' <td style="padding: 6px 0px 0px 5px; background: url(http://www.alessco.com/images/Calculator04.png) no-repeat;" width="51" height="35" valign="top">';
						   html+=' <input class="dim" style="font-size: 16px; color: #6e6e6e;" id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4"></td>';
					  html+='  <td>';
						   html+=' <input id="goButton" type="image" src="http://www.alessco.com/images/CalculatorGo.png" value="Submit" onMouseOver="goButtonBlue(this);" onMouseOut="goButtonGrey(this);" onClick="newWindow(\'5B\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+');" tabindex="5">        </td>';
					html+='</tr>';
				html+='</table>';
			html+='</div>';
			}
		else if(style=='5C'){
				var html ='<div id="form" style="padding: 4px 0px 0px 0px;">';
				html+='<table class="calculatorInput" border="0" cellpadding="0" cellspacing="0">';
					html+='<tr>';
						html+='<td style="padding: 0px 15px 2px 32px;" width="499">';
							html+='<img name="image1" src="http://www.alessco.com/images/SoftFloorsCalculator.png" border="0">        </td>';
						html+='<td style="padding: 6px 0px 0px 5px; background: url( http://www.alessco.com/images/Calculator01.png) no-repeat;" width="46" height="35" valign="top">';
							html+='<input class="dim" id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1">        </td>';
					   html+=' <td style="padding: 6px 0px 0px 5px; background: url(http://www.alessco.com/images/Calculator02.png) no-repeat;" width="62" height="35" valign="top">';
						  html+='  <input class="dim" id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2">        </td>';
						html+='<td style="padding: 6px 0px 0px 5px; background: url(http://www.alessco.com/images/Calculator03.png) no-repeat;" width="46" height="35" valign="top">';
							html+='<input class="dim" id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3">        </td>';
					   html+=' <td style="padding: 6px 0px 0px 5px; background: url(http://www.alessco.com/images/Calculator04.png) no-repeat;" width="51" height="35" valign="top">';
						   html+=' <input class="dim" id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4">        </td>';
					  html+='  <td>';
						   html+=' <input id="goButton" type="image" src="http://www.alessco.com/images/CalculatorGo.png" value="Submit" onMouseOver="goButtonBlue(this);" onMouseOut="goButtonGrey(this);" onClick="newWindow(\'5A\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+');" tabindex="5">        </td>';
					html+='</tr>';
					 html+='<tr>';           
					 html+='<td style="padding: 24px 0px 0px 32px;" colspan="11">';
					 html+='<a href="http://www.softfloor.com/OrderForm"><img border="0" id="buttonLink1" src="http://www.alessco.com/images/buttonOrderHere.gif" onMouseOver="orderHereButtonBlue(\'1\');" onMouseOut="orderHereButtonGrey(\'1\');" /></a>';
					 html+='</td>';
					html+=' </tr>';
				html+='</table>';
			html+='</div>';
			}	
		else if(style=='5D' || style=='5d'){		
				var html = '<div id="form" height="33px" style="position:absolute; padding:5px 0px 0px 0px; margin:0; left:41px;"><img src="http://www.alessco.com/images/CalcLayout5A.jpg"/>';
				html+= '<div style="position:absolute; top:10px; left:665px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:30px;  border: 0px; font-size: 16px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
				html+= '<div style="position:absolute; top: 9px; left:712px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:30px;  border: 0px; font-size: 16px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
				html+= '<div style="position:absolute; top: 9px; left:777px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:30px;  border: 0px; font-size: 16px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
				html+= '<div style="position:absolute; top: 9px; left:823px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:30px;  border: 0px; font-size: 16px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
				html+= '<div style="position:absolute; top: 3px; left:872px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/CalculatorGo.png" value="Submit" onMouseOver="goButtonBlue(this);" onMouseOut="goButtonGrey(this);" onClick="newWindow(\'5D\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+');" tabindex="5"></div>';
				html+= '<div align="center" style="padding: 5px 0px 0px 0px;">';
				html+= '<a href="http://www.alessco.com/OrderForm"><img border="0" id="buttonLink1" src="http://www.alessco.com/images/buttonOrderHere.gif" onMouseOver="orderHereButtonBlue(\'1\');" onMouseOut="orderHereButtonGrey(\'1\');" /></a>';
				html+= '</div>';
				html+= '</div>';
		}
		else if(style=='5E' || style=='5e'){		
				var html = '<div id="form" height="33px" style="position:absolute; padding:5px 0px 0px 0px; margin:0; left:41px;"><img src="http://www.alessco.com/images/CalcLayout5A.jpg"/>';
				html+= '<div style="position:absolute; top:10px; left:665px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:30px;  border: 0px; font-size: 16px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
				html+= '<div style="position:absolute; top: 9px; left:712px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:30px;  border: 0px; font-size: 16px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
				html+= '<div style="position:absolute; top: 9px; left:777px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:30px;  border: 0px; font-size: 16px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
				html+= '<div style="position:absolute; top: 9px; left:823px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:30px;  border: 0px; font-size: 16px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
				html+= '<div style="position:absolute; top: 3px; left:872px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/CalculatorGo.png" value="Submit" onMouseOver="goButtonBlue(this);" onMouseOut="goButtonGrey(this);" onClick="newWindow(\'5D\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+');" tabindex="5"></div>';
				html+= '<div align="center" style="padding: 24px 0px 0px 0px;">';
				html+= '<a href="http://www.softfloor.com/OrderForm"><img border="0" id="buttonLink1" src="http://www.alessco.com/images/buttonOrderHere.gif" onMouseOver="orderHereButtonBlue(\'1\');" onMouseOut="orderHereButtonGrey(\'1\');" /></a>';
				html+= '</div>';
				html+= '</div>';
		}
			else if(style=='dorm'){
			var html ='<div id="form" style="width: 284px; height: 30px;">';
                html+='<div style="position: absolute; left: 9px; top: 5px;"><input class="dim" style="font-size: 16px; color: #6e6e6e;" id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1"></div>';
                html+='<div style="position: absolute; left: 60px; top: 5px;"><input class="dim" style="font-size: 16px; color: #6e6e6e;" id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2"></div>';
                html+='<div style="position: absolute; left: 127px; top: 5px;"><input class="dim" style="font-size: 16px; color: #6e6e6e;" id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3"></div>';
                html+='<div style="position: absolute; left: 178px; top: 5px;"><input class="dim" style="font-size: 16px; color: #6e6e6e;" id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4"></div>';
                html+='<div style="position: absolute; left: 229px; top: 0px;"><input id="goButton" type="image" src="http://www.alessco.com/images/CalculatorGo.png" value="Submit" onMouseOver="goButtonBlue(this);" onMouseOut="goButtonGrey(this);" onClick="newWindow(\'5B\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+');" tabindex="5"></div>';
			html+='</div>';
			}

		document.getElementById(theDiv).innerHTML = html;
}





function creatediv(id){
		var newdiv = document.createElement('div');
		newdiv.setAttribute('id', id);
		newdiv.style.visibility = "hidden";
		newdiv.style.height="0px";
		document.body.appendChild(newdiv);
}




var allHTMLTags = new Array();




function getElementByClass(theClass){
		
		//Create Array of All HTML Tags
		var allHTMLTags=myWindow.document.getElementsByTagName("*");

		//Loop through all tags using a for loop
		for (i=0; i<allHTMLTags.length; i++) {

				//Get all tags with the specified class name.
				if (allHTMLTags[i].className==theClass)
				{
					allHTMLTags[i].style.fontSize='16px';
					allHTMLTags[i].style.fontFamily='"Arial Narrow", Arial, Helvetica';
							if(theClass=='popTextRed'){
								allHTMLTags[i].style.color='#990000';
								allHTMLTags[i].style.fontWeight='bold';
							}
							else if(theClass=='popTextBlack'){
								allHTMLTags[i].style.color='#000';
							}
							else if(theClass=='rightSide'){
								allHTMLTags[i].style.width = '130px';
								allHTMLTags[i].style.position = 'absolute';
								allHTMLTags[i].style.height = '14px';
							}
							else if(theClass=='leftSide'){
								allHTMLTags[i].style.position = 'relative';
								allHTMLTags[i].style.left = '109px';
								allHTMLTags[i].style.width = '320px';
							}
				}
		}
}






function resultsTest(costSF,costERSF1,costERSF2,costSW,costSC,costESC,costST,costSR,costJRSF2,costJRSF2by1,costJRSF1mby1m,costJRSF4,costPL1310,costPL1311,costSM,costSR2,costSBN1,costSBN2,costSBW){

////////////////
	creatediv("total1");
	creatediv('cost1');
	creatediv('total1w');
	creatediv('cost1w');
	
	creatediv('borderArea');
	creatediv('insideArea');
	creatediv('borderWall');
	creatediv('insideWall');
	
	creatediv('lenghtArea');
	creatediv('widthArea');
	creatediv('lenghtWall');
	creatediv('widthWall');
	
	creatediv('total2');
	creatediv('cost2');
	creatediv('total2w');
	creatediv('cost2w');
	
	creatediv('total3');
	creatediv('cost3');
	creatediv('total3w');
	creatediv('cost3w');
	
	creatediv('total4');
	creatediv('cost4');
	creatediv('total4w');
	creatediv('cost4w');
	creatediv('lenghtPLArea');
	creatediv('widthPLArea');
	creatediv('lenghtPLWall');
	creatediv('widthPLWall');
	
	creatediv('total5');
	creatediv('cost5');
	creatediv('total5w');
	creatediv('cost5w');
	
	creatediv('total6');
	creatediv('cost6');
	creatediv('total6w');
	creatediv('cost6w');
	
	creatediv('total7');
	creatediv('cost7');
	creatediv('total7w');
	creatediv('cost7w');
	
	creatediv('total8');
	creatediv('cost8');
	creatediv('total8w');
	creatediv('cost8w');
	
	creatediv('total9');
	creatediv('cost9');
	creatediv('total9w');
	creatediv('cost9w');

	creatediv('total19');
	creatediv('cost19');
	creatediv('total19w');
	creatediv('cost19w');
	
	creatediv('total10');
	creatediv('cost10');
	creatediv('total10w');
	creatediv('cost10w');
	
	creatediv('total11');
	creatediv('cost11');
	creatediv('total11w');
	creatediv('cost11w');
	
	creatediv('total12');
	creatediv('cost12');
	creatediv('total12w');
	creatediv('cost12w');
	creatediv('lenght1mby1mArea');
	creatediv('width1mby1mArea');
	creatediv('lenght1mby1mWall');
	creatediv('width1mby1mWall');
	
	creatediv('total13');
	creatediv('cost13');
	creatediv('total13w');
	creatediv('cost13w');
	creatediv('lenght4by4Area');
	creatediv('width4by4Area');
	creatediv('lenght4by4Wall');
	creatediv('width4by4Wall');
	
	creatediv('totalSM');
	
	creatediv('totalSBN1');
	creatediv('totalSBN2');
	creatediv('totalSBW');
	
	creatediv('calSM');
	creatediv('wyniki');
	creatediv('boxes');

	
	countPieces('alesscoLenghtFeet','alesscoLenghtInches','alesscoWidthFeet','alesscoWidthInches',costSF,costERSF1,costERSF2,costSW,costSC,costESC,costST,costSR,costJRSF2,costJRSF2by1,costJRSF1mby1m,costJRSF4,costPL1310,costPL1311,costSM,costSR2,costSBN1,costSBN2,costSBW);
        //SF
        var total1 = document.getElementById('total1');
        var total1w = document.getElementById('total1w');
        var cost1 = document.getElementById('cost1');
        var cost1w = document.getElementById('cost1w');
        //SC
        var total6 = document.getElementById('total6');
        var total6w = document.getElementById('total6w');
        var cost6 = document.getElementById('cost6');
        var cost6w = document.getElementById('cost6w');
        //SW
        var total5 = document.getElementById('total5');
        var total5w = document.getElementById('total5w');
        var cost5 = document.getElementById('cost5');
        var cost5w = document.getElementById('cost5w');
        //ERSF
        var total2 = document.getElementById('total2');
        var total2w = document.getElementById('total2w');
        var cost2 = document.getElementById('cost2');
        var cost2w = document.getElementById('cost2w');
        //ERSF1
        var total3 = document.getElementById('total3');
        var total3w = document.getElementById('total3w');
        var cost3 = document.getElementById('cost3');
        var cost3w = document.getElementById('cost3w');
        //ESC
        var total7 = document.getElementById('total7');
        var total7w = document.getElementById('total7w');
        var cost7 = document.getElementById('cost7');
        var cost7w = document.getElementById('cost7w');
        //ST
        var total8 = document.getElementById('total8');
        var total8w = document.getElementById('total8w');
        var cost8 = document.getElementById('cost8');
        var cost8w = document.getElementById('cost8w');
        //SR
        var total9 = document.getElementById('total9');
        var total9w = document.getElementById('total9w');
        var cost9 = document.getElementById('cost9');
        var cost9w = document.getElementById('cost9w');
        //SR 3/8"
        var total19 = document.getElementById('total19');
        var total19w = document.getElementById('total19w');
        var cost19 = document.getElementById('cost19');
        var cost19w = document.getElementById('cost19w');
        //JRSF7
        var total10 = document.getElementById('total10');
        var total10w = document.getElementById('total10w');
        var cost10 = document.getElementById('cost10');
        var cost10w = document.getElementById('cost10w');
        //JRSF2
        var total11 = document.getElementById('total11');
        var total11w = document.getElementById('total11w');
        var cost11 = document.getElementById('cost11');
        var cost11w = document.getElementById('cost11w');
        //JRSF1
        var total12 = document.getElementById('total12');
        var total12w = document.getElementById('total12w');
        var cost12 = document.getElementById('cost12');
        var cost12w = document.getElementById('cost12w');
        //JRSF4
        var total13 = document.getElementById('total13');
        var total13w = document.getElementById('total13w');
        var cost13 = document.getElementById('cost13');
        var cost13w = document.getElementById('cost13w');
        //PL
		var total4 = document.getElementById('total4');
        var total4w = document.getElementById('total4w');
        var cost4 = document.getElementById('cost4');
        var cost4w = document.getElementById('cost4w');
		
		//SM
		var totalSM = document.getElementById('totalSM');

		//SB
		var totalSBN1 = document.getElementById('totalSBN1');
		var totalSBN2 = document.getElementById('totalSBN2');
		var totalSBW = document.getElementById('totalSBW');

		////////////////
		var html='<div style="margin-bottom:36px; "><img id="closeButton" onMouseOver="closeBlue(this);" OnMouseOut="closeGrey(this);" name="close" src="http://www.alessco.com/images/closeButton.png" border="0" onClick="javascript:window.close(self);" /></div>';
		html+='<div style="margin-bottom:66px; margin-left:-5px;"><img id="mainTitleImage" src="http://www.alessco.com/images/CalculatorTitle_0_Over.jpg" onMouseOver="this.src=\'http://www.alessco.com/images/CalculatorTitle_0.jpg\'" onMouseOut="this.src=\'http://www.alessco.com/images/CalculatorTitle_0_Over.jpg\'" border="0" /></div>';
		
		html+= countBoxes('total1', 'total1w', '25', '0.64', '1.28', '32', '26', '26', '16', 'cost1', 'cost1w', '4', '50px', '2', '5/8',costSF/4, 'SoftFloors', '0', '1');
		html+= countBoxes('total1', 'total1w', '16', '0.50', '1.28', '22', '26', '26', '8', 'cost1', 'cost1w', '4', '50px', '2', '1/2',costSF/4, 'SoftTouch', '0', '18');
		html+= countBoxes('total2', 'total2w', '25', '0.50', '9.92', '23', '26', '26', '12', 'cost2', 'cost2w', '4', '139px', '2', '1/2', costERSF1/4, 'Economy Reversible SoftFloors', '1','2');
		html+= countBoxes('total5', 'total5w', '25', '0.64', '1.28', '32', '26', '26', '16', 'cost5', 'cost5w', '4', '413px', '2', '5/8',costSW/4, 'SoftWoods', '1','5');
		html+= countBoxes('total6', 'total6w', '25', '0.64', '1.76', '44', '26', '26', '16', 'cost6', 'cost6w', '4', '504px', '2', '5/8', costSC/4, 'SoftCarpets', '1','6' );
		html+= countBoxes('total7', 'total7w', '25', '0.64', '1.76', '44', '27', '27', '16', 'cost7', 'cost7w', '4', '596px', '2', '5/8', costESC/4, 'Economy SoftCarpets', '1','7');
		html+= countBoxes('total9', 'total9w', '12', '0.92', '4.50', '54', '27', '27', '11', 'cost9', 'cost9w', '4', '776px', '2', '3/4', costSR/4, 'SoftRubber', '1','9');
		html+= countBoxes('total19', 'total19w', '18', '0.50', '3.17', '57', '27', '27', '9', 'cost19', 'cost19w', '4', '776px', '2', '3/8', costSR2/4, 'SoftRubber', '1','19');
		html+= countBoxes('total10', 'total10w', '25', '0.92', '1.88', '47', '26', '26', '23', 'cost10', 'cost10w', '4', '867px', '2', '7/8', costJRSF2/4, 'Jumbo Reversible SoftFloors', '1','10');
		html+= countBoxes('total11', 'total11w', '25', '1.04', '2.32', '58', '26', '26', '26', 'cost11', 'cost11w', '4', '956px', '2', '1', costJRSF2by1/4, 'Jumbo Reversible SoftFloors', '1','11');
		html+= countBoxes1('total12', 'total12w', '10', '0.90', '5.40', '54', '42', '41', '9', 'cost12', 'cost12w', '11.34', '1050px', '1m', '7/8', costJRSF1mby1m/11.34, 'Jumbo Reversible SoftFloors', '1','12');
		html+= countBoxes4('total13', 'total13w', '10', '1.10', '9', '90', '51', '50', '11', 'cost13', 'cost13w', '16', '1141px', '4', '1', costJRSF4/16, 'Jumbo Reversible SoftFloors', '1','13');
		//SM
		html+= countBoxesMats('1321px','14',costSM,'totalSM');
		//SB Narrow
		html+= countBoxesSBN1('1321px','15',costSBN1,'totalSBN1');
		html+= countBoxesSBN2('1321px','16',costSBN2,'totalSBN2');
		//SB Wide
		html+= countBoxesSBW('1321px','17',costSBW,'totalSBW');
		
		html+= countBoxes('total3', 'total3w', '25', '0.50', '0.92', '23', '26', '26', '12', 'cost3', 'cost3w', '4','229px', '2', '1/2', costERSF2/4, 'Economy Reversible SoftFloors', '1','3');
		//PL
		html+=playLearn('total4', 'total4w', '4', costPL1310, costPL1311);

		return html;

}

function results(id,costSF,costERSF1,costERSF2,costSW,costSC,costESC,costST,costSR,costJRSF2,costJRSF2by1,costJRSF1mby1m,costJRSF4,costPL1310,costPL1311,costSM,costSR2,costSBN1,costSBN2,costSBW){
	var text=/^\d+$/;
	var lF = document.getElementById('alesscoLenghtFeet').value;
	var lI = document.getElementById('alesscoLenghtInches').value;
	var wF =  document.getElementById('alesscoWidthFeet').value;
	var wI = document.getElementById('alesscoWidthInches').value;

if(text.test(lF)&&text.test(lI)&&text.test(wF)&&text.test(wI)){
	if(lF==0 || wF==0 || lI>=12 || wI>=12){
       alert('Please convert your dimensions to feet and inches');
       }else{ 
	document.getElementById(id).innerHTML = resultsTest(costSF,costERSF1,costERSF2,costSW,costSC,costESC,costST,costSR,costJRSF2,costJRSF2by1,costJRSF1mby1m,costJRSF4,costPL1310,costPL1311,costSM,costSR2,costSBN1,costSBN2,costSBW);
	   }
	
	}else alert('Please convert your dimensions to feet and inches');
	
	  
}

function newWindow(style,costSF,costERSF1,costERSF2,costSW,costSC,costESC,costST,costSR,costJRSF2,costJRSF2by1,costJRSF1mby1m,costJRSF4,costPL1310,costPL1311,costSM,costSR2,costSBN1,costSBN2,costSBW){

	
var text=/^\d+$/;
var lF = document.getElementById('alesscoLenghtFeet').value;
var lI = document.getElementById('alesscoLenghtInches').value;
var wF =  document.getElementById('alesscoWidthFeet').value;
var wI = document.getElementById('alesscoWidthInches').value;

if(text.test(lF)&&text.test(lI)&&text.test(wF)&&text.test(wI)){

       if(lF==0 || wF==0 || lI>=12 || wI>=12){
       alert('Please convert your dimensions to feet and inches');
       }else{                                                        	

myWindow=window.open('','','width=1000,height=800,scrollbars=yes');
var lenFeet = window.parent.document.getElementById('alesscoLenghtFeet').value;
var lenInches = window.parent.document.getElementById('alesscoLenghtInches').value;
var widFeet =  window.parent.document.getElementById('alesscoWidthFeet').value;
var widInches = window.parent.document.getElementById('alesscoWidthInches').value;


var html ='<html><head><title>SoftFlooring Calculator&trade;</title><link rel="stylesheet" href="http://www.alessco.com/cal/testStyle.css" type="text/css" /><script type="text/javascript" src="http://www.alessco.com/cal/js/SoftFlooringCalculator.js"></script></head><body style="padding:0 auto;">';
html += '<div id="newWindowBox" style="width:900px;"><div id="SoftFlooringCalculator" >';

if(style=='1A' || style=='1a'){
html+= '<div id="form1A" height="40px" style="position:relative; padding:0; margin:0;"><img src="http://www.alessco.com/images/CalcLayout1A.png"/>';
html+= '<div style="position:absolute; top:10px; left:309px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px;  border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
html+= '<div style="position:absolute; top:10px; left:349px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px;  border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
html+= '<div style="position:absolute; top:10px; left:408px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px;  border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
html+= '<div style="position:absolute; top:10px; left:448px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px;  border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
html+= '<div style="position:absolute; top:4px; left:484px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/SoftFlooringCalculatorGo.png" value="Submit" onMouseOver="goButtonOver(this);" onMouseOut="goButtonOut(this);" onClick="results(\'boxes\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+')" tabindex="5"></td>';
html+= '</div>';
}

else if(style=='1B' || style=='1b'){		
html+= '<div id="form1B" height="40px" style="position:relative; padding:0; margin:0;"><img src="http://www.alessco.com/images/CalcLayout1B.png"/>';
html+= '<div style="position:absolute; top:10px; left:309px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px;  border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
html+= '<div style="position:absolute; top:10px; left:349px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px;  border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
html+= '<div style="position:absolute; top:10px; left:408px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px;  border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
html+= '<div style="position:absolute; top:10px; left:448px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px;  border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
html+= '<div style="position:absolute; top: 4px; left:484px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/SoftFlooringCalculatorGo.png" value="Submit" onMouseOver="goButtonOver(this);" onMouseOut="goButtonOut(this);" onClick="results(\'boxes\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+')" tabindex="5"></td>';
html+= '</div>';
}

else if(style=='2A' || style=='2a'){
html+= '<div id="form2A" height="59px" style="position:relative; padding:0; margin:0;"><img src="http://www.alessco.com/images/CalcLayout2A.png"/>';
html+= '<div style="position:absolute; top:30px; left: 39px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
html+= '<div style="position:absolute; top:30px; left: 79px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
html+= '<div style="position:absolute; top:30px; left:138px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
html+= '<div style="position:absolute; top:30px; left:178px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
html+= '<div style="position:absolute; top:24px; left:230px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/SoftFlooringCalculatorGo.png" value="Submit" onMouseOver="goButtonOver(this);" onMouseOut="goButtonOut(this);" onClick="results(\'boxes\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+')" tabindex="5"></td>';
html+= '</div>';
}

else if(style=='2B' || style=='2b'){
html+= '<div id="form2A" height="59px" style="position:relative; padding:0; margin:0;"><img src="http://www.alessco.com/images/CalcLayout2B.png"/>';
html+= '<div style="position:absolute; top:30px; left: 39px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
html+= '<div style="position:absolute; top:30px; left: 79px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
html+= '<div style="position:absolute; top:30px; left:138px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
html+= '<div style="position:absolute; top:30px; left:178px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
html+= '<div style="position:absolute; top:24px; left:230px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/SoftFlooringCalculatorGo.png" value="Submit" onMouseOver="goButtonOver(this);" onMouseOut="goButtonOut(this);" onClick="results(\'boxes\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+')" tabindex="5"></td>';
html+= '</div>';
}

else if(style=='3A' || style=='3a'){
html+= '<div id="form3A" height="136px" style="position:relative; padding:0; margin:0;"><img src="http://www.alessco.com/images/CalcLayout3A.png"/>';
html+= '<div style="position:absolute; top: 78px; left:15px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
html+= '<div style="position:absolute; top: 78px; left:53px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
html+= '<div style="position:absolute; top:103px; left:15px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
html+= '<div style="position:absolute; top:103px; left:53px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
html+= '<div style="position:absolute; top: 97px; left:88px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/SoftFlooringCalculatorGo.png" value="Submit" onMouseOver="goButtonOver(this);" onMouseOut="goButtonOut(this);" onClick="results(\'boxes\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+')" tabindex="5"></div>';
html+= '</div>';
}

else if(style=='3B' || style=='3b'){
html+= '<div id="form3B" height="136px" style="position:relative; padding:0; margin:0;"><img src="http://www.alessco.com/images/CalcLayout3B.png"/>';
html+= '<div style="position:absolute; top: 78px; left:15px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
html+= '<div style="position:absolute; top: 78px; left:53px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
html+= '<div style="position:absolute; top:103px; left:15px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
html+= '<div style="position:absolute; top:103px; left:53px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
html+= '<div style="position:absolute; top: 97px; left:88px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/SoftFlooringCalculatorGo.png" value="Submit" onMouseOver="goButtonOver(this);" onMouseOut="goButtonOut(this);" onClick="results(\'boxes\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+')" tabindex="5"></div>';
html+= '</div>';
}

else if(style=='4A' || style=='4a'){
html+= '<div id="form4A" height="154px" style="position:relative; padding:0; margin:0;"><img src="http://www.alessco.com/images/CalcLayout4A.png"/>';
html+= '<div style="position:absolute; top: 87px; left:24px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
html+= '<div style="position:absolute; top: 87px; left:62px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
html+= '<div style="position:absolute; top:112px; left:24px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
html+= '<div style="position:absolute; top:112px; left:62px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
html+= '<div style="position:absolute; top:106px; left:97px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/SoftFlooringCalculatorGo.png" value="Submit" onMouseOver="goButtonOver(this);" onMouseOut="goButtonOut(this);" onClick="results(\'boxes\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+')" tabindex="5"></div>';
html+= '</div>';
}

else if(style=='4B' || style=='4b'){
html+= '<div id="form4B" height="154px" style="position:relative; padding:0; margin:0;"><img src="http://www.alessco.com/images/CalcLayout4B.png"/>';
html+= '<div style="position:absolute; top: 87px; left:24px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="0" tabindex="1" /></div>';
html+= '<div style="position:absolute; top: 87px; left:62px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="0" tabindex="2" /></div>';
html+= '<div style="position:absolute; top:112px; left:24px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="0" tabindex="3" /></div>';
html+= '<div style="position:absolute; top:112px; left:62px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:24px; border: 0px; font-size: 14px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="0" tabindex="4" /></div>';
html+= '<div style="position:absolute; top:168px; left:46px; line-height:16px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/SoftFlooringCalculatorGo.png" value="Submit" onMouseOver="goButtonOver(this);" onMouseOut="goButtonOut(this);" onClick="results(\'boxes\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+')" tabindex="5"></div>';
html+= '</div>';
}

else if(style=='5A'){
	html += '<div id="form" style="padding: 4px 0px 0px 0px; margin-bottom: 23px;">';
	html+='<table class="calculatorInput" border="0" cellpadding="0" cellspacing="0">';
	html+='<tr>';
	html+='<td style="padding: 0px 15px 2px 0px;" width="499">';
	html+='<img name="image1" src="http://www.alessco.com/images/SoftFloorsCalculator.png" border="0">        </td>';
	html+='<td style="padding: 6px 0px 0px 5px; background: url( http://www.alessco.com/images/Calculator01.png) no-repeat;" width="46" height="35" valign="top">';
	html+='<input style="font-size: 16px; color: #6e6e6e;" class="dim" id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="'+lenFeet+'" tabindex="1">        </td>';
	html+=' <td style="padding: 6px 0px 0px 5px; background: url(http://www.alessco.com/images/Calculator02.png) no-repeat;" width="62" height="35" valign="top">';
	html+='  <input style="font-size: 16px; color: #6e6e6e;" class="dim" id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="'+lenInches+'" tabindex="2">        </td>';
	html+='<td style="padding: 6px 0px 0px 5px; background: url(http://www.alessco.com/images/Calculator03.png) no-repeat;" width="46" height="35" valign="top">';
	html+='<input style="font-size: 16px; color: #6e6e6e;" class="dim" id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="'+widFeet+'" tabindex="3">        </td>';
	html+=' <td style="padding: 6px 0px 0px 5px; background: url(http://www.alessco.com/images/Calculator04.png) no-repeat;" width="51" height="35" valign="top">';
	html+=' <input style="font-size: 16px; color: #6e6e6e;" class="dim" id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="'+widInches+'" tabindex="4">        </td>';
	html+='  <td>';
	html+=' <input id="goButton" type="image" src="http://www.alessco.com/images/CalculatorGo.png" value="Submit"  onMouseOver="goButtonBlue(this);" onMouseOut="goButtonGrey(this);" onClick="results(\'boxes\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+')" tabindex="5">        </td>';
	html+='</tr>';
	html+='</table>';
	html+='</div>';
	
}else if(style=='5B'){
	html +='<div id="form" style="padding: 4px 0px 0px 0px; margin-bottom: 23px; margin-left:-10px;">';
        html+='<table class="calculatorInput" border="0" cellpadding="0" cellspacing="0">';
            html+='<tr>';
                html+='<td style="padding: 0px 15px 2px 0px;" width="499">';
                    html+='<img name="image1" src="http://www.alessco.com/dealers/images/SoftFloorsCalculator.png" border="0">        </td>';
                html+='<td style="padding: 6px 0px 0px 5px; background: url( http://www.alessco.com/images/Calculator01.png) no-repeat;" width="46" height="35" valign="top">';
                    html+='<input class="dim" style="font-size: 16px; color: #6e6e6e;" id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="'+lenFeet+'" tabindex="1">        </td>';
               html+=' <td style="padding: 6px 0px 0px 5px; background: url(http://www.alessco.com/images/Calculator02.png) no-repeat;" width="62" height="35" valign="top">';
                  html+='  <input class="dim" style="font-size: 16px; color: #6e6e6e;" id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="'+lenInches+'" tabindex="2">        </td>';
                html+='<td style="padding: 6px 0px 0px 5px; background: url(http://www.alessco.com/images/Calculator03.png) no-repeat;" width="46" height="35" valign="top">';
                    html+='<input class="dim" style="font-size: 16px; color: #6e6e6e;" id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="'+widFeet+'" tabindex="3">        </td>';
               html+=' <td style="padding: 6px 0px 0px 5px; background: url(http://www.alessco.com/images/Calculator04.png) no-repeat;" width="51" height="35" valign="top">';
                   html+=' <input class="dim" style="font-size: 16px; color: #6e6e6e;" id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="'+widInches+'" tabindex="4">        </td>';
              html+='  <td>';
                   html+=' <input id="goButton" type="image" src="http://www.alessco.com/images/CalculatorGo.png" value="Submit" onMouseOver="goButtonBlue(this);" onMouseOut="goButtonGrey(this);" onClick="results(\'boxes\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+')" tabindex="5">        </td>';
            html+='</tr>';
        html+='</table>';
    html+='</div>';
}
	
else if(style=='5D' || style=='5d'){		
html += '<div id="form" height="33px" style="position:relative; padding:5px 0px 0px 0px; margin-bottom: 28px; "><img src="http://www.alessco.com/images/CalcLayout5A.jpg"/>';
html+= '<div style="position:absolute; top:10px; left:665px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:30px;  border: 0px; font-size: 16px; color: #6e6e6e; text-align: center; " id="alesscoLenghtFeet" name="alesscoLenghtFeet" type="text" value="'+lenFeet+'" tabindex="1" /></div>';
html+= '<div style="position:absolute; top: 9px; left:712px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:30px;  border: 0px; font-size: 16px; color: #6e6e6e; text-align: center; " id="alesscoLenghtInches"  name="alesscoLenghtInches" type="text" value="'+lenInches+'" tabindex="2" /></div>';
html+= '<div style="position:absolute; top: 9px; left:777px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:30px;  border: 0px; font-size: 16px; color: #6e6e6e; text-align: center; " id="alesscoWidthFeet" name="alesscoWidthFeet" type="text" value="'+widFeet+'" tabindex="3" /></div>';
html+= '<div style="position:absolute; top: 9px; left:823px; line-height:14px; padding:0; margin:0;"><input class="dim" style="font-family: \'Arial Narrow\', Arial, Helvetica; width:30px;  border: 0px; font-size: 16px; color: #6e6e6e; text-align: center; " id="alesscoWidthInches"  name="alesscoWidthInches" type="text" value="'+widInches+'" tabindex="4" /></div>';
html+= '<div style="position:absolute; top: 3px; left:872px; line-height:14px; padding:0; margin:0;"><input id="goButton" type="image" src="http://www.alessco.com/images/CalculatorGo.png" value="Submit" onMouseOver="goButtonBlue(this);" onMouseOut="goButtonGrey(this);" onClick="results(\'boxes\','+costSF+','+costERSF1+','+costERSF2+','+costSW+','+costSC+','+costESC+','+costST+','+costSR+','+costJRSF2+','+costJRSF2by1+','+costJRSF1mby1m+','+costJRSF4+','+costPL1310+','+costPL1311+','+costSM+','+costSR2+','+costSBN1+','+costSBN2+','+costSBW+')" tabindex="5"></div>';
html+= '</div>';
}	
	

html+='<div id="boxes">'+resultsTest(costSF,costERSF1,costERSF2,costSW,costSC,costESC,costST,costSR,costJRSF2,costJRSF2by1,costJRSF1mby1m,costJRSF4,costPL1310,costPL1311,costSM,costSR2,costSBN1,costSBN2,costSBW)+'</div><div id="wyniki"></div></div>';
html+='</div></body></html>';
myWindow.document.write(html);
myWindow.focus();

}


}else{
alert('Please convert your dimensions to feet and inches');
}


}


        function closeWindow(){
			myWindow.close();
        //document.getElementById('boxes').style.visibility = "hidden";
		}
		
		function closeBlue(obj){
			obj.src = "http://www.alessco.com/images/closeButtonOver.png";
		}
		
		function closeGrey(obj){
			obj.src = "http://www.alessco.com/images/closeButton.png";
		}
		function closeBlueEnd(){
			document.getElementById('closeButtonEnd').src = "http://www.alessco.com/images/closeButtonOver.png";
		}
		function closeGreyEnd(){
			document.getElementById('closeButtonEnd').src = "http://www.alessco.com/images/closeButton.png";
		}


function changeBackgroundColor(objDivID)
	{
		var els = document.getElementsByTagName('div');
		for (i=0; i < els.length; i++) {
			els[i].style.backgroundColor = '#ffffff';
		}

		document.getElementById(objDivID).style.backgroundColor = '#c0c0c0';
	}
	
	
	function goButtonBlue(obj){
		obj.src ="http://www.alessco.com/images/CalculatorGoOver.png";
	}
		
	function goButtonGrey(obj){
		obj.src ="http://www.alessco.com/images/CalculatorGo.png";
	}
	
	function orderHereButtonBlue(id){
        var link = 'buttonLink'+id+'';
        document.getElementById(link).src ="http://www.alessco.com/images/buttonOrderHereOver.png";
	}



	function goButtonOver(obj){
		obj.src ="http://www.alessco.com/images/SoftFlooringCalculatorGoOver.png";
	}
    
	function goButtonOut(obj){
		obj.src ="http://www.alessco.com/images/SoftFlooringCalculatorGo.png";
	}

////////////

/////////////

function waitPreloadPage()
	{ //DOM

		if (document.getElementById)
		{
		
			document.getElementById('prepage').style.visibility='hidden';
			
		} else {
		
			if (document.layers)
			{ //NS4
			
				document.prepage.visibility = 'hidden';
			
			} else { //IE4
				
				document.all.prepage.style.visibility = 'hidden';
			
			}
		}
}

/////////////


function hideDiv(id){
document.getElementById(id).style.visibility = "hidden";
}
function showClue(id, position){
var html = '<span class="clue">To see more details fill out the form</span>';
document.getElementById(id).innerHTML = html;
document.getElementById(id).style.top = position;
document.getElementById(id).style.visibility = "visible";
}
function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}


function countPieces(lFeet, lInches, wFeet, wInches,costSF,costERSF1,costERSF2,costSW,costSC,costESC,costST,costSR,costJRSF2,costJRSF2by1,costJRSF1mby1m,costJRSF4,costPL1310,costPL1311,costSM,costSR2,costSBN1,costSBN2,costSBW){
	
	
	
	
	var lenFeet = document.getElementById(lFeet).value;
	var lenInches = document.getElementById(lInches).value;
	var widFeet =  document.getElementById(wFeet).value;
	var widInches = document.getElementById(wInches).value;
	
	if(lenFeet < 2 ){lenFeet=2; lenInches =0;}
        if(widFeet < 2 ){widFeet=2; widInches = 0;}
        if(lenFeet == 0 && lenInches != 0){lenFeet = 2; lenInches = 0;}
        if(widFeet == 0 && widInches != 0){widFeet = 2; widInches = 0;}

	
	var lenFeet4 = document.getElementById(lFeet).value;
	var lenInches4 = document.getElementById(lInches).value;
	var widFeet4 =  document.getElementById(wFeet).value;
	var widInches4 = document.getElementById(wInches).value;
	
	/*if(lenFeet4 < 4 ){lenFeet4=4; lenInches4 =0;}
        if(widFeet4 < 4){widFeet4=4; widInches4 = 0;}
        if(lenFeet4 == 0 && lenInches4 != 0){lenFeet4 = 4; lenInches4 = 0;}
        if(widFeet4 == 0 && widInches4 != 0){widFeet4 =4; widInches4 = 0;}*/
	


	var text=/^\d+$/;
	
	if(text.test(lenFeet) && (lenFeet != 0 || widInches != 0) && text.test(lenInches) && text.test(widFeet) && text.test(widInches)){
	
		if((lenInches==0 && widInches==0) || (lenInches4==0 && widInches4==0)){
			
			var wallSM = Math.ceil((lenFeet * widFeet)/24);
			var wallSBN1 = Math.ceil((lenFeet * widFeet)/50);
			var wallSBN2 = Math.ceil((lenFeet * widFeet)/50);
			var wallSBW = Math.ceil((lenFeet * widFeet)/50);
			var lenghtArea = Math.floor(lenFeet/2)*2;
			var widthArea = Math.floor(widFeet/2)*2;
			var totalArea = Math.floor(lenFeet/2) * Math.floor(widFeet/2);
			var borderArea = (Math.floor(lenFeet/2) - 2)*2 + (Math.floor(widFeet/2) - 2)*2;
			var insideArea = (Math.floor(lenFeet/2) - 2)*(Math.floor(widFeet/2) - 2);
			
			var num = new Number(lenFeet);
			var num1 = new Number(widFeet);
			
			var lenghtPLArea = num - 1;
			var widthPLArea = num1 - 1;
			var lenghtPLWall = num; 
			var widthPLWall = num1;
			var totalPLArea = lenghtPLArea * widthPLArea;
			var totalPLWall = lenghtPLWall * widthPLWall;

			var totalWall = Math.ceil(lenFeet/2) *  Math.ceil(widFeet/2);
			var lenghtWall = Math.ceil(lenFeet/2)*2;
			var widthWall = Math.ceil(widFeet/2)*2;
			var borderWall = (Math.ceil(lenFeet/2) - 2)*2 + (Math.ceil(widFeet/2) - 2)*2;
			var insideWall = (Math.ceil(lenFeet/2) - 2)*(Math.ceil(widFeet/2) - 2);
			
		
			var total4by4Area = Math.floor(lenFeet4/4) * Math.floor(widFeet4/4);
			var lenght4by4Area = Math.floor(lenFeet4/4)*4;
			var width4by4Area =  Math.floor(widFeet4/4)*4;
			
                        var total4by4Wall = Math.ceil(lenFeet4/4) *  Math.ceil(widFeet4/4);
                        var lenght4by4Wall = Math.ceil(lenFeet4/4)*4;
                        var width4by4Wall =  Math.ceil(widFeet4/4)*4;


                        var total1mby1mArea = Math.floor(lenFeet/3.375) * Math.floor(widFeet/3.28);
                        var lenght1mby1mArea = Math.floor(lenFeet/3.375)*3.375;
                        var width1mby1mArea = Math.floor(widFeet/3.375)*3.375;
			
                        var total1mby1mWall = Math.ceil(lenFeet/3.375) *  Math.ceil(widFeet/3.375);
                        var lenght1mby1mWall = Math.ceil(lenFeet/3.375)*3.375;
                        var width1mby1mWall = Math.ceil(widFeet/3.375)*3.375;
			var html='';
			html+='Area Rug '+totalArea+'\nWall to Wall '+totalWall+'\n4by4 Area Rug '+total4by4Area+'\n4b4 Wall to Wall '+total4by4Wall+'\n1m by 1m Area Rug '+total1mby1mArea+'\n1m by 1m Wall To Wall '+total1mby1mWall+'';
		
	}
	else if((lenInches!=0 && widInches==0) || (lenInches4!=0 && widInches4==0)){
		
		if(lenInches>=12){
		alert('Please convert your dimensions to feet and inches');
		
		}else{
			
			var num = new Number(lenFeet);
			var num1 = new Number(lenInches);
			var numa = new Number(widFeet);
			var lenFeetArea1 = num - num1 + num1;
			var lenFeetWall1 = num + 1;
			
			var num4 = new Number(lenFeet4);
			var num14 = new Number(lenInches4);
			var numa4 = new Number(widFeet4);
			var lenFeetArea14 = num4 - num14 + num14;
			var lenFeetWall14 = num4 + 1;
			
			if(lenInches <= 6){
				if(lenInches == 6){
				var lenghtPLArea = num;
				var widthPLArea = numa - 1;
				}else{
				var lenghtPLArea = num - 1;
				var widthPLArea = numa - 1;
				}
				var lenghtPLWall = num;
				var widthPLWall = numa;
				}else{
				var lenghtPLArea = num;
				var widthPLArea = numa - 1;
				var lenghtPLWall = num + 1;
				var widthPLWall = widFeet;
					}
			
			var totalPLArea = lenghtPLArea * widthPLArea;
			var totalPLWall = lenghtPLWall * widthPLWall;
			
			var lenghtArea = Math.floor(lenFeetArea1/2)*2;
			var widthArea = Math.floor(widFeet/2)*2;
			var totalArea = Math.floor(lenFeetArea1/2) * Math.floor(widFeet/2);
			var borderArea = (Math.floor(lenFeetArea1/2) - 2)*2 + (Math.floor(widFeet/2) - 2)*2;
			var insideArea = (Math.floor(lenFeetArea1/2) - 2)*(Math.floor(widFeet/2) - 2);
			
			var lenghtWall = Math.ceil(lenFeetWall1/2)*2;
			var widthWall = Math.ceil(widFeet/2)*2;
			var totalWall = Math.ceil(lenFeetWall1/2) *  Math.ceil(widFeet/2);
			var borderWall = (Math.ceil(lenFeetWall1/2) - 2)*2 + (Math.ceil(widFeet/2) - 2)*2;
			var insideWall = (Math.ceil(lenFeetWall1/2) - 2)*(Math.ceil(widFeet/2) - 2);
			
			var wallSM = Math.ceil((lenFeetWall1 * widFeet)/24);

			var wallSBN1 = Math.ceil((lenFeetWall1 * widFeet)/50);
			var wallSBN2 = Math.ceil((lenFeetWall1 * widFeet)/50);
			var wallSBW = Math.ceil((lenFeetWall1 * widFeet)/50);
			
			var total4by4Area = Math.floor(lenFeetArea14/4) * Math.floor(widFeet4/4);
			var lenght4by4Area = Math.floor(lenFeetArea14/4)*4;
			var width4by4Area =  Math.floor(widFeet4/4)*4;
			
                        var total4by4Wall = Math.ceil(lenFeetWall14/4) *  Math.ceil(widFeet4/4);
			var lenght4by4Wall = Math.ceil(lenFeetWall14/4)*4;
                        var width4by4Wall =  Math.ceil(widFeet4/4)*4;
			
                        var total1mby1mArea = Math.floor(lenFeetArea1/3.375) * Math.floor(widFeet/3.375);
                        var lenght1mby1mArea = Math.floor(lenFeetArea1/3.3758)*3.375;
                        var width1mby1mArea = Math.floor(widFeet/3.375)*3.375;
			
                        var total1mby1mWall = Math.ceil(lenFeetWall1/3.375) *  Math.ceil(widFeet/3.375);
			var lenght1mby1mWall = Math.ceil(lenFeetWall1/3.375)*3.375;
                        var width1mby1mWall = Math.ceil(widFeet/3.375)*3.375;
			var html='';
			html+='Area Rug '+totalArea+'\nWall to Wall '+totalWall+'\n4by4 Area Rug '+total4by4Area+'\n4b4 Wall to Wall '+total4by4Wall+'\n1m by 1m Area Rug '+total1mby1mArea+'\n1m by 1m Wall To Wall '+total1mby1mWall+'';
			//alert(html);
		}
			}
			else if((lenInches==0 && widInches!=0) || (lenInches4==0 && widInches4!=0)){
				
				if(widInches>=12){
				alert('Please convert your dimensions to feet and inches');
				}else{
					
					var num = new Number(widFeet);
					var numa = new Number(lenFeet);
					var num1 = new Number(widInches);
					var widFeetArea1 = num - num1 + num1;
					var widFeetWall1 = num+1;
					
					var num4 = new Number(widFeet4);
					var numa4 = new Number(lenFeet4);
					var num14 = new Number(widInches4);
					var widFeetArea14 = num4 - num14 + num14;
					var widFeetWall14 = num4+1;
					
					if(widInches <= 6){
					if(widInches == 6){
						var lenghtPLArea = numa - 1;
						var widthPLArea = num;
						}else{	
						var lenghtPLArea = numa - 1;
						var widthPLArea = num - 1;
						}
					var lenghtPLWall = numa;
					var widthPLWall = num;
					}else{
					var lenghtPLArea = numa -1;
					var widthPLArea = num;
					var lenghtPLWall = numa;
					var widthPLWall = num+1;
					}
			
			var totalPLArea = lenghtPLArea * widthPLArea;
			var totalPLWall = lenghtPLWall * widthPLWall;
					
					
					
					var lenghtArea = Math.floor(lenFeet/2)*2;
					var widthArea = Math.floor(widFeetArea1/2)*2;
					var totalArea = Math.floor(lenFeet/2) * Math.floor(widFeetArea1/2);
					var borderArea = (Math.floor(lenFeet/2) - 2)*2 + (Math.floor(widFeetArea1/2) - 2)*2;
					var insideArea = (Math.floor(lenFeet/2) - 2)*(Math.floor(widFeetArea1/2) - 2);
					
					var lenghtWall = Math.ceil(lenFeet/2)*2;
					var widthWall = Math.ceil(widFeetWall1/2)*2;
					var totalWall = Math.ceil(lenFeet/2) *  Math.ceil(widFeetWall1/2);
					var borderWall = (Math.ceil(lenFeet/2) - 2)*2 + (Math.ceil(widFeetWall1/2) - 2)*2;
					var insideWall = (Math.ceil(lenFeet/2) - 2)*(Math.ceil(widFeetWall1/2) - 2);
					
					var wallSM = Math.ceil((lenFeet* widFeetWall1)/24);

					var wallSBN1 = Math.ceil((lenFeet* widFeetWall1)/50);
					var wallSBN2 = Math.ceil((lenFeet* widFeetWall1)/50);
					var wallSBW = Math.ceil((lenFeet* widFeetWall1)/50);

					
					var total4by4Area = Math.floor(lenFeet4/4) * Math.floor(widFeetArea14/4);
					var lenght4by4Area = Math.floor(lenFeet4/4)*4;
			                var width4by4Area =  Math.floor(widFeetArea14/4)*4;
					
                                        var total4by4Wall = Math.ceil(lenFeet4/4) *  Math.ceil(widFeetWall14/4);
                                        var lenght4by4Wall = Math.ceil(lenFeet4/4)*4;
                                        var width4by4Wall =  Math.ceil(widFeetWall14/4)*4;
                                        
					var total1mby1mArea = Math.floor(lenFeet/3.375) * Math.floor(widFeetArea1/3.375);
					var lenght1mby1mArea = Math.floor(lenFeet/3.375)*3.375;
                                        var width1mby1mArea = Math.floor(widFeetArea1/3.375)*3.375;
					
                                        var total1mby1mWall = Math.ceil(lenFeet/3.375) *  Math.ceil(widFeetWall1/3.375);
                                        var lenght1mby1mWall = Math.ceil(lenFeet/3.375)*3.375;
                                        var width1mby1mWall = Math.ceil(widFeetWall1/3.375)*3.375;
					var html='';
					html+='Area Rug '+totalArea+'\nWall to Wall '+totalWall+'\n4by4 Area Rug '+total4by4Area+'\n4b4 Wall to Wall '+total4by4Wall+'\n1m by 1m Area Rug '+total1mby1mArea+'\n1m by 1m Wall To Wall '+total1mby1mWall+'';
					//alert(html);
					}
}
	else{
	if(lenInches>=12 || widInches>=12){
	alert('Please convert your dimensions to feet and inches');
	}else{
		var num = new Number(lenFeet);
		var numa = new Number(lenInches);
		var lenFeetArea1 = num - numa + numa;
		var lenFeetWall1 = num + 1;
		var num1 = new Number(widFeet);
		var num1a = new Number(widInches);
		var widFeetArea1 = num1 - num1a + num1a;
		var widFeetWall1 = num1 + 1;
		
		if(lenInches <=6 && widInches <=6){
			if(lenInches == 6 && widInches != 6){
				var lenghtPLArea = num;
				var widthPLArea = num1 - 1;
			}else if(lenInches != 6 && widInches == 6){
				var lenghtPLArea = num - 1;
				var widthPLArea = num1;
				}else if(lenInches == 6 && widInches == 6){
				var lenghtPLArea = num;	
				var widthPLArea = num1;	
			}else{
			var lenghtPLArea = num - 1;
			var widthPLArea = num1 - 1;
			}
			var lenghtPLWall = num;
			var widthPLWall = num1;
		}else if(lenInches>6 && widInches <=6){
			if(widInches == 6){
				var widthPLArea = num1;
				}else{
				var widthPLArea = num1 - 1;	
					}
			var lenghtPLArea = num;
			
			var lenghtPLWall = num+1;
			var widthPLWall = num1;
		}else if(lenInches <= 6 && widInches > 6){
		      if(lenInches == 6){
                      var lenghtPLArea = num;
                      }else{
			var lenghtPLArea = num-1;
			}
			var widthPLArea = num1;
			var lenghtPLWall = num;
			var widthPLWall = num1+1;
		}else if(lenInches>6 && widInches > 6){
			var lenghtPLArea = num;
			var widthPLArea = num1;
			var lenghtPLWall = num+1;
			var widthPLWall = num1+1;
			}
		
		var totalPLArea = lenghtPLArea * widthPLArea;
		var totalPLWall = lenghtPLWall * widthPLWall;
		
		var lenghtArea = Math.floor(lenFeetArea1/2)*2;
		var widthArea = Math.floor(widFeetArea1/2)*2;
		var totalArea = Math.floor(lenFeetArea1/2) * Math.floor(widFeetArea1/2);
		var borderArea = (Math.floor(lenFeetArea1/2) - 2)*2 + (Math.floor(widFeetArea1/2) - 2)*2;
		var insideArea = (Math.floor(lenFeetArea1/2) - 2)*(Math.floor(widFeetArea1/2) - 2);
		
		var lenghtWall = Math.ceil(lenFeetWall1/2)*2;
		var widthWall = Math.ceil(widFeetWall1/2)*2;
		var totalWall = Math.ceil(lenFeetWall1/2) *  Math.ceil(widFeetWall1/2);
		var borderWall = (Math.ceil(lenFeetWall1/2) - 2)*2 + (Math.ceil(widFeetWall1/2) - 2)*2;
		var insideWall = (Math.ceil(lenFeetWall1/2) - 2)*(Math.ceil(widFeetWall1/2) - 2);
		
		var wallSM = Math.ceil((lenFeetWall1* widFeetWall1)/24);
		
		var wallSBN1 = Math.ceil((lenFeetWall1* widFeetWall1)/50);
		var wallSBN2 = Math.ceil((lenFeetWall1* widFeetWall1)/50);
		var wallSBW = Math.ceil((lenFeetWall1* widFeetWall1)/50);

                var total4by4Area = Math.floor(lenFeetArea1/4) * Math.floor(widFeetArea1/4);
                var lenght4by4Area = Math.floor(lenFeetArea1/4)*4;
                var width4by4Area =  Math.floor(widFeetArea1/4)*4;
                
		var total4by4Wall = Math.ceil(lenFeetWall1/4) *  Math.ceil(widFeetWall1/4);
		var lenght4by4Wall = Math.ceil(lenFeetWall1/4)*4;
                var width4by4Wall =  Math.ceil(widFeetWall1/4)*4;
		
                var total1mby1mArea = Math.floor(lenFeetArea1/3.375) * Math.floor(widFeetArea1/3.28);
                var lenght1mby1mArea = Math.floor(lenFeetArea1/3.375)*3.375;
                var width1mby1mArea = Math.floor(widFeetArea1/3.375)*3.375;
		
                var total1mby1mWall = Math.ceil(lenFeetWall1/3.375) *  Math.ceil(widFeetWall1/3.375);
                var lenght1mby1mWall = Math.ceil(lenFeetWall1/3.375)*3.375;
                var width1mby1mWall = Math.ceil(widFeetWall1/3.375)*3.375;
		var html='';
		html+='Area Rug '+totalArea+'\nWall to Wall '+totalWall+'\n4by4 Area Rug '+total4by4Area+'\n4b4 Wall to Wall '+total4by4Wall+'\n1m by 1m Area Rug '+total1mby1mArea+'\n1m by 1m Wall To Wall '+total1mby1mWall+'';
		//alert(html);
		}
	}


document.getElementById('total1').innerHTML = totalArea;
document.getElementById('total1').value = totalArea;
document.getElementById('total1w').innerHTML = totalWall;
document.getElementById('total1w').value = totalWall;
document.getElementById('borderArea').value = borderArea;
document.getElementById('insideArea').value = insideArea;
document.getElementById('borderWall').value = borderWall;
document.getElementById('insideWall').value = insideWall;

document.getElementById('lenghtArea').value = lenghtArea;
document.getElementById('widthArea').value = widthArea;
document.getElementById('lenghtWall').value = lenghtWall;
document.getElementById('widthWall').value = widthWall;

costs(totalArea, costSF, 'cost1');
costs(totalWall, costSF, 'cost1w');

document.getElementById('total2').innerHTML = totalArea;
document.getElementById('total2').value = totalArea;
document.getElementById('total2w').innerHTML = totalWall;
document.getElementById('total2w').value = totalWall;
costs(totalArea, costERSF1, 'cost2');
costs(totalWall, costERSF1, 'cost2w');

document.getElementById('total3').innerHTML = totalArea;
document.getElementById('total3').value = totalArea;
document.getElementById('total3w').innerHTML = totalWall;
document.getElementById('total3w').value = totalWall;
costs(totalArea, costERSF2, 'cost3');
costs(totalWall, costERSF2, 'cost3w');

document.getElementById('total4').innerHTML = totalPLArea;
document.getElementById('total4').value = totalPLArea;
document.getElementById('total4w').innerHTML = totalPLWall;
document.getElementById('total4w').value = totalPLWall;

document.getElementById('lenghtPLArea').value = lenghtPLArea;
document.getElementById('widthPLArea').value = widthPLArea;
document.getElementById('lenghtPLWall').value = lenghtPLWall;
document.getElementById('widthPLWall').value = widthPLWall;

document.getElementById('total5').innerHTML = totalArea;
document.getElementById('total5').value = totalArea;
document.getElementById('total5w').innerHTML = totalWall;
document.getElementById('total5w').value = totalWall;
costs(totalArea, costSW, 'cost5');
costs(totalWall, costSW, 'cost5w');

document.getElementById('total6').innerHTML = totalArea;
document.getElementById('total6').value = totalArea;
document.getElementById('total6w').innerHTML = totalWall;
document.getElementById('total6w').value = totalWall;
costs(totalArea, costSC, 'cost6');
costs(totalWall, costSC, 'cost6w');


document.getElementById('total7').innerHTML = totalArea;
document.getElementById('total7').value = totalArea;
document.getElementById('total7w').innerHTML = totalWall;
document.getElementById('total7w').value = totalWall;
costs(totalArea, costESC, 'cost7');
costs(totalWall, costESC, 'cost7w');

document.getElementById('total8').innerHTML = totalArea;
document.getElementById('total8').value = totalArea;
document.getElementById('total8w').innerHTML = totalWall;
document.getElementById('total8w').value = totalWall;
costs(totalArea, costST, 'cost8');
costs(totalWall, costST, 'cost8w');

document.getElementById('total9').innerHTML = totalArea;
document.getElementById('total9').value = totalArea;
document.getElementById('total9w').innerHTML = totalWall;
document.getElementById('total9w').value = totalWall;
costs(totalArea, costSR, 'cost9');
costs(totalWall, costSR, 'cost9w');

document.getElementById('total19').innerHTML = totalArea;
document.getElementById('total19').value = totalArea;
document.getElementById('total19w').innerHTML = totalWall;
document.getElementById('total19w').value = totalWall;
costs(totalArea, costSR, 'cost19');
costs(totalWall, costSR, 'cost19w');


document.getElementById('total10').innerHTML = totalArea;
document.getElementById('total10').value = totalArea;
document.getElementById('total10w').innerHTML = totalWall;
document.getElementById('total10w').value = totalWall;
costs(totalArea, costJRSF2, 'cost10');
costs(totalWall, costJRSF2, 'cost10w');

document.getElementById('total11').innerHTML = totalArea;
document.getElementById('total11').value = totalArea;
document.getElementById('total11w').innerHTML = totalWall;
document.getElementById('total11w').value = totalWall;
costs(totalArea, costJRSF2by1, 'cost11');
costs(totalWall, costJRSF2by1, 'cost11w');

if(total1mby1mArea==0){total1mby1mArea=1; lenght1mby1mArea=3.375; width1mby1mArea=3.375;};
if(total1mby1mWall==0){total1mby1mWall=1; lenght1mby1mWall=3.375; width1mby1mWall=3.375;};

document.getElementById('total12').innerHTML = total1mby1mArea;
document.getElementById('total12').value = total1mby1mArea;
document.getElementById('total12w').innerHTML = total1mby1mWall;
document.getElementById('total12w').value = total1mby1mWall;

document.getElementById('lenght1mby1mArea').value = lenght1mby1mArea;
document.getElementById('width1mby1mArea').value = width1mby1mArea;
document.getElementById('lenght1mby1mWall').value = lenght1mby1mWall;
document.getElementById('width1mby1mWall').value = width1mby1mWall;

costs(total1mby1mArea, costJRSF1mby1m, 'cost12');
costs(total1mby1mWall, costJRSF1mby1m, 'cost12w');


if(total4by4Area==0){total4by4Area=1; lenght4by4Area=4; width4by4Area=4;};
if(total4by4Wall==0){total4by4Wall=1; lenght4by4Wall=4; width4by4Wall=4;};
document.getElementById('total13').innerHTML = total4by4Area;
document.getElementById('total13').value = total4by4Area;
document.getElementById('total13w').innerHTML = total4by4Wall;
document.getElementById('total13w').value = total4by4Wall;

document.getElementById('lenght4by4Area').value = lenght4by4Area;
document.getElementById('width4by4Area').value = width4by4Area;
document.getElementById('lenght4by4Wall').value = lenght4by4Wall;
document.getElementById('width4by4Wall').value = width4by4Wall;

costs(total4by4Area, costJRSF4, 'cost13');
costs(total4by4Wall, costJRSF4, 'cost13w');

document.getElementById('totalSM').innerHTML = wallSM;
document.getElementById('totalSM').value = wallSM;

document.getElementById('totalSBN1').innerHTML = wallSBN1;
document.getElementById('totalSBN1').value = wallSBN1;

document.getElementById('totalSBN2').innerHTML = wallSBN2;
document.getElementById('totalSBN2').value = wallSBN2;

document.getElementById('totalSBW').innerHTML = wallSBW;
document.getElementById('totalSBW').value = wallSBW;


document.getElementById('wyniki').style.visibility="visible";

}else{
alert('Please convert your dimensions to feet and inches');
}

}







function costs(total, price, id){
	var cost = addCommas((total * price).toFixed(2));
	document.getElementById(id).innerHTML = '$'+cost+'';
	document.getElementById(id).value = cost;
}







function countBoxes(totalArea, totalWall, pieces, thick1piece, weight1p, weight25p, widthTotal, heightTotal,thickTotal, costArea, costWall, sqft1, position, sqftOnePice, thickOnePiece, price, name, ident, header ){
	
	if(document.getElementById(totalArea).value==0 || document.getElementById(totalWall).value==0){
		//alert('Insert dimensions');
		//document.getElementById('boxes').style.visibility = 'hidden';
	}else{
	        //alert(document.getElementById(totalArea).value)  ;
	        var html = null;
	
		var lenghtArea = document.getElementById('lenghtArea').value;
		var widthArea = document.getElementById('widthArea').value;
		var lenghtWall = document.getElementById('lenghtWall').value;
		var widthWall = document.getElementById('widthWall').value;
		
		
		
		if(ident==0){
			var a =  document.getElementById(totalArea).value;
			var b = document.getElementById(totalWall).value;
			var lenghtArea = document.getElementById('lenghtArea').value;
			var widthArea = document.getElementById('widthArea').value;
			var lenghtWall = document.getElementById('lenghtWall').value;
			var widthWall = document.getElementById('widthWall').value;
			if(a==1){
                        var textArea = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">0 Corners + 0 Borders + '+a+' Inside = &nbsp;'+a+' Piece</span></div>';

                        }  else{
			var corner =4;
			var borderArea = document.getElementById('borderArea').value;
			var insideArea =  document.getElementById('insideArea').value;
			var borderWall = document.getElementById('borderWall').value;
			var insideWall =  document.getElementById('insideWall').value;
			var textArea = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+corner+' Corners + '+borderArea+ ' Borders + '+insideArea+' Insides = &nbsp;'+a+' Pieces</span></div>';
		
                        //var textWall = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.dealers.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+corner+' Corners + '+borderWall+ ' Borders + '+insideWall+' Insides = &nbsp;'+b+' Pieces</span></div>';
		}
		         if(b==1){
                         var textWall = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+b+' Inside</span></div>';
		
                         }else {
 	                 var textWall = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+b+' Insides</span></div>';
		
                         }
                }else if(ident==2){
                        var a =  document.getElementById(totalArea).value;
			var b = document.getElementById(totalWall).value;
			var textArea = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+a/4+' Sets of 4 x 1\' x 1\' x 5/8 \" </span></div>';
			var textWall = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+b/4+' Sets of 4 x 1\' x 1\' x 5/8 \"</span></div>';

                }
                else{

			var a =  document.getElementById(totalArea).value;
			var b = document.getElementById(totalWall).value;
			if(a==1)var textArea = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+a+' Inside with detachable Corner & Border pieces</span></div>';
			else var textArea = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+a+' Insides with detachable Corner & Border pieces</span></div>';
		        if(b==1) var textWall = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+b+' Inside with detachable Corner & Border pieces</span></div>';
                        else var textWall = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+b+' Insides with detachable Corner & Border pieces</span></div>';
		}
		
		var totalArea = document.getElementById(totalArea).value;
		var costArea = document.getElementById(costArea).value;
		var totalWall = document.getElementById(totalWall).value;
		var costWall = document.getElementById(costWall).value;
		var sqftArea = Math.round(totalArea*sqft1);
		var sqftWall = Math.round(totalWall*sqft1);
		
		var count = 0;
		var count1 = 0;
		var totalWeightArea = 0;
		var totalWeightWall = 0;
		
		var masterCartonArea = Math.floor(totalArea/pieces);
		var partialCartonArea = totalArea - pieces*masterCartonArea;
		var masterCartonWall = Math.floor(totalWall/pieces);
		var partialCartonWall = totalWall - pieces*masterCartonWall;
		

		
		//FIRST CASE
		if(partialCartonArea != 0 && partialCartonWall != 0){
		   if(totalArea<=25){
			   var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';
                  html += '<div class="leftColumn"  style="float:left; margin-bottom:72px; margin-top: 6px; width:440px; " >';
		//  html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png" /></div>';	

                   }else{
	 	//AREA RUG HEADER
				var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';
                html += '<div class="leftColumn"  style="float:left;  margin-bottom:72px; width:440px; margin-top: 6px;" >';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png" /></div>';	
		}
                html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/finished.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalArea+'</span></div>';
		html+=''+textArea+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtArea+'\' x '+widthArea+'\' = '+sqftArea+' sq.ft.</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costArea)+'&nbsp;&nbsp;&nbsp;</span>($'+(price).toFixed(2)+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
		var thickArea = Math.round(partialCartonArea*thick1piece);
		var weightArea = Math.round(partialCartonArea*weight1p);
		var thickWall =  Math.round(partialCartonWall*thick1piece);
		var weightWall = Math.round(partialCartonWall*weight1p);		
		count+=1;
		totalWeightArea+=weightArea;
		for(var i=1; i<=masterCartonArea; i++){
		var masterCarton1Area = pieces;
		j = i+1;
		
		count+=1;
		}
		totalWeightArea+=(count-1)*weight25p;
		if(count == 1){
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count+'&nbsp;&nbsp;&nbsp;'+partialCartonArea+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickArea+'\" &nbsp;&nbsp;'+Math.round(weightArea)+' lbs</span></div>';
		var boxA = 'box';
                }else{
                var boxA = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack"> 1 of '+count+'&nbsp;&nbsp;&nbsp;'+partialCartonArea+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickArea+'\" &nbsp;&nbsp;'+Math.round(weightArea)+' lbs</span></div>';
                html+='<div class="leftSide"><span class="popTextBlack"> 2 to '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count+' '+boxA+'&nbsp;&nbsp;&nbsp;</span>'+totalArea+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightArea+' lbs</div>';
		html+='</div>';
                //WALL TO WALL HEADER
		 if(totalWall<25){
 		html += '<div class="rightColumn" style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;" >';
	//	html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png" /></div>';

                 }else{
		html += '<div class="rightColumn" style="float:left;  margin-bottom:72px; width:440px; margin-top: 6px;" >';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png" /></div>';
		}
                html += '<div style="margin-bottom: 4px; width:100px;"><img name="piecesImage" src="http://www.alessco.com/images/wall.png"></div>';
               //html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'a.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalWall+'</span></div>';
		html+=''+textWall+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWall+'\' x '+widthWall+'\' = '+sqftWall+' sq.ft.</span></div>';
	        html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costWall)+'&nbsp;&nbsp;&nbsp;</span>($'+(price).toFixed(2)+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
		//html+='<p>Box 1: &nbsp;&nbsp;'+partialCartonWall+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickWall+'\" &nbsp;&nbsp;'+Math.round(weightWall)+' lbs.</p>';
		count1+=1;
		totalWeightWall+=weightWall;
		for(var i=1; i<=masterCartonWall; i++){
		var masterCarton1Wall = pieces;
		k = i+1;
		/*html+='<p>Box '+k+': &nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\" &nbsp;&nbsp;'+weight25p+' lbs.</p>';*/
		count1+=1;
		}
		totalWeightWall+=(count1-1)*weight25p;
		if(count1 == 1){
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count1+'&nbsp;&nbsp;&nbsp;'+partialCartonWall+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickWall+'\" &nbsp;&nbsp;'+Math.round(weightWall)+' lbs</span></div>';
		var boxW = 'box';
                }else{
                var boxW = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count+'&nbsp;&nbsp;&nbsp;'+partialCartonWall+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickWall+'\" &nbsp;&nbsp;'+Math.round(weightWall)+' lbs</span></div>';
                html+='<div class="leftSide"><span class="popTextBlack"> 2 to '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count1+' '+boxW+'&nbsp;&nbsp;&nbsp;</span>'+totalWall+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightWall+' lbs</div>';
		html +='</div>';
                }

                //SECOND CASE
                else if(partialCartonArea != 0 && partialCartonWall == 0){
					
		 //AREA RUG HEADER
		if(totalWall<=25){
		var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';
		html += '<div style="float:left; margin-bottom:72px;  width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';	
                }else{			
                 var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';
		html += '<div style="float:left; margin-bottom:72px;  width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';	
		}
                html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/finished.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalArea+'</span></div>';
		html+=''+textArea+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtArea+'\' x '+widthArea+'\' = '+sqftArea+' sq.ft.</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costArea)+'&nbsp;&nbsp;&nbsp;</span>($'+(price).toFixed(2)+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
					
		var thickArea = Math.round(partialCartonArea*thick1piece);
		var weightArea = Math.round(partialCartonArea*weight1p);
		var thickWall =  Math.round(thickTotal);
		
		
		count+=1;
		totalWeightArea+=weightArea;
		for(var i=1; i<=masterCartonArea; i++){
		var masterCarton1Area = pieces;
		j = i+1;
		count+=1;
		}
		
		if(count == 1){
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count+'&nbsp;&nbsp;&nbsp;'+partialCartonArea+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickArea+'\" &nbsp;&nbsp;'+Math.round(weightArea)+' lbs</span></div>';
		var boxA = 'box';
                }else{
                var boxA = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></span></div><div class="leftSide"><span class="popTextBlack"> 1 of '+count+'&nbsp;&nbsp;&nbsp;'+partialCartonArea+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickArea+'\" &nbsp;&nbsp;'+Math.round(weightArea)+' lbs</span></div>';
                html+='<div class="leftSide"><span class="popTextBlack"> 2 to '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		totalWeightArea+=(count-1)*weight25p;
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count+' '+boxA+'&nbsp;&nbsp;&nbsp;</span>'+totalArea+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightArea+' lbs</div>';
		html+='</div>';
		//WALL TO WALL HEADER
		if(totalWall<=25){
		html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
	//	html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';

                }else{
		html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
	//	html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';
		}
                html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/wall.png"></div>';
               // html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'a.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalWall+'</span></div>';
		html+=''+textWall+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWall+'\' x '+widthWall+'\' = '+sqftWall+' sq.ft.</span></div>';
	        html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costWall)+'&nbsp;&nbsp;&nbsp;</span>($'+price+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
                for(var i=1; i<=masterCartonWall; i++){
		k = i+1;
		
		count1+=1;
		}
		totalWeightWall+=(count1)*weight25p;
                if(count1 == 1){
                var boxW = 'box';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }else{
                var boxW = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 to '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count1+' '+boxW+'&nbsp;&nbsp;&nbsp;</span>'+totalWall+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightWall+' lbs</div>';
                html+='</div>';
                }

                //THIRD CASE
                else if(partialCartonArea == 0 && partialCartonWall != 0){
					
		//AREA RUG HEADER
					
                var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';
		html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';	
		html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/finished.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalArea+'</span></div>';
		html+=''+textArea+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtArea+'\' x '+widthArea+'\' = '+sqftArea+' sq.ft.</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costArea)+'&nbsp;&nbsp;&nbsp;</span>($'+price+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
					
		var thickWall =  Math.round(partialCartonWall*thick1piece);
		var weightWall = Math.round(partialCartonWall*weight1p);
		
                for(var i=1; i<=masterCartonArea; i++){
		count+=1;
		}
		totalWeightArea+=(count)*weight25p;
		if(count == 1){
                var boxA = 'box';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }else{
                var boxA = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 to '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count+' '+boxA+'&nbsp;&nbsp;&nbsp;</span>'+totalArea+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightArea+' lbs</div>';
                html+='</div>';
	        //WALL TO WALL HEADER
	        html += '<div style="float:left; margin-bottom:72px;  width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';
		html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/wall.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'a.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalWall+'</span></div>';
		html+=''+textWall+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWall+'\' x '+widthWall+'\' = '+sqftWall+' sq.ft.</span></div>';
	        html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costWall)+'&nbsp;&nbsp;&nbsp;</span>($'+price+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
		count1+=1;
		totalWeightWall+=weightWall;
		for(var i=1; i<=masterCartonWall; i++){
		var masterCarton1Wall = pieces;
		k = i+1;
		count1+=1;
		}
		totalWeightWall+=(count1-1)*weight25p;
		if(count1 == 1){
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count1+'&nbsp;&nbsp;&nbsp;'+partialCartonWall+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickWall+'\" &nbsp;&nbsp;'+Math.round(weightWall)+' lbs</span></div>';
		var boxW = 'box';
                }else{
                var boxW = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count1+'&nbsp;&nbsp;&nbsp;'+partialCartonWall+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickWall+'\" &nbsp;&nbsp;'+Math.round(weightWall)+' lbs</span></div>';
                html+='<div class="leftSide"><span class="popTextBlack"> 2 to '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count1+' '+boxW+'&nbsp;&nbsp;&nbsp;</span>'+totalWall+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightWall+' lbs</div>';
		html+='</div>';
                }

                //FOURTH CASE
                else if(partialCartonArea == 0 && partialCartonWall == 0){
		 //AREA RUG HEADER
		 var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';		
                html += '<div style="float:left;  margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';	
		html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/finished.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalArea+'</span></div>';
		html+=''+textArea+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtArea+'\' x '+widthArea+'\' = '+sqftArea+' sq.ft.</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costArea)+'&nbsp;&nbsp;&nbsp;</span>($'+price+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
					
		for(var i=1; i<=masterCartonArea; i++){
		count+=1;
		}
		totalWeightArea+=(count)*weight25p;
		if(count == 1){
                var boxA = 'box';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }else{
                var boxA = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 to '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count+' '+boxA+'&nbsp;&nbsp;&nbsp;</span>'+totalArea+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightArea+' lbs</div>';
		 html+='</div>';
		//WALL TO WALL HEADER
		html += '<div style="float:left;  margin-bottom:72px; width:440px; margin-top: 6px;">';
	//	html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';
		html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/wall.png"></div>';
                //html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'a.png"></div>';
		
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalWall+'</span></div>';
                html+=''+textWall+'';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWall+'\' x '+widthWall+'\' = '+sqftWall+' sq.ft.</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costWall)+'&nbsp;&nbsp;&nbsp;</span>($'+price+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';

		
		for(var i=1; i<=masterCartonWall; i++){
		k = i+1;
		/*html+='<p>Box '+k+': &nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\" &nbsp;&nbsp;'+weight25p+' lbs.</p>';*/
		count1+=1;
		}
		totalWeightWall+=(count1)*weight25p;
                if(count1 == 1){
                var boxW = 'box';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }else{
                var boxW = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 to '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count1+' '+boxW+'&nbsp;&nbsp;&nbsp;</span>'+totalWall+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightWall+' lbs</div>';
		html+='</div>';
                }
		
		
		//html += '<div style="height: 40px;border: 1px solid;"></div>';
		/*getElementByClass('popTextRed');
		getElementByClass('popTextBlack');
		getElementByClass('rightSide');
		getElementByClass('leftSide');*/

                //myWindow.document.getElementById('boxes').innerHTML += html;
		//document.getElementById('boxes').style.top = position;
		//myWindow.document.getElementById('boxes').style.visibility="visible";
		return html;
		}
		
}
/**************************************************/
function countBoxes4(totalArea, totalWall, pieces, thick1piece, weight1p, weight25p, widthTotal, heightTotal,thickTotal, costArea, costWall, sqft1, position, sqftOnePice, thickOnePiece, price, name, ident, header ){
	
	if(document.getElementById(totalArea).value==0 || document.getElementById(totalWall).value==0){
		//alert(document.getElementById(totalArea).value);
		//document.getElementById('boxes').style.visibility = 'hidden';
	}else{
		var lenghtArea = document.getElementById('lenght4by4Area').value;
		var widthArea = document.getElementById('width4by4Area').value;
		var lenghtWall = document.getElementById('lenght4by4Wall').value;
		var widthWall = document.getElementById('width4by4Wall').value;
		
		
		
		if(ident==0){
			var a =  document.getElementById(totalArea).value;
			var b = document.getElementById(totalWall).value;
			var lenghtArea = document.getElementById('lenghtArea').value;
			var widthArea = document.getElementById('widthArea').value;
			var lenghtWall = document.getElementById('lenghtWall').value;
			var widthWall = document.getElementById('widthWall').value;
			
			var corner =4;
			var borderArea = document.getElementById('borderArea').value;
			var insideArea =  document.getElementById('insideArea').value;
			var borderWall = document.getElementById('borderWall').value;
			var insideWall =  document.getElementById('insideWall').value;
			var textArea = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+corner+' Corners + '+borderArea+ ' Borders + '+insideArea+' Insides = &nbsp;'+a+' Pieces</span></div>';
			var textWall = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+corner+' Corners + '+borderWall+ ' Borders + '+insideWall+' Insides = &nbsp;'+b+' Pieces</span></div>';
			
		}else{
			var a =  document.getElementById(totalArea).value;
			var b = document.getElementById(totalWall).value;
			var textArea = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+a+' Insides with detachable Corner & Border pieces</span></div>';
			var textWall = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+b+' Insides with detachable Corner & Border pieces</span></div>';
		}
		
		var totalArea = document.getElementById(totalArea).value;
		var costArea = document.getElementById(costArea).value;
		var totalWall = document.getElementById(totalWall).value;
		var costWall = document.getElementById(costWall).value;
		var sqftArea = Math.round(totalArea*sqft1);
		var sqftWall = Math.round(totalWall*sqft1);
		
		var count = 0;
		var count1 = 0;
		var totalWeightArea = 0;
		var totalWeightWall = 0;
		
		var masterCartonArea = Math.floor(totalArea/pieces);
		var partialCartonArea = totalArea - pieces*masterCartonArea;
		var masterCartonWall = Math.floor(totalWall/pieces);
		var partialCartonWall = totalWall - pieces*masterCartonWall;
		

		
		//FIRST CASE
		if(partialCartonArea != 0 && partialCartonWall != 0){
		 //AREA RUG HEADER
		 if(totalArea<10){
                 var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';	
 		html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';	
                 }else{
                var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';	
		html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';	
		}
                html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/finished.png"></div>';
		//var html = '<div class="popMainTitle"><img name="piecesImage" src="images/heading'+header+'.png"></div>';
                //html += '<div style="float:left">';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/finished.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalArea+'</span></div>';
		html+=''+textArea+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtArea+'\' x '+widthArea+'\' = '+sqftArea+' sq.ft.</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costArea)+'&nbsp;&nbsp;&nbsp;</span>($'+price+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
		var thickArea = Math.round(partialCartonArea*thick1piece);
		var weightArea = Math.round(partialCartonArea*weight1p);
		var thickWall =  Math.round(partialCartonWall*thick1piece);
		var weightWall = Math.round(partialCartonWall*weight1p);		
		count+=1;
		totalWeightArea+=weightArea;
		for(var i=1; i<=masterCartonArea; i++){
		var masterCarton1Area = pieces;
		j = i+1;
		
		count+=1;
		}
		totalWeightArea+=(count-1)*weight25p;
		if(count == 1){
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count+'&nbsp;&nbsp;&nbsp;'+partialCartonArea+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickArea+'\" &nbsp;&nbsp;'+Math.round(weightArea)+' lbs</span></div>';
		var boxA = 'box';
                }else{
                var boxA = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack"> 1 of '+count+'&nbsp;&nbsp;&nbsp;'+partialCartonArea+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickArea+'\" &nbsp;&nbsp;'+Math.round(weightArea)+' lbs</span></div>';
                html+='<div class="leftSide"><span class="popTextBlack"> 2 to '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count+' '+boxA+'&nbsp;&nbsp;&nbsp;</span>'+totalArea+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightArea+' lbs</div>';
		html+='</div>';
                //WALL TO WALL HEADER
                if(totalWall<10){
                html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';
                }else{
                html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';
		}
                html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/wall.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'a.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalWall+'</span></div>';
		html+=''+textWall+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWall+'\' x '+widthWall+'\' = '+sqftWall+' sq.ft.</span></div>';
	        html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costWall)+'&nbsp;&nbsp;&nbsp;</span>($'+price+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
		//html+='<p>Box 1: &nbsp;&nbsp;'+partialCartonWall+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickWall+'\" &nbsp;&nbsp;'+Math.round(weightWall)+' lbs.</p>';
		count1+=1;
		totalWeightWall+=weightWall;
		for(var i=1; i<=masterCartonWall; i++){
		var masterCarton1Wall = pieces;
		k = i+1;
		/*html+='<p>Box '+k+': &nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\" &nbsp;&nbsp;'+weight25p+' lbs.</p>';*/
		count1+=1;
		}
		totalWeightWall+=(count1-1)*weight25p;
		if(count1 == 1){
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count1+'&nbsp;&nbsp;&nbsp;'+partialCartonWall+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickWall+'\" &nbsp;&nbsp;'+Math.round(weightWall)+' lbs</span></div>';
		var boxW = 'box';
                }else{
                var boxW = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count+'&nbsp;&nbsp;&nbsp;'+partialCartonWall+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickWall+'\" &nbsp;&nbsp;'+Math.round(weightWall)+' lbs</span></div>';
                html+='<div class="leftSide"><span class="popTextBlack"> 2 to '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count1+' '+boxW+'&nbsp;&nbsp;&nbsp;</span>'+totalWall+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightWall+' lbs</div>';
		html+='</div>';
                }

                //SECOND CASE
                else if(partialCartonArea != 0 && partialCartonWall == 0){
					 //AREA RUG HEADER
		if(totalWall<=10){
                var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';	
                html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';	

                }else{			
                var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';	
                html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';	
		}
                html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/finished.png"></div>';
		//var html = '<div class="popMainTitle"><img name="piecesImage" src="images/heading'+header+'.png"></div>';
                //html += '<div style="float:left">';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/finished.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalArea+'</span></div>';
		html+=''+textArea+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtArea+'\' x '+widthArea+'\' = '+sqftArea+' sq.ft.</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costArea)+'&nbsp;&nbsp;&nbsp;</span>($'+price+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
		var thickArea = Math.round(partialCartonArea*thick1piece);
		var weightArea = Math.round(partialCartonArea*weight1p);
		var thickWall =  Math.round(thickTotal);
		
		
		count+=1;
		totalWeightArea+=weightArea;
		for(var i=1; i<=masterCartonArea; i++){
		var masterCarton1Area = pieces;
		j = i+1;
		count+=1;
		}
		
		if(count == 1){
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count+'&nbsp;&nbsp;&nbsp;'+partialCartonArea+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickArea+'\" &nbsp;&nbsp;'+Math.round(weightArea)+' lbs</span></div>';
		var boxA = 'box';
                }else{
                var boxA = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack"> 1 of '+count+'&nbsp;&nbsp;&nbsp;'+partialCartonArea+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickArea+'\" &nbsp;&nbsp;'+Math.round(weightArea)+' lbs</span></div>';
                html+='<div class="leftSide"><span class="popTextBlack"> 2 to '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		totalWeightArea+=(count-1)*weight25p;
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count+' '+boxA+'&nbsp;&nbsp;&nbsp;</span>'+totalArea+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightArea+' lbs</div>';
		html+='</div>';
		//WALL TO WALL HEADER
		if(totalWall<=10){
		html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';

                }else{
		html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 4px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';
		}
                html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/wall.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'a.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalWall+'</span></div>';
		html+=''+textWall+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWall+'\' x '+widthWall+'\' = '+sqftWall+' sq.ft.</span></div>';
	        html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costWall)+'&nbsp;&nbsp;&nbsp;</span>($'+price+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
                for(var i=1; i<=masterCartonWall; i++){
		k = i+1;
		
		count1+=1;
		}
		totalWeightWall+=(count1)*weight25p;
                if(count1 == 1){
                var boxW = 'box';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }else{
                var boxW = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 to '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count1+' '+boxW+'&nbsp;&nbsp;&nbsp;</span>'+totalWall+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightWall+' lbs</div>';
                html+='</div>';
                }

                //THIRD CASE

                else if(partialCartonArea == 0 && partialCartonWall != 0){
					 //AREA RUG HEADER
                var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';	
                html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';	
		html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/finished.png"></div>';
		//var html = '<div class="popMainTitle"><img name="piecesImage" src="images/heading'+header+'.png"></div>';
                //html += '<div style="float:left">';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/finished.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalArea+'</span></div>';
		html+=''+textArea+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtArea+'\' x '+widthArea+'\' = '+sqftArea+' sq.ft.</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costArea)+'&nbsp;&nbsp;&nbsp;</span>($'+price+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
		var thickWall =  Math.round(partialCartonWall*thick1piece);
		var weightWall = Math.round(partialCartonWall*weight1p);
		
                for(var i=1; i<=masterCartonArea; i++){
		count+=1;
		}
		totalWeightArea+=(count)*weight25p;
		if(count == 1){
                var boxA = 'box';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }else{
                var boxA = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 to '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count+' '+boxA+'&nbsp;&nbsp;&nbsp;</span>'+totalArea+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightArea+' lbs</div>';
                html+='</div>';
	        //WALL TO WALL HEADER
		html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';
		html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/wall.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'a.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalWall+'</span></div>';
		html+=''+textWall+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWall+'\' x '+widthWall+'\' = '+sqftWall+' sq.ft.</span></div>';
	        html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costWall)+'&nbsp;&nbsp;&nbsp;</span>($'+price+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
		count1+=1;
		totalWeightWall+=weightWall;
		for(var i=1; i<=masterCartonWall; i++){
		var masterCarton1Wall = pieces;
		k = i+1;
		count1+=1;
		}
		totalWeightWall+=(count1-1)*weight25p;
		if(count1 == 1){
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count1+'&nbsp;&nbsp;&nbsp;'+partialCartonWall+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickWall+'\" &nbsp;&nbsp;'+Math.round(weightWall)+' lbs</span></div>';
		var boxW = 'box';
                }else{
                var boxW = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count1+'&nbsp;&nbsp;&nbsp;'+partialCartonWall+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickWall+'\" &nbsp;&nbsp;'+Math.round(weightWall)+' lbs</span></div>';
                html+='<div class="leftSide"><span class="popTextBlack"> 2 to '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\" &nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count1+' '+boxW+'&nbsp;&nbsp;&nbsp;</span>'+totalWall+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightWall+' lbs</div>';
		html+='</div>';
                }

                //FOURTH CASE
                else if(partialCartonArea == 0 && partialCartonWall == 0){
					 //AREA RUG HEADER
                var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';	
                html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';	
		html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/finished.png"></div>';
		//var html = '<div class="popMainTitle"><img name="piecesImage" src="images/heading'+header+'.png"></div>';
                //html += '<div style="float:left">';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/finished.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalArea+'</span></div>';
		html+=''+textArea+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtArea+'\' x '+widthArea+'\' = '+sqftArea+' sq.ft.</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costArea)+'&nbsp;&nbsp;&nbsp;</span>($'+price+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
		for(var i=1; i<=masterCartonArea; i++){
		count+=1;
		}
		totalWeightArea+=(count)*weight25p;
		if(count == 1){
                var boxA = 'box';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }else{
                var boxA = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 to '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count+' '+boxA+'&nbsp;&nbsp;&nbsp;</span>'+totalArea+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightArea+' lbs</div>';
		html+='</div>';
		
		//WALL TO WALL HEADER
		html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';
		html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/wall.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'a.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalWall+'</span></div>';
                html+=''+textWall+'';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWall+'\' x '+widthWall+'\' = '+sqftWall+' sq.ft.</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costWall)+'&nbsp;&nbsp;&nbsp;</span>($'+price+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';

		
		for(var i=1; i<=masterCartonWall; i++){
		k = i+1;
		/*html+='<p>Box '+k+': &nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\" &nbsp;&nbsp;'+weight25p+' lbs.</p>';*/
		count1+=1;
		}
		totalWeightWall+=(count1)*weight25p;
                if(count1 == 1){
                var boxW = 'box';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }else{
                var boxW = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 to '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count1+' '+boxW+'&nbsp;&nbsp;&nbsp;</span>'+totalWall+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightWall+' lbs</div>';
		
                html+='</div>';
                }
		/*getElementByClass('popTextRed');
		getElementByClass('popTextBlack');
		getElementByClass('rightSide');
		getElementByClass('leftSide'); */
		//myWindow.document.getElementById('boxes').innerHTML += html;
		//myWindow.document.getElementById('boxes').style.top = position;
		//myWindow.document.getElementById('boxes').style.visibility="visible";
		return html;
		
		}
}
/******************************************************/
function countBoxes1(totalArea, totalWall, pieces, thick1piece, weight1p, weight25p, widthTotal, heightTotal,thickTotal, costArea, costWall, sqft1, position, sqftOnePice, thickOnePiece, price, name, ident, header ){
	
	if(document.getElementById(totalArea).value==0 || document.getElementById(totalWall).value==0){
		//alert('Insert dimensions');
		//document.getElementById('boxes').style.visibility = 'hidden';
	}else{
	
		var lenghtArea = document.getElementById('lenght1mby1mArea').value;
		var widthArea = document.getElementById('width1mby1mArea').value;
		var lenghtWall = document.getElementById('lenght1mby1mWall').value;
		var widthWall = document.getElementById('width1mby1mWall').value;
		
		var lenghtAreaFeet =  Math.floor(lenghtArea);
		var lenghtAreaInch =  ((lenghtArea - lenghtAreaFeet)*12).toFixed(0);
		var widthAreaFeet = Math.floor(widthArea);
		var widthAreaInch =  ((widthArea - widthAreaFeet)*12).toFixed(0);
                var lenghtWallFeet =  Math.floor(lenghtWall);
		var lenghtWallInch =  ((lenghtWall - lenghtWallFeet)*12).toFixed(0);
		var widthWallFeet = Math.floor(widthWall);
		var widthWallInch =  ((widthWall - widthWallFeet)*12).toFixed(0);
		
		if(ident==0){
			var a =  document.getElementById(totalArea).value;
			var b = document.getElementById(totalWall).value;
			var lenghtArea = document.getElementById('lenghtArea').value;
			var widthArea = document.getElementById('widthArea').value;
			var lenghtWall = document.getElementById('lenghtWall').value;
			var widthWall = document.getElementById('widthWall').value;
			
			var corner =4;
			var borderArea = document.getElementById('borderArea').value;
			var insideArea =  document.getElementById('insideArea').value;
			var borderWall = document.getElementById('borderWall').value;
			var insideWall =  document.getElementById('insideWall').value;
			var textArea = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+corner+' Corners + '+borderArea+ ' Borders + '+insideArea+' Insides = &nbsp;'+a+' Pieces</span></div>';
			var textWall = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+corner+' Corners + '+borderWall+ ' Borders + '+insideWall+' Insides = &nbsp;'+b+' Pieces</span></div>';
			
		}else{
			var a =  document.getElementById(totalArea).value;
			var b = document.getElementById(totalWall).value;
			var textArea = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+a+' Insides with detachable Corner & Border pieces</span></div>';
			var textWall = '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">'+b+' Insides with detachable Corner & Border pieces</span></div>';
		}
		
		var totalArea = document.getElementById(totalArea).value;
		var costArea = document.getElementById(costArea).value;
		var totalWall = document.getElementById(totalWall).value;
		var costWall = document.getElementById(costWall).value;
		var sqftArea = Math.round(totalArea*sqft1);
		var sqftWall = Math.round(totalWall*sqft1);
		
		var count = 0;
		var count1 = 0;
		var totalWeightArea = 0;
		var totalWeightWall = 0;
		
		var masterCartonArea = Math.floor(totalArea/pieces);
		var partialCartonArea = totalArea - pieces*masterCartonArea;
		var masterCartonWall = Math.floor(totalWall/pieces);
		var partialCartonWall = totalWall - pieces*masterCartonWall;
		

		//FIRST CASE
		if(partialCartonArea != 0 && partialCartonWall != 0){
			//AREA RUG HEADER
		var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';	
		html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';	
		html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/finished.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalArea+'</span></div>';
		html+=''+textArea+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtAreaFeet+'\' '+lenghtAreaInch+'\" x '+widthAreaFeet+'\' '+widthAreaInch+'\" = '+sqftArea+' sq.ft.</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+addCommas(costArea)+'&nbsp;&nbsp;&nbsp;</span>($'+(price).toFixed(2)+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
		
		var thickArea = Math.round(partialCartonArea*thick1piece);
		var weightArea = Math.round(partialCartonArea*weight1p);
		var thickWall =  Math.round(partialCartonWall*thick1piece);
		var weightWall = Math.round(partialCartonWall*weight1p);		
		count+=1;
		totalWeightArea+=weightArea;
		for(var i=1; i<=masterCartonArea; i++){
		var masterCarton1Area = pieces;
		j = i+1;
		
		count+=1;
		}
		totalWeightArea+=(count-1)*weight25p;
		if(count == 1){
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count+'&nbsp;&nbsp;&nbsp;'+partialCartonArea+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickArea+'\" &nbsp;&nbsp;'+Math.round(weightArea)+' lbs</span></div>';
		var boxA = 'box';
                }else{
                var boxA = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack"> 1 of '+count+'&nbsp;&nbsp;&nbsp;'+partialCartonArea+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickArea+'\" &nbsp;&nbsp;'+Math.round(weightArea)+' lbs</span></div>';
                html+='<div class="leftSide"><span class="popTextBlack"> 2 to '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count+' '+boxA+'&nbsp;&nbsp;&nbsp;</span>'+totalArea+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightArea+' lbs</div>';
		html+='</div>';
		
                //WALL TO WALL HEADER	
		html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';
		html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/wall.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'a.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalWall+'</span></div>';
		html+=''+textWall+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWallFeet+'\' '+lenghtWallInch+'\" x '+widthWallFeet+'\' '+widthWallInch+'\" = '+sqftWall+' sq.ft.</span></div>';
	        html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costWall)+'&nbsp;&nbsp;&nbsp;</span>($'+(price).toFixed(2)+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
		//html+='<p>Box 1: &nbsp;&nbsp;'+partialCartonWall+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickWall+'\" &nbsp;&nbsp;'+Math.round(weightWall)+' lbs.</p>';
		count1+=1;
		totalWeightWall+=weightWall;
		for(var i=1; i<=masterCartonWall; i++){
		var masterCarton1Wall = pieces;
		k = i+1;
		/*html+='<p>Box '+k+': &nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\" &nbsp;&nbsp;'+weight25p+' lbs.</p>';*/
		count1+=1;
		}
		totalWeightWall+=(count1-1)*weight25p;
		if(count1 == 1){
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count1+'&nbsp;&nbsp;&nbsp;'+partialCartonWall+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickWall+'\" &nbsp;&nbsp;'+Math.round(weightWall)+' lbs</span></div>';
		var boxW = 'box';
                }else{
                var boxW = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count+'&nbsp;&nbsp;&nbsp;'+partialCartonWall+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickWall+'\" &nbsp;&nbsp;'+Math.round(weightWall)+' lbs</span></div>';
                html+='<div class="leftSide"><span class="popTextBlack"> 2 to '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count1+' '+boxW+'&nbsp;&nbsp;&nbsp;</span>'+totalWall+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightWall+' lbs</div>';
		html+='</div>';
                }

                //SECOND CASE
                else if(partialCartonArea != 0 && partialCartonWall == 0){
					//AREA RUG HEADER
		var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';	
		 html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png" /></div>';	
		html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/finished.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalArea+'</span></div>';
		html+=''+textArea+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtAreaFeet+'\' '+lenghtAreaInch+'\" x '+widthAreaFeet+'\' '+widthAreaInch+'\" = '+sqftArea+' sq.ft.</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+addCommas(costArea)+'&nbsp;&nbsp;&nbsp;</span>($'+(price).toFixed(2)+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
		var thickArea = Math.round(partialCartonArea*thick1piece);
		var weightArea = Math.round(partialCartonArea*weight1p);
		var thickWall =  Math.round(thickTotal);
		
		
		count+=1;
		totalWeightArea+=weightArea;
		for(var i=1; i<=masterCartonArea; i++){
		var masterCarton1Area = pieces;
		j = i+1;
		count+=1;
		}
		
		if(count == 1){
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count+'&nbsp;&nbsp;&nbsp;'+partialCartonArea+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickArea+'\" &nbsp;&nbsp;'+Math.round(weightArea)+' lbs</span></div>';
		var boxA = 'box';
                }else{
                var boxA = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack"> 1 of '+count+'&nbsp;&nbsp;&nbsp;'+partialCartonArea+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickArea+'\" &nbsp;&nbsp;'+Math.round(weightArea)+' lbs</span></div>';
                html+='<div class="leftSide"><span class="popTextBlack"> 2 to '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		totalWeightArea+=(count-1)*weight25p;
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count+' '+boxA+'&nbsp;&nbsp;&nbsp;'+totalArea+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightArea+' lbs</span></div>';
		html+='</div>';
		//WALL TO WALL HEADER
		html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';
		html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/wall.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'a.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalWall+'</span></div>';
		html+=''+textWall+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWallFeet+'\' '+lenghtWallInch+'\" x '+widthWallFeet+'\' '+widthWallInch+'\" = '+sqftWall+' sq.ft.</span></div>';
	        html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costWall)+'&nbsp;&nbsp;&nbsp;</span>($'+(price).toFixed(2)+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
                for(var i=1; i<=masterCartonWall; i++){
		k = i+1;
		
		count1+=1;
		}
		totalWeightWall+=(count1)*weight25p;
                if(count1 == 1){
                var boxW = 'box';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }else{
                var boxW = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 to '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count1+' '+boxW+'&nbsp;&nbsp;&nbsp;</div>'+totalWall+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightWall+' lbs</span>';
                html+='</div>';
                }

                //THIRD CASE
                else if(partialCartonArea == 0 && partialCartonWall != 0){
					//AREA RUG HEADER
		var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';	
		 html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';	
		html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/finished.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalArea+'</span></div>';
		html+=''+textArea+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtAreaFeet+'\' '+lenghtAreaInch+'\" x '+widthAreaFeet+'\' '+widthAreaInch+'\" = '+sqftArea+' sq.ft.</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+addCommas(costArea)+'&nbsp;&nbsp;&nbsp;</span>($'+price+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
		var thickWall =  Math.round(partialCartonWall*thick1piece);
		var weightWall = Math.round(partialCartonWall*weight1p);
		
                for(var i=1; i<=masterCartonArea; i++){
		count+=1;
		}
		totalWeightArea+=(count)*weight25p;
		if(count == 1){
                var boxA = 'box';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }else{
                var boxA = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 to '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count+' '+boxA+'&nbsp;&nbsp;&nbsp;</span>'+totalArea+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightArea+' lbs</div>';
                html+='</div>';
	        //WALL TO WALL HEADER
	        html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 9px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';
		html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/wall.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'a.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalWall+'</span></div>';
		html+=''+textWall+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWallFeet+'\' '+lenghtWallInch+'\" x '+widthWallFeet+'\' '+widthWallInch+'\" = '+sqftWall+' sq.ft.</span></div>';
	        html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costWall)+'&nbsp;&nbsp;&nbsp;</span>($'+(price).toFixed(2)+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
		count1+=1;
		totalWeightWall+=weightWall;
		for(var i=1; i<=masterCartonWall; i++){
		var masterCarton1Wall = pieces;
		k = i+1;
		count1+=1;
		}
		totalWeightWall+=(count1-1)*weight25p;
		if(count1 == 1){
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count1+'&nbsp;&nbsp;&nbsp;'+partialCartonWall+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickWall+'\" &nbsp;&nbsp;'+Math.round(weightWall)+' lbs</span></div>';
		var boxW = 'box';
                }else{
                var boxW = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count1+'&nbsp;&nbsp;&nbsp;'+partialCartonWall+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickWall+'\" &nbsp;&nbsp;'+Math.round(weightWall)+' lbs</span></div>';
                html+='<div class="leftSide"><span class="popTextBlack"> 2 to '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count1+' '+boxW+'&nbsp;&nbsp;&nbsp;</span>'+totalWall+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightWall+' lbs</div>';
		html+='</div>';
                }

                //FOURTH CASE
                else if(partialCartonArea == 0 && partialCartonWall == 0){
					//AREA RUG HEADER
		var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';	
		html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';	
		html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/finished.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalArea+'</span></div>';
		html+=''+textArea+'';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtAreaFeet+'\' '+lenghtAreaInch+'\" x '+widthAreaFeet+'\' '+widthAreaInch+'\" = '+sqftArea+' sq.ft.</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+addCommas(costArea)+'&nbsp;&nbsp;&nbsp;</span>($'+(price).toFixed(2)+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';
		
		for(var i=1; i<=masterCartonArea; i++){
		count+=1;
		}
		totalWeightArea+=(count)*weight25p;
		if(count == 1){
                var boxA = 'box';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }else{
                var boxA = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 to '+count+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\"&nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count+' '+boxA+'&nbsp;&nbsp;&nbsp;</span>'+totalArea+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightArea+' lbs</div>';
		html+='</div>';
		//WALL TO WALL HEADER
		html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 9px;">';
		//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';
		html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/wall.png"></div>';
		//html += '<div class="popMainTitle"><img name="piecesImage" src="images/head'+header+'a.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalWall+'</span></div>';
                html+=''+textWall+'';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWallFeet+'\' '+lenghtWallInch+'\" x '+widthWallFeet+'\' '+widthWallInch+'\" = '+sqftWall+' sq.ft.</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+	addCommas(costWall)+'&nbsp;&nbsp;&nbsp;</span>($'+(price).toFixed(2)+' sq.ft. or $'+(price*sqft1).toFixed(2)+' per piece)</div>';

		
		for(var i=1; i<=masterCartonWall; i++){
		k = i+1;
		/*html+='<p>Box '+k+': &nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\" &nbsp;&nbsp;'+weight25p+' lbs.</p>';*/
		count1+=1;
		}
		totalWeightWall+=(count1)*weight25p;
                if(count1 == 1){
                var boxW = 'box';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 of '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\" &nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }else{
                var boxW = 'boxes';
                html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">1 to '+count1+'&nbsp;&nbsp;&nbsp;'+pieces+' pieces &nbsp;&nbsp;'+widthTotal+'\" x '+heightTotal+'\" x '+thickTotal+'\" &nbsp;&nbsp;&nbsp;'+weight25p+' lbs</span></div>';
                }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+count1+' '+boxW+'&nbsp;&nbsp;&nbsp;</span>'+totalWall+' pieces&nbsp;&nbsp;&nbsp;'+totalWeightWall+' lbs</div>';
		html+='</div>';
                }
		/*getElementByClass('popTextRed');
		getElementByClass('popTextBlack');
		getElementByClass('rightSide');
		getElementByClass('leftSide');*/
		//myWindow.document.getElementById('boxes').innerHTML += html;
		//myWindow.document.getElementById('boxes').style.top = position;
		//myWindow.document.getElementById('boxes').style.visibility="visible";
		return html;
		}
}

function playLearn(totalArea, totalWall, header, cost1310, cost1311){
	
	 if(document.getElementById(totalArea).value==0 || document.getElementById(totalWall).value==0){
		//alert('Insert dimensions');
		//document.getElementById('boxes').style.visibility = 'hidden';
	}else{
	var lenghtArea = document.getElementById('lenghtPLArea').value;
	var widthArea = document.getElementById('widthPLArea').value;
	var lenghtWall = document.getElementById('lenghtPLWall').value;
	var widthWall = document.getElementById('widthPLWall').value;
	
	var lenght1310 = 26;
	var width1310 = 15;
	var height1310 = 14;
	var weight1310 = 13;
	
	var lenght1311 = 26;
	var width1311 = 25;
	var height1311 = 14;
	var weight1311 = 24;
	
	var position = '0px';
	
	var area = document.getElementById(totalArea).value;
	var wall = document.getElementById(totalWall).value;
	
	var edgesArea = 2*lenghtArea + 2*widthArea;
	var edgesWall = 2*lenghtWall + 2*widthWall;
	
	var cost1310 = new Number(cost1310);
	var cost1311 = new Number(cost1311);
	
	var moreBoxesArea = '';
	
	
	
	/*ARE   RUG*/
	var html = '<div><img name="oo" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" /></div>';	
	html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 6px;">';
	//html += '<div class="popMainTitle" style="margin-bottom:6px;" ><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';	
	html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/finished.png"></div>';
        /*COUNTING AREA PIECES*/
	if(area <= 36){
		if(area < 36){
		var extraPiecesArea = 36-area;
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">1 Set of Style 1310 = '+36+' total pieces minus '+area+' needed pieces = '+extraPiecesArea+' extra pieces which can be used for cubes, names, walls, etc.</span></div>';
		}else{
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">1 Set of Style 1310 = '+36+' total pieces</span></div>';
	        }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtArea+'\' 6\" x '+widthArea+'\' 6\"</span></div>';	
		var costArea = cost1310;
		var commentArea = '($'+cost1310+' per set of style 1310)';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+costArea+'</span>&nbsp;&nbsp;&nbsp;'+commentArea+'</div>';
		
		var boxArea ='1 of 1&nbsp;&nbsp;&nbsp; 36 pieces&nbsp;&nbsp;&nbsp; 26\" x 15\" x 14\"&nbsp;&nbsp;&nbsp;13lbs';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">'+boxArea+'</span></div>';
		var totalA = '<span class="popTextRed">1 box</span>&nbsp;&nbsp;&nbsp;36 pieces&nbsp;&nbsp;&nbsp;13lbs';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide">'+totalA+'</div>';
		if(area<36){
			//html+='<div class="popMainTitle1"><div class="leftSide"><span class="popRoyalBlue"><span class = "popBlueTitle">*extra pieces can be used for cubes, names, walls, etc.</span></span></div></div>';
			
		}
	
	}else if(area > 36 && area < 72 || area == 72){
	      var costArea = cost1311;
	      var commentArea = '($'+cost1311+' per set of style 1311)';
	      var boxArea ='1 of 1&nbsp;&nbsp;&nbsp;72 pieces&nbsp;&nbsp;&nbsp;26\" x 25\" x 14\"&nbsp;&nbsp;&nbsp;24lbs';
              var totalA = '<span class="popTextRed">1 box&nbsp;&nbsp;&nbsp;</span>72 pieces&nbsp;&nbsp;&nbsp;24lbs';
              if(area == 72){
              html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">1 Set of Style 1311 = 72 total pieces</span></div>';
              }else if(area > 36 && area < 72){
              var extraPiecesArea = 72 - area;
              html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">1 Set of Style 1311 = '+72+' total pieces minus '+area+' needed pieces = '+extraPiecesArea+' extra pieces which can be used for cubes, names, walls, etc.</span></div>';
              }
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtArea+'\' 6\" x '+widthArea+'\' 6\"</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+costArea+'&nbsp;&nbsp;&nbsp;</span>'+commentArea+'</div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">'+boxArea+'</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide">'+totalA+'</div>';
              if(area > 36 && area < 72){
              //html+='<div class="popMainTitle1"><div class="leftSide"><span class="popRoyalBlue"><span class = "popBlueTitle">*extra pieces can be used for cubes, names, walls, etc.</span></span></div></div>';
              }


        }else if(area > 72){
              var setArea = Math.floor(area/72);
              var difArea = area - 72*setArea;
              if(setArea == 1 ){var set = 'Set';}else{var set = 'Sets';}
        if(difArea <= 36 && difArea != 0){
              var totalSet = setArea*72 + 36;
              var extraPieces = totalSet - area;
              var totalBoxArea = setArea +1;
              var totalWeight = weight1311*setArea + weight1310;		
              var costArea = addCommas((setArea*cost1311 + cost1310).toFixed(2));
              var commentArea = '($'+cost1310+' per set of style 1310 and $'+cost1311+' per set of style 1311)';
              var boxArea ='1 of '+totalBoxArea+'&nbsp;&nbsp;&nbsp;36 pieces&nbsp;&nbsp;&nbsp; 26\" x 15\" x 14\"&nbsp;&nbsp;&nbsp;13lbs';
              var moreBoxesArea = '2 to '+totalBoxArea+'&nbsp;&nbsp;&nbsp;72 pieces&nbsp;&nbsp;&nbsp;26\" x 25\" x 14\"&nbsp;&nbsp;&nbsp;24lbs';
              var totalA = '<span class="popTextRed">'+totalBoxArea+' boxes</span>&nbsp;&nbsp;&nbsp;'+totalSet+' pieces&nbsp;&nbsp;&nbsp;'+totalWeight+'lbs';
              if(difArea == 36){
              html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">Combine 1 Set of Style 1310 + '+setArea+' '+set+' of Style 1311 = '+totalSet+' total pieces</span></div>';
              }else{
              html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">Combine 1 Set of Style 1310 + '+setArea+' '+set+' of Style 1311 = '+totalSet+' total pieces minus '+area+' needed pieces = '+extraPieces+' extra pieces which can be used for cubes, names, walls, etc.</span></div>';
              }
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtArea+'\' 6\" x '+widthArea+'\' 6\"</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+costArea+'&nbsp;&nbsp;&nbsp;</span> '+commentArea+'</div>';		
	      html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">'+boxArea+'</span></div>';
              html+='<div class="leftSide"><span class="popTextBlack">'+moreBoxesArea+'</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide">'+totalA+'</div>';
              if(difArea != 36){
              //html+='<div class="popMainTitle1"><div class="leftSide"><span class="popRoyalBlue"><span class = "popBlueTitle">*extra pieces can be used for cubes, names, walls, etc.</span></span></div></div>';
              }
        }else if(difArea == 0){
              var totalSet = setArea*72;
              var extraPieces = totalSet - area;
              var costArea = addCommas((setArea*cost1311).toFixed(2));
              var totalWeight = weight1311*setArea;
              var commentArea = '($'+cost1311+' per set of style 1311)';
              var boxArea ='1 to '+setArea+'&nbsp;&nbsp;&nbsp;72 pieces&nbsp;&nbsp;&nbsp;26\" x 25\" x 14\"&nbsp;&nbsp;&nbsp;24lbs';
              var totalA = '<span class="popTextRed">'+setArea+' boxes&nbsp;&nbsp;&nbsp;</span>'+totalSet+' pieces&nbsp;&nbsp;&nbsp;'+totalWeight+'lbs';
              html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">Combine '+setArea+' '+set+' of Style 1311 = '+totalSet+' total pieces</span></span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtArea+'\' 6\" x '+widthArea+'\' 6\"</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+costArea+'&nbsp;&nbsp;&nbsp;</span> '+commentArea+'</div>';		
	      html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">'+boxArea+'</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide">'+totalA+'</div>';
			
			
        }else if(difArea > 36){
              setArea += 1;
              var totalSet = setArea*72;
              var costArea = addCommas((setArea*cost1311).toFixed(2));
              var commentArea = '($'+cost1311+' per set of style 1311)';
              var totalWeight = weight1311 * setArea;
              var extraPieces = totalSet - area;
              var totalA = '<span class="popTextRed">'+setArea+' boxes&nbsp;&nbsp;&nbsp;</span>'+totalSet+' pieces&nbsp;&nbsp;&nbsp;'+totalWeight+' lbs';
              html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">Combine '+setArea+' Sets of Style 1311 = '+totalSet+' total pieces minus '+area+' needed pieces = '+extraPieces+' extra pieces which can be used for cubes, names, walls, etc.</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtArea+'\' 6\" x '+widthArea+'\' 6\"</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+costArea+'&nbsp;&nbsp;&nbsp;</span>'+commentArea+'</div>';
	      var boxArea ='1 to '+setArea+'&nbsp;&nbsp;&nbsp; 72 Pieces&nbsp;&nbsp;&nbsp; 26\" x 25\" x 14\"&nbsp;&nbsp;&nbsp; 24lbs';
	      html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">'+boxArea+'</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide">'+totalA+'</div>';
              //html+='<div class="popMainTitle1"><div class="leftSide"><span class="popRoyalBlue"><span class = "popBlueTitle">*extra pieces can be used for cubes, names, walls, etc.</span></span></div></div>';
              }
			
        }
			html+='<div style="padding-top:20px; margin-bottom:20px; margin-left:-5px;"><img id="closeButtonEnd" onMouseOver="closeBlue(this);" OnMouseOut="closeGrey(this);" name="close" src="http://www.alessco.com/images/closeButton.png" border="0" onClick="javascript:window.close(self);" /></div>';

	html+='</div>';
       	
	/*WALL   TO   WALL*/
	html += '<div style="float:left; margin-bottom:72px; width:440px; margin-top: 9px;">';
	//html += '<div class="popMainTitle" style="margin-bottom:6px;"><img name="piecesImage" src="http://www.alessco.com/images/heading'+header+'.png"></div>';
	html += '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/wall.png"></div>';
        /*COUNTING WALL TO WALL*/
	if(wall <= 36){
		if(wall < 36){
		var extraPiecesWall = 36-wall;
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">1 Set of Style 1310 = '+36+' total pieces minus '+wall+' needed pieces = '+extraPiecesWall+' extra pieces which can be used for cubes, names, walls, etc.</span></div>';
		}else{
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">1 Set of Style 1310 = '+36+' total pieces</span></div>';
	        }
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWall+'\' 6\" x '+widthWall+'\' 6\"</span></div>';	
		var costWall = cost1310;
		var commentWall = '($'+cost1310+' per set of style 1310)';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+costWall+'&nbsp;&nbsp;&nbsp;</span>'+commentWall+'</div>';
		
		var boxWall ='1 of 1&nbsp;&nbsp;&nbsp;36 pieces&nbsp;&nbsp;&nbsp;26\" x 15\" x 14\"&nbsp;&nbsp;&nbsp;13lbs';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">'+boxWall+'</span></div>';
		var totalW = '<span class="popTextRed">1 box&nbsp;&nbsp;&nbsp;</span>36 pieces&nbsp;&nbsp;&nbsp;13lbs';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide">'+totalW+'</div>';
		if(wall<36){
		//	html+='<div class="popMainTitle1"><div class="leftSide"><span class="popRoyalBlue"><span class = "popBlueTitle">*extra pieces can be used for cubes, names, walls, etc.</span></span></div></div>';
			
		}
	
	}else if(wall > 36 && wall < 72 || wall == 72){
	      var costWall = cost1311;
	      var commentWall = '($'+cost1311+' per set of style 1311)';
	      var boxWall ='1 of 1&nbsp;&nbsp;&nbsp;72 pieces&nbsp;&nbsp;&nbsp;26\" x 25\" x 14\"&nbsp;&nbsp;&nbsp;24lbs';
              var totalW = '<span class="popTextRed">1 box&nbsp;&nbsp;&nbsp;</span>72 pieces&nbsp;&nbsp;&nbsp;24lbs';
              if(wall == 72){
              html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">1 Set of Style 1311 = 72 total pieces</span></div>';
              }else if(wall > 36 && wall < 72){
              var extraPiecesWall = 72 - wall;
              html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">1 Set of Style 1311 = '+72+' total pieces minus '+wall+' needed pieces = '+extraPiecesWall+' extra pieces which can be used for cubes, names, walls, etc.</span></div>';
              }
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWall+'\' 6\" x '+widthWall+'\' 6\"</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+costWall+'&nbsp;&nbsp;&nbsp;</span>'+commentWall+'</div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">'+boxWall+'</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide">'+totalW+'</div>';
              if(wall > 36 && wall < 72){
              //html+='<div class="popMainTitle1"><div class="leftSide"><span class="popRoyalBlue"><span class = "popBlueTitle">*extra pieces can be used for cubes, names, walls, etc.</span></span></div></div>';
              }


        }else if(wall > 72){
              var setWall = Math.floor(wall/72);
              var difWall = wall - 72*setWall;
              if(setWall == 1 ){var set = 'Set';}else{var set = 'Sets';}
        if(difWall <= 36 && difWall != 0){
              var totalSet = setWall*72 + 36;
              var extraPieces = totalSet - wall;
              var totalBoxWall = setWall +1;
              var totalWeight = weight1311*setWall + weight1310;		
              var costWall = addCommas((setWall*cost1311 + cost1310).toFixed(2));
              var commentWall = '($'+cost1310+' per set of style 1310 and $'+cost1311+' per set of style 1311)';
              var boxWall ='1 of '+totalBoxWall+'&nbsp;&nbsp;&nbsp;36 pieces&nbsp;&nbsp;&nbsp;26\" x 15\" x 14\"&nbsp;&nbsp;&nbsp;13lbs';
              var moreBoxesWall = '2 to '+totalBoxWall+'&nbsp;&nbsp;&nbsp;72 pieces&nbsp;&nbsp;&nbsp;26\" x 25\" x 14\"&nbsp;&nbsp;&nbsp;24lbs';
              var totalW = '<span class="popTextRed">'+totalBoxWall+' boxes&nbsp;&nbsp;&nbsp;</span>'+totalSet+' pieces&nbsp;&nbsp;&nbsp;'+totalWeight+'lbs';
              if(difWall == 36){
              html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">Combine 1 Set of Style 1310 + '+setWall+' '+set+' of Style 1311 = '+totalSet+' total pieces</span></div>';
              }else{
              html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">Combine 1 Set of Style 1310 + '+setWall+' '+set+' of Style 1311 = '+totalSet+' total pieces minus '+wall+' needed pieces = '+extraPieces+' extra pieces which can be used for cubes, names, walls, etc.</span></div>';
              }
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWall+'\' 6\" x '+widthWall+'\' 6\"</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+costWall+'&nbsp;&nbsp;&nbsp;</span>'+commentWall+'</div>';		
	      html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">'+boxWall+'</span></div>';
              html+='<div class="leftSide"><span class="popTextBlack">'+moreBoxesWall+'</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide">'+totalW+'</div>';
              if(difWall != 36){
              //html+='<div class="popMainTitle1"><div class="leftSide"><span class="popRoyalBlue"><span class = "popBlueTitle">*extra pieces can be used for cubes, names, walls, etc.</span></span></div></div>';
              }
        }else if(difWall == 0){
              var totalSet = setWall*72;
              var extraPieces = totalSet - wall;
              var costWall = addCommas((setWall*cost1311).toFixed(2));
              var totalWeight = weight1311*setWall;
              var commentWall = '($'+cost1311+' per set of style 1311)';
              var boxWall ='1 to '+setWall+'&nbsp;&nbsp;&nbsp;72 pieces&nbsp;&nbsp;&nbsp;26\" x 25\" x 14\"&nbsp;&nbsp;&nbsp;24lbs';
              var totalW = '<span class="popTextRed">'+setWall+' boxes&nbsp;&nbsp;&nbsp;</span>'+totalSet+' pieces&nbsp;&nbsp;&nbsp;'+totalWeight+'lbs';
              html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">Combine '+setWall+' '+set+' of Style 1311 = '+totalSet+' total pieces</span></span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWall+'\' 6\" x '+widthWall+'\' 6\"</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+costWall+'&nbsp;&nbsp;&nbsp;</span>'+commentWall+'</div>';		
	      html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">'+boxWall+'</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide">'+totalW+'</div>';
			
			
        }else if(difWall > 36){
              setWall += 1;
              var totalSet = setWall*72;
              var costWall = addCommas((setWall*cost1311).toFixed(2));
              var commentWall = '($'+cost1311+' per set of style 1311)';
              var totalWeight = weight1311 * setWall;
              var extraPieces = totalSet - wall;
              var totalW = '<span class="popTextRed">'+setWall+' boxes&nbsp;&nbsp;&nbsp;</span>'+totalSet+' pieces&nbsp;&nbsp;&nbsp;'+totalWeight+' lbs';
              html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/breakdown.png"></span></div><div class="leftSide"><span class="popTextBlack">Combine '+setWall+' Sets of Style 1311 = '+totalSet+' total pieces minus '+wall+' needed pieces = '+extraPieces+' extra pieces which can be used for cubes, names, walls, etc.</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/size.png"></span></div><div class="leftSide"><span class="popTextBlack">'+lenghtWall+'\' 6\" x '+widthWall+'\' 6\"</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+costWall+'&nbsp;&nbsp;&nbsp;</span>'+commentWall+'</div>';
	      var boxWall ='1 to '+setWall+'&nbsp;&nbsp;&nbsp; 72 Pieces&nbsp;&nbsp;&nbsp; 26\" x 25\" x 14\"&nbsp;&nbsp;&nbsp; 24lbs';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack">'+boxWall+'</span></div>';
              html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide">'+totalW+'</div>';
              //html+='<div class="popMainTitle1"><div class="leftSide"><span class="popRoyalBlue"><span class = "popBlueTitle">*extra pieces can be used for cubes, names, walls, etc.</span></span></div></div>';
              }
			
        }
	  html+='</div>';
          //myWindow.document.getElementById('boxes').innerHTML += html;
	
	/*getElementByClass('popTextRed');
	getElementByClass('popTextBlack');
	getElementByClass('rightSide');
	getElementByClass('leftSide');*/

	//document.getElementById('boxes').style.top = position;
	//myWindow.document.getElementById('boxes').style.visibility="visible";
          return html;
	 }
	}







/********SoftMats************/
function countBoxesMats(position, header, costSM,totalSM){
	
		var totalSM = document.getElementById(totalSM).value;
		var totalCostSM = (costSM*totalSM).toFixed(2);
		
		var html = '<img name="oo" style="margin-bottom: 6px;" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" />';	
		html+='<div style="margin-bottom: 75px;">';
		html+= '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/mats.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide" style="padding-bottom:-26px;"><span class="popTextRed">'+totalSM+'</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+totalCostSM+'&nbsp;&nbsp;&nbsp;</span>($'+costSM+' per piece)</div>';
	
		if(totalSM == 1){
				html += '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack"> 1 of 1&nbsp;&nbsp;&nbsp;1 piece &nbsp;&nbsp;49\" x 7\" x 7\" &nbsp;&nbsp;20 lbs</span></div>';
				html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">1 box&nbsp;&nbsp;&nbsp;1 piece &nbsp;&nbsp;6 lbs</span></div>';
		}else{
				html += '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack"> 1 to '+totalSM+'&nbsp;&nbsp;&nbsp;1 piece &nbsp;&nbsp;49\" x 7\" x 7\" &nbsp;&nbsp;20 lbs</span></div>';
				html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalSM+' boxes&nbsp;&nbsp;&nbsp;</span>'+totalSM+' pieces&nbsp;&nbsp;&nbsp;'+totalSM*6+' lbs</div>';	
		}

        html +='</div>';

		return html;
		
}






/********SoftBamboo************/
function countBoxesSBN1(position, header, costSBN1,totalSBN1){
	
		var totalSBN1 = document.getElementById(totalSBN1).value;
		var totalCostSBN1 = (costSBN1*totalSBN1).toFixed(2);
		
		var html = '<img name="oo" style="margin-bottom: 6px;" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" />';	
		html+='<div style="margin-bottom: 75px;">';
		html+= '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/matsSB.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide" style="padding-bottom:-26px;"><span class="popTextRed">'+totalSBN1+'</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+totalCostSBN1+'&nbsp;&nbsp;&nbsp;</span>($'+costSBN1+' per piece)</div>';
	
		if(totalSBN1 == 1){
				html += '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack"> 1 of 1&nbsp;&nbsp;&nbsp;1 piece &nbsp;&nbsp;61\" x 6\" x 6\" &nbsp;&nbsp;20 lbs</span></div>';
				html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">1 box&nbsp;&nbsp;&nbsp;1 piece &nbsp;&nbsp;6 lbs</span></div>';
		}else{
				html += '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack"> 1 to '+totalSBN1+'&nbsp;&nbsp;&nbsp;1 piece &nbsp;&nbsp;61\" x 6\" x 6\" &nbsp;&nbsp;20 lbs</span></div>';
				html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalSBN1+' boxes&nbsp;&nbsp;&nbsp;</span>'+totalSBN1+' pieces&nbsp;&nbsp;&nbsp;'+totalSBN1*20+' lbs</div>';	
		}

        html +='</div>';

		return html;
}



function countBoxesSBN2(position, header, costSBN2,totalSBN2){
	
		var totalSBN2 = document.getElementById(totalSBN2).value;
		var totalCostSBN2 = (costSBN2*totalSBN2).toFixed(2);
		
		var html = '<img name="oo" style="margin-bottom: 6px;" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" />';	
		html+='<div style="margin-bottom: 75px;">';
		html+= '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/matsSB.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide" style="padding-bottom:-26px;"><span class="popTextRed">'+totalSBN2+'</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+totalCostSBN2+'&nbsp;&nbsp;&nbsp;</span>($'+costSBN2+' per piece)</div>';
	
		if(totalSBN2 == 1){
				html += '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack"> 1 of 1&nbsp;&nbsp;&nbsp;1 piece &nbsp;&nbsp;61\" x 6\" x 6\" &nbsp;&nbsp;6 lbs</span></div>';
				html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">1 box&nbsp;&nbsp;&nbsp;1 piece &nbsp;&nbsp;6 lbs</span></div>';
		}else{
				html += '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack"> 1 to '+totalSBN2+'&nbsp;&nbsp;&nbsp;1 piece &nbsp;&nbsp;61\" x 6\" x 6\" &nbsp;&nbsp;6 lbs</span></div>';
				html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalSBN2+' boxes&nbsp;&nbsp;&nbsp;</span>'+totalSBN2+' pieces&nbsp;&nbsp;&nbsp;'+totalSBN2*20+' lbs</div>';	
		}

        html +='</div>';

		return html;
}



function countBoxesSBW(position, header, costSBW,totalSBW){
	
		var totalSBW = document.getElementById(totalSBW).value;
		var totalCostSBW = (costSBW*totalSBW).toFixed(2);
		
		var html = '<img name="oo" style="margin-bottom: 6px;" src="http://www.alessco.com/images/CalculatorTitle_'+header+'.jpg" />';	
		html+='<div style="margin-bottom: 75px;">';
		html+= '<div style="margin-bottom: 4px;"><img name="piecesImage" src="http://www.alessco.com/images/matsSB.png"></div>';
		html+= '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/pieces.png"></span></div><div class="leftSide" style="padding-bottom:-26px;"><span class="popTextRed">'+totalSBW+'</span></div>';
		html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/cost.png"></span></div><div class="leftSide"><span class="popTextRed">$'+totalCostSBW+'&nbsp;&nbsp;&nbsp;</span>($'+costSBW+' per piece)</div>';
	
		if(totalSBW == 1){
				html += '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack"> 1 of 1&nbsp;&nbsp;&nbsp;1 piece &nbsp;&nbsp;61\" x 9\" x 9\" &nbsp;&nbsp;40 lbs</span></div>';
				html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">1 box&nbsp;&nbsp;&nbsp;1 piece &nbsp;&nbsp;6 lbs</span></div>';
		}else{
				html += '<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/box.png"></span></div><div class="leftSide"><span class="popTextBlack"> 1 to '+totalSBW+'&nbsp;&nbsp;&nbsp;1 piece &nbsp;&nbsp;61\" x 9\" x 9\" &nbsp;&nbsp;40 lbs</span></div>';
				html+='<div class="rightSide"><span class="popTextGreyBold"><img name="piecesImage" src="http://www.alessco.com/images/total.png"></span></div><div class="leftSide"><span class="popTextRed">'+totalSBW+' boxes&nbsp;&nbsp;&nbsp;</span>'+totalSBW+' pieces&nbsp;&nbsp;&nbsp;'+totalSBW*40+' lbs</div>';	
		}

        html +='</div>';

		return html;
}


