<!--

/***********************************************

* 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. */







function printDivs(divId){
	var defaultPrintDivId = "cdiv";
	var styleSheetUrl_01 = "css/style.css";
	var styleSheetUrl_02 = "css/layout.css";
	var styleSheetUrl_03 = "css/style_tiny.css";
	//var printStyleSheetUrl = "css/print.css";
	var logoUrl = "upload/logos/logo_sfadf_print.jpg";

	//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 logo_str = (logoUrl!="")?'<img src="'+logoUrl+'">\n':"";
		logo_str = "\n<div style='display:block; width:500px;' style='float:left;'>"+logo_str+"</div><br/>\n";
		
		content = '\n<div style="position:absolute; top:140px; left:10px; display:block; color:#000000; border-top:1px solid #666666; width:500px; text-align:left;"><br/>'+content+"</div>\n"
		content = logo_str+content;
		
		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="'+styleSheetUrl_03+'" 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 += '<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.");
	}
}

//-->