var printwindow;
function printIt(contentId) {	
	printwindow = window.open("/media/print.html","Print","height=760,width=860,status=no,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,left=" + (screen.availWidth-860)/2 + ",top=" + (screen.availHeight-760)/2 + '"');
	printwindow.document.write('<html>');
	printwindow.document.write('<head>');
	printwindow.document.write('<title>');
	printwindow.document.write(printTitle);
	printwindow.document.write('</title>');
	printwindow.document.write('<link rel="stylesheet" type="text/css" href="http://' + location.hostname + '/site/css/print.css"/>');
	printwindow.document.write('<script type="text/javascript" src="http://' + location.hostname + '/site/script/print.js"></script>');
	printwindow.document.write('<style>');
	printwindow.document.write('.whiteButton{background-color:#FFFFFF; border-style:solid; border-color:#b4b4b4; border-width:1px; width:100px;} .hiddenTR{display:none}');
	printwindow.document.write('@media screen');
	printwindow.document.write('{.specElement {display:block}}');
	printwindow.document.write('@media print');
	printwindow.document.write('{.specElement {display:none}}');
	printwindow.document.write('</style>');
	printwindow.document.write('</head>');
	printwindow.document.write('<body style="background-color: #ffffff; color: #000000; margin-left: 15px;">');
	printwindow.document.write('<table width="600" border="0" cellpadding="0" cellspacing="0" class="top" style="margin-top: 10px;">');
	printwindow.document.write('<tr><td style="text-align: center;"><img src="http://' + location.hostname + '/site/images/printTitle1.gif" width="300" height="32" alt=""/></td></tr>');
	printwindow.document.write('<tr><td style="text-align: center;">PARALLELWEG ZUID 215 - NIEUWERKERK A/D IJSSEL - THE NETHERLANDS<br/>');
	printwindow.document.write('+31-(0)180-312644 - www.vanvliet.com - info@vanvliet.com</td></tr>');
	printwindow.document.write('<tr><td height="30" style="vertical-align: bottom;"><div style="margin-left:10px; color:#385762; font-weight:bold; font-size: 12px;">');
	printwindow.document.write(printTitleProd);
	printwindow.document.write('</div></td></tr>');
	printwindow.document.write('<tr><td class="center">');
	printwindow.document.write('<table width="100" border="0" cellpadding="0" cellspacing="0" class="top" align="center">');
	printwindow.document.write('<col width="50%"/><col width="*"/><col width = "50%"/>');

	if(image1 != '')
	{
		printwindow.document.write('<tr><td class="right">');
		printwindow.document.write('<img src="');
		printwindow.document.write(image1);
		printwindow.document.write('" width="300" /></td><td style="width: 15px;">&#160;</td>')
		if (image2 != '' || image3 != '')
		{
			printwindow.document.write('<td class="left">');
			if (image2 != '')
			{
				printwindow.document.write('<img src="');
				printwindow.document.write(image2);
				if (image3 == '')
				{
					printwindow.document.write('" width="300" style="display: block;"/>');
				}
				else
				{
					printwindow.document.write('" width="147" style="display: block;"/>');
				}
			}
			if(image3 != '')
			{
				printwindow.document.write('<img src="');
				printwindow.document.write(image3);
				if (image2 == '')
				{
					printwindow.document.write('" style="display: block;"/>');
				}
				else
				{
					printwindow.document.write('" width="147" style="display: block; margin-top: 5px;"/>');
				}
			}
			printwindow.document.write('</div></td>');
		}
		printwindow.document.write('</tr></table>');
		printwindow.document.write('</td></tr>');
	}
	printwindow.document.write('<tr><td>');
	printwindow.document.write('<div id="printDiv" style="background-color: #ffffff; color: #000000;" class="printTable">');
	printwindow.document.write(document.getElementById(contentId).innerHTML);
	printwindow.document.write('</div>');
	printwindow.document.write('</td></tr>');
	printwindow.document.write('<tr><td style="text-align: left; font-style: italic; ">');
	printwindow.document.write('<div style="margin-top: 20px; width: 600px;">All quotations, transactions, deliveries and other legal acts are subject to the general conditions of delivery of Van Vliet Automobielbedrijven B.V. as filed at the Registry of the Rotterdam District Court under number 627/97. A copy will be sent to you on request.</div>')
	printwindow.document.write('</td></tr>');
	printwindow.document.write('<tr><td>&#160;');
	printwindow.document.write('</td></tr>');
	printwindow.document.write('<tr class="hiddenTR"><td style="text-align: left; font-style: italic; ">Your comments:');
	printwindow.document.write('</td></tr>');
	printwindow.document.write('<tr class="hiddenTR"><td style="text-align: left; font-style: italic; ">');
	printwindow.document.write('<div id="visitor_comment_display" style="width: 600px;">&#160;</div>')
	printwindow.document.write('</td></tr>');
	printwindow.document.write('<tr class="hiddenTR"><td>');
	printwindow.document.write('<textarea class="specElement "id="visitor_comment_area" cols="120" rows="6" style="text-align: left; font-style: italic; font-size:10px; letter-spacing:0px; font-family:Verdana;">');
	printwindow.document.write('</textarea>');
	printwindow.document.write('</td></tr>');
	printwindow.document.write('<tr><td><input style="width: 150px;" width="150px" class = "specElement whiteButton" type="button" value="Add your comment" onclick="addComment()" id="add_comment"/>');
	printwindow.document.write('</td></tr>');
	printwindow.document.write('<tr><td>');
	printwindow.document.write('<table class="specElement" width="500" border="0" cellpadding="0" cellspacing="0" style="margin-top: 5px" id="button_table">')
	printwindow.document.write('	<tr>');
	printwindow.document.write('		<td width="100px"><input type="button" class="whiteButton" value="Print this page" onclick="printMove()" /></td>');
	printwindow.document.write('		<td><input type="button" value="Save this page" class="whiteButton" onclick="go_saveas()" style="margin-left: 5px"/></td>');
	printwindow.document.write('	</tr>');
	printwindow.document.write('</table>');
	printwindow.document.write('</td></tr>');
	printwindow.document.write('<tr class="bottom"><td height="25" class="middle"><div style="margin-left:10px; color:#000000; font-weight:bold;">&#169; 2008 Van Vliet Trucks<div></td></tr>');
	printwindow.document.write('</table>');
	printwindow.document.write('</body>');
	printwindow.document.write('</html>');
	printwindow.document.close();	
	return true;
}

