/* Printer Friendly Template v1.0
 * 
 */
function pfObj ( ) {
	
	// properties
	this.logoname = 'images/logo.jpg';
	this.header = null;
	this.pflinks = '<p align="right"><a href="javascript:window.print();javascript:self.close();">Send to Printer</a> | <a href="javascript:self.close()">Close Window</a></p>\n';
	this.contentdiv = null;
	this.windowSettings = 'toolbar=no, location=no, directories=no, menubar=no, scrollbars=yes, width=700px, height=720px, left=100, top=50';
	this.footer = null;
	
	// Initalize the printer friendly object
	this.init = function ( xlogo, xheader, xcontentdiv, xfooter ) {
		var defheader;
		
		// Init static stuff
		if ( xlogo.length > 0 ) {
			this.logoname = xlogo;
		}
		this.contentdiv = document.getElementById( xcontentdiv ).innerHTML;
		
		// Default Header
		this.header='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n';
		this.header+='<html xmlns="http://www.w3.org/1999/xhtml">\n';
		this.header+='<head>\n';
		this.header+='<title>' + document.title + ' - Printer Friendly Page</title>\n';
		this.header+='<link href="css/default.css" rel="stylesheet" type="text/css" />\n';
		this.header+='<link href="css/containers.css" rel="stylesheet" type="text/css" />\n';
		this.header+='<link href="css/screen2.css" rel="stylesheet" type="text/css" />\n';
		this.header+='<style type="text/css">\n';
		this.header+='#pfcontainer {\n';
		this.header+='	position:relative;\n';
		this.header+='	width:605px;\n';
		this.header+='	margin-left: auto;\n';
		this.header+='	margin-right: auto;\n';
		this.header+='  }\n';
		this.header+='#navcontainer {\n';
		this.header+='  display: none;\n';
		this.header+='  }\n';
		this.header+='#l_developer {\n';
		this.header+='  display: none;\n';
		this.header+='}\n';
		this.header+='.bttop {\n';
		this.header+='  display: none;\n';
		this.header+='}\n';
		this.header+='body {\n';
		this.header+='  background-color: #FFFFFF;\n';
		this.header+='  background-image: none;\n';
		this.header+='  margin: 5px;\n';
		this.header+='  }\n';
		this.header+='.agentinfo { color: #000; }\n';
		this.header+='</style>\n';
		this.header+='<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\n';
		this.header+='</head>\n';
		this.header+='<body>\n';
		this.header+='<div align="left"><img src="' + this.logoname + '" /></div>\n';
		this.header+='<br />\n';
		this.header+='<div id="pfcontainer">\n';
		
		//Default Footer
		this.footer='</div>\n';
		this.footer+='</body>\n';
		this.footer+='</html>\n';
		
		// Add to header & Footer if necessary
		if (xheader.length > 0) {
			this.header += xheader;
		}
		
		if (xfooter.length > 0) {
			this.footer += xfooter;
		}
	};
	
	// Print the Page in a new window
	this.renderPage = function ( ) {
		// invert prulogo
		
		
		var pfpage = window.open( '', '', this.windowSettings );
		pfpage.document.open ( );
		pfpage.document.write( this.header );
		pfpage.document.write( this.pflinks );
		pfpage.document.write( this.contentdiv );
		pfpage.document.write( this.footer );
		pfpage.document.close ( );
	};
}
