var printform;
var printNext;
var printClose;

function submitPrintForm() {
    if(typeof document.printDetail.productDetails != 'undefined' && document.printDetail.productDetails.checked == true) {
		var tearsheet = '/onlinecatalog/resources/pdfs/tearsheets/' + document.printDetail.productDetails.value;
		window.open(tearsheet,null,"height=600,width=800,status=yes,toolbar=yes,menubar=yes,location=yes")
	}
	if(document.printDetail.pageAsShown.checked == true || (typeof(document.printDetail.allProductImages) != 'undefined' && document.printDetail.allProductImages.checked == true) || (typeof(document.printDetail.finishes) != 'undefined' && document.printDetail.finishes.checked == true) || (typeof(document.printDetail.textilesLeather) != 'undefined' && document.printDetail.textilesLeather.checked == true)) {
		document.printDetail.submit();
	}
}

$(function() {
    $('.print').mouseover(function() {
        if(!printNext) {
            printNext = new Image();printNext.src='/common/images/btn-continuePrinting-off.gif';
            printClose = new Image();printClose.src='/common/images/btn-closeLightbox.gif';
        }
    });
});

function populatePrint() {
	printform =	'<div id="printForm">' +
					'<div class="lightbox-canvasClose"><img src="/common/images/btn-closeLightbox.gif" width="9" height="9" alt="Close" border="0" onClick="killLightbox();" /></div>' +
					'<h1 class="prodDtl-name">PRINT OPTIONS</h1>' +
					'<div class="dblLine" style="margin-bottom:17px;">&nbsp;</div>' +
					'<p>Which of the following would you like to print?</p>' +
					'<form action="/onlinecatalog/printDetail.mcg" method="get" id="printDetail" name="printDetail">' +
						'<input type="Hidden" name="productNumber" value="' + productDetailObject.subtitle + '">' +
						'<input type="Hidden" name="whichActiveTab" value="' + activeTab + '">' +
                        '<input type="Hidden" name="sectionNumber" value="' + productDetailObject.section + '">' +
                        '<input type="Hidden" name="subsectionNumber" value="' + productDetailObject.subsection + '">' +
                        '<input type="Hidden" name="tertiarySectionNumber" value="' + productDetailObject.tertiarysection + '">' +
                        '<input type="checkbox" value="true" name="pageAsShown" id="pageAsShown" checked><label for="pageAsShown">Page as Shown</label><br />';
						if(productDetailObject.tearsheet.length > 1) {
							printform += '<input type="Checkbox" value="' + productDetailObject.tearsheet + '" id="productDetails" name="productDetails" /><label for="productDetails">Tear Sheet';
								if(productDetailObject.tearsheetSize.length > 1) {
									printform += '&nbsp;&nbsp;{' + productDetailObject.tearsheetSize + '}';
								}
							printform += '</label><br />';
						}
						if(productDetailObject.otherImgExist == 'true') {
						printform += '<input type="Checkbox" value="true" id="allProductImages" name="allProductImages" /><label for="allProductImages">All Product Images</label><br />';
						}
						if(productDetailObject.finishesExist == 'true') {
						printform += '<input type="Checkbox" value="true" id="finishes" name="finishes" /><label for="finishes">Finishes</label><br />';
						}
						if(productDetailObject.textilesExist == 'true') {
						printform += '<input type="Checkbox" value="true" id="textilesLeather" name="textilesLeather" /><label for="textilesLeather">Textiles & Leather</label><br />';
						}
						printform += '<div class="dblLine" style="margin:17px 0 15px 0;">&nbsp;</div>' +
						'<img src="/common/images/btn-continuePrinting-off.gif" width="113" height="19" border="0" alt="Continue Printing" class="submit" onClick="submitPrintForm();" />' +
					'</form>' +
				'</div>';
	$('#lightbox-copy').html(printform);
}			