//Jquery print function
var jqprintpage={
	
	gAutoPrint:true,
	
	init:function(conf){
		
		$(document).ready(function(){
								   
				$("#printimage").click( function() {
						jqprintpage.printPage();	
				});
								   
		});
	},
	
	printPage:function() {
		if (document.getElementById != null)
		{
			var html = '<HTML>\n<HEAD>\n';
	
			if (document.getElementsByTagName != null)
			{
				var headTags = document.getElementsByTagName("head");
				if (headTags.length > 0)
					html += headTags[0].innerHTML;
			}
			
			html += '\n</HE' + 'AD>\n<BODY style="margin:15px">\n';
			
			if (location.pathname=='/indexfr.html') {
				var printReadyElem = document.getElementById("w4page");
			} else {
				var printReadyElem = document.getElementById("pagecontent");
			}
			
			
			if (printReadyElem != null)
			{
					html += printReadyElem.innerHTML;
			}
			else
			{
				var printFullPage = document.getElementByID("w4page");
				
				if (printFullPage != null) {
					
					html += printReadyElem.innerHTML;
					
				} else {
				
					alert("Could not find the printReady section in the HTML");
					return;
				}
			}
				
			html += '\n</BO' + 'DY>\n</HT' + 'ML>';
			
			var printWin = window.open("","printSpecial");
			printWin.document.open();
			printWin.document.write(html);
			printWin.document.close();
			if (jqprintpage.gAutoPrint) {
				printWin.print();
			}
		}
		else
		{
			alert("Sorry, the print ready feature is only available in modern browsers.");
		}
	}
}

jqprintpage.init();
