function filterTags(attribute, tag, text) {
	var count
	var re = new RegExp("<" + tag + "(.*?)" + attribute + "=([\"|']?)[0-9]{0,4}%?([\"|']?)","gim");
	
	try {
		count = text.match(re);
		text = text.replace(re,"<" + tag + "$1");
	} catch(er) {
		return false;
	}
	
	return text;
}

function printContent(){
	images = "<img src=images/logo.gif><p>"
	styles = "<LINK href=\"css/main.css\" type=text/css rel=stylesheet><style type=\"text/css\">"
	bodystyle = "<style type=\"text/css\">BODY{OVERFLOW-X:hidden;margin:0px;}</style>"

	str = document.body.innerHTML;
	printarea = str.split('<!-- #print'+'begin# -->')[1];
	printarea = printarea.split('<!-- #print'+'eind# -->')[0];

	printarea = filterTags("width", "td", printarea);
	printarea = filterTags("width", "table", printarea);
	printarea = filterTags("align", "div", printarea);
	
	StrPrint = "<head>"+styles+bodystyle+"</head><body>" + images + printarea;

	var win = window.open("","Print","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=800,height=600");
	var doc = win.document;
	doc.open();
	doc.write(StrPrint);
	win.document.close();
	if (doc.getElementById("btnprint") != null) {
		doc.getElementById("btnprint").style.display = "none";
	}
	win.focus();
	win.print();
	//document.write(StrPrint);
	//history.go();
}
