<!--
/***********************************************
* Script for printing a DIVs content
*
* ScriptName  :     divprint 1.0
* Author      :     Gregor Hinsberg
* Date        :     24.08.2005
* Copyright   :     MediactiVa S.L [www.mediactiva.com]
************************************************/

/* The function gets the inner html of a div defined by the
variable "contentDivId" [or as argument], adds the missing 
html doc elements, writes all in the document and triggers 
the printer. The style "mmenu" is added by the print.css which 
hides all tags with the class "mmenu" asigned to for printing. */

var defaultPrintDivId = "cdiv";
var styleSheetUrl_01 = "css/format.css";
var styleSheetUrl_02 = "css/format.edit.css";
var printStyleSheetUrl = "css/print.css";
var logoUrl = "";

function printDivs(divId){
	//divId = (divId=="")?defaultPrintDivId:divId;
	var d = document;
	var content  = "";
	var id = 0;
	var itDivId = divId+String(id);
	if (d.getElementById(itDivId)!=null){
		while(d.getElementById(itDivId)){
			content += d.getElementById(itDivId).innerHTML
			id ++;
			var itDivId = divId+String(id);
		}
		var html = '<h'+'tml>\n<h'+'ead> \n';
		html += '<t'+'itle>'+d.title+'</t'+'itle> \n';
		html += '<link href="'+styleSheetUrl_01+'" rel=stylesheet type="text/css" > \n';
		html += '<link href="'+styleSheetUrl_02+'" rel=stylesheet type="text/css" > \n';
		html += '<link href="'+printStyleSheetUrl+'" rel="stylesheet" media="print" type="text/css" /> \n';
		html += '</h'+'ead>\n';
		html += '<a href="'+d.location+'" class="mmenu">back</a> | \n';
		html += '<a href="javascript:print()" class="mmenu">print</a><br/> \n';
		html += (logoUrl!="")?'<img src="'+logoUrl+'"><br/> \n':"";
		html += '<b'+'ody onLoad="print()">'+content+'</body>\n</html> \n';
		d.open(); d.write(html); d.close();
	} else {
		alert("Error: No div [\""+itDivId+"\"] found in document for printing.");
	}

}
//-->