<!--
/***********************************************
* 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/style.css";
var styleSheetUrl_02 = "css/style_tiny.css";
var printStyleSheetUrl = "css/print.css";
var logoUrl = "imgs/logoapplus.jpg";
var winFeatures = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,width=550,height=550';
function printDiv(divId){

	divId = (divId=="")?defaultPrintDivId:divId;
	var d = document;
	if (d.getElementById(divId)!=null){
		var content = d.getElementById(divId).innerHTML;
		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="javascript:self.window.close()" class="mmenu" title="Cerrar">Cerrar</a> | \n';
		html += '<a href="javascript:print()" class="mmenu" title="Imprimir">Imprimir<br/></a> \n';
		html += '<b'+'ody onLoad="print()"><div style="text-align:left">'
		html += ((logoUrl!="")?'<img style="padding-left:20px"  src="'+logoUrl+'"><br/> \n':"")+content+'</div></body>\n</html> \n';

               // var w = window.open(document.location,document.title, winFeatures);
                var w = window.open('',document.titl, winFeatures);
                if (w){
                    d = w.document;
		    d.open(); d.write(html); d.close();
                } else {
                    // Blocked!!
                }

	} else {
		alert("Error: No div [\""+divId+"\"] found in document for printing.");
	}

}
//-->