//get querystring
		var query_str = location.search.substring(1);
	
		//load stylesheet and set dimensions based on the chosen printout format
		switch(query_str)
		{
			case "35" :
				document.write('<style type="text/css" media="all">@import "/pages/js/styleprintout35.css";</style>')
				//height of page
				var pageHeight_int = 252;
					
				//width of page
				var pageWidth_int = 480;
				
				//line height
				var fontHeight_int = 18;
			break;
			
			case "46" :
				document.write('<style type="text/css" media="all">@import "/pages/js/styleprintout46.css";</style>')
				//height of page
				var pageHeight_int = 360;
					
				//width of page
				var pageWidth_int = 577;
				
				//line height
				var fontHeight_int = 20;
			break;
			
			default :
				document.write('<style type="text/css" media="all">@import "/pages/style.css";</style>')
			break;
		}
		
		
		function drawPrintouts()
		{
		
							           
					//x coordinate based on width of the browser window
					var leftPosition_int = document.getElementById("mainheader").offsetLeft;
					
					//var leftPosition_int = 344;
					
					var topPosition_int = document.getElementById("mainheader").offsetHeight + 30 + 20;
					
					//var topPosition_int = 104;
															
					//numbaer of pages per recipe
					var result_real;
					
					//clipping at top of recipe page
					var clippTop_int;
					
					//clipping at bottom of recipe page
					var clippBottom_int;
					
					//total height of recipe
					var height_int;
					
					
					var verticalSpacing_int = 80;
					
					//counter
					var i;
						
				//stores html to be displayed
				var html="";
				
				var offset55 = 0;
				
				//if(detect_obj.is_ie5_5)
				//	offset55 = 12;
				
				
				/*####################################################################
				generate first page			
				####################################################################*/
				
								
				//header
				html = "<div id='content0' style='background-color: #fff; border: 1px solid #999; top: "+ topPosition_int +"px; left: "+leftPosition_int+"px; position: absolute; margin-top: 0px; padding-left: 5px; padding-right: 5px; width: "+(pageWidth_int-10)+"px;'>";
				//main content				
				html += '<img id="logoimage" src="/PublishingImages/logo_large.gif" width="108" height="51" border="0" />';
				html += '<p>&nbsp;</p>';
				html += '<span class="recipetitle">';
				html += window.opener.document.getElementById("recipetitle").innerHTML;
				//html += window.opener.document.getElementById('recipetitle').value;
				html += '</span>';
				html += '<div class="details">';
				html += window.opener.document.getElementById("details").innerHTML;
				html += '</div>';
				html += '<strong>Ingredients:</strong><br />';
				html += '<div class="ingredientlist">';
				html += window.opener.document.getElementById("ingredientlist").innerHTML;
				html += '</div>';
				html += '<strong>Preparation:</strong><br />';
				html += '<div class="directions">';
				html += window.opener.document.getElementById("directions").innerHTML;
				html += '</div>';
				html += '</div>';
				
				//footer
				html += "<div id='footer0' style='color: #196497; background-color: #fff; top: "+ (pageHeight_int + topPosition_int) +"px; left: "+leftPosition_int+"px; border-left: 1px solid #999; border-right: 1px solid #999; border-bottom: 1px solid #999; padding-top: "+(fontHeight_int/2)+"px; position: absolute; padding-left: 5px; padding-right: 5px; width: "+(pageWidth_int-10 + offset55)+"px; height: "+(fontHeight_int*2 - fontHeight_int/2)+"px;'>";
				html += "<span style='float: left; display: block;'>Copyright &#169; 2004 Barilla USA.  All Rights Reserved</span>";
				html += "</div>";
				document.write(html);
								
				//get total height
				height_int = document.getElementById("content0").offsetHeight;
				
								
				//calculate numbaer of pages				
				result_real = height_int/pageHeight_int;
				
				//add content to footer
				document.getElementById("footer0").innerHTML += "<span style='float: right; display: block;'><strong>Page 1 of "+ Math.ceil(result_real)+"</strong></span>";
				
				//generate clippings
				clipTop_int =  0;
				
				clipBottom_int = pageHeight_int + "px";
				
								
				//set height
				document.getElementById("content0").style.height = (Math.ceil(result_real)*pageHeight_int) + "px"				
				
				//set clipping
				//document.getElementById("content0").style.clip="rect(" + clipTop_int + " auto " + clipBottom_int + " auto)";
				document.getElementById("content0").style.clip="rect(" + clipTop_int + " "+ (pageWidth_int+4) +"px " + clipBottom_int +  " 0px)";
				
								
				/*####################################################################
				generate pages 2 to last
				####################################################################*/			
				
				for(i=1;i<Math.ceil(result_real);i++)
				{
				
					html = "<span id='bordertop" + i + "' style='border-top: 1px solid #999; padding: 0; margin: 0; height: 1px; font-size: 1px; line-height: 1px; width: "+(pageWidth_int+2)+"px; position: absolute; top: "+((verticalSpacing_int + pageHeight_int)*i + topPosition_int)+"px; left: "+leftPosition_int+"px; z-index: 1234;'>&nbsp;</span>";
					
					html += "<div id='content" +i+ "' style='background-color: #fff; border: 1px solid #999; position: absolute; top: "+ (verticalSpacing_int*i + topPosition_int) +"px; left: "+leftPosition_int+"px; margin-top: 0px; padding-left: 5px; padding-right: 5px; width: "+(pageWidth_int-10)+"px;'>";
								
					html += '<img id="logoimage" src="img/interior_logo.gif" width="108" height="51" border="0" />';
					html += '<p>&nbsp;</p>';
					html += '<span class="recipetitle">';
					html += window.opener.document.getElementById("recipetitle").innerHTML;
					html += '</span>';
					html += '<div class="details">';
					html += window.opener.document.getElementById("details").innerHTML;
					html += '</div>';
					html += '<strong>Ingredients:</strong><br />';
					html += '<div class="ingredientlist">';
					html += window.opener.document.getElementById("ingredientlist").innerHTML;
					html += '</div>';
					html += '<strong>Preparation:</strong><br />';
					html += '<div class="directions">';
					html += window.opener.document.getElementById("directions").innerHTML;
					html += '</div>';
								
					html += "</div>";
					
					html += "<div id='footer"+ i +"' style='color: #196497; background-color: #fff; top: "+((verticalSpacing_int+pageHeight_int)*i + pageHeight_int + topPosition_int)+"px; left: "+leftPosition_int+"px; border-right: 1px solid #999; border-left: 1px solid #999; border-bottom: 1px solid #999; position: absolute; padding-left: 5px; padding-right: 5px; width: "+(pageWidth_int-10 + offset55)+"px; height: "+(fontHeight_int*2)+"px; z-index: 1234;'>";	
					
					html += "<span style='float: left; padding-top: 6px'><img src='/PublishingImages/logo.gif' width='68' height='30' border='0' /></span><span style='float: left; padding-top: "+(fontHeight_int/2)+"px;'>Copyright &#169; 2004 Barilla USA.  All Rights Reserved</span></div>";
					//html += "</div>";
					
					document.write(html);
					
					//add content to footer
					document.getElementById("footer" + i).innerHTML += "<span style='float: right; padding-top: "+(fontHeight_int/2)+"px;'><strong>Page "+ (i+1) +" of "+ Math.ceil(result_real)+"</strong></span>";
					
					clipTop_int = (pageHeight_int*i) + "px";
					
					name = "content"+i;
				
					clipBottom_int = ((i+1)*pageHeight_int) + "px";
									
					
				    eval('document.getElementById("'+name+'").style').height = (Math.ceil(result_real)*pageHeight_int) + "px"				
				
					eval('document.getElementById("'+name+'").style').clip="rect(" + clipTop_int + " "+ (pageWidth_int+4) +"px " + clipBottom_int + " 0)";
				
				}
				
				//document.getElementById("content0").style.visibility = "hidden";
				//document.getElementById("content1").style.visibility = "hidden";
				//document.getElementById("content2").style.visibility = "hidden";
				//document.getElementById("content3").style.visibility = "hidden";
			
		}