function printMove() {
	document.getElementById('visitor_comment_display').innerHTML = document.getElementById('visitor_comment_area').value+ '&#160';
	window.focus();
	window.print();
}

function addComment(){
	

	var TRs = document.getElementsByTagName('TR');
	for(var i=0; i<TRs.length;i++)
	{
		if(TRs[i].className=='hiddenTR')TRs[i].className='';
	}
	
	//var newNode = document.createTextNode(document.getElementById('visitor_comment_area').value);
	//document.getElementById('visitor_comment_display').innerHTML='';
	//document.getElementById('visitor_comment_display').appendChild(newNode);
	document.getElementById('visitor_comment_display').innerHTML = document.getElementById('visitor_comment_area').value+ '&#160';
}

function go_saveas() {	
    if (!!window.ActiveXObject) {
        document.execCommand("SaveAs");
    } else if (!!window.netscape) {
        var r=document.createRange();
        r.setStartBefore(document.getElementsByTagName("head")[0]);
        var oscript=r.createContextualFragment('<script id="scriptid" type="application/x-javascript" src="chrome://global/content/contentAreaUtils.js"><\/script>');
        document.body.appendChild(oscript);
        r=null;
        try {
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            saveDocument(document);
        } catch (e) {
            //no further notice as user explicitly denied the privilege
        } finally {
            var oscript=document.getElementById("scriptid");    //re-defined
            oscript.parentNode.removeChild(oscript);
        }
    }
}