﻿function printPage()
{
	d=window.open();
	date = new Date();

	var html = buildCssList();
	html+= "<b>Date:</b> " + date + "<br>";
	html+= "<b>URL:</b> " + document.location.href + "<br>";
	html+= buildAuthorList();
	html+= "<scr" + "ipt>window.print()</scr" + "ipt>";
	d.document.open('text/html').write(html);
}

function buildCssList()
{
    var styleSheets = document.styleSheets;
	var styles = "";
    for(var u=0;u<styleSheets.length;u++)
    {
		if(styleSheets[u].href.indexOf("modules/") == -1)
			styles+= '<link rel="stylesheet" href="' + styleSheets[u].href + '" type="text/css"/>';
    }
	return styles;
}

function buildAuthorList()
{
    var items = document.all;
	var areas = "";
    for(var u=0;u<items.length;u++)
    {
		if(items[u].i_path && items[u].i_path.indexOf("_author.inc") != -1 && items[u].i_path.indexOf("search_author.inc") == -1)
			areas+= items[u].outerHTML;
    }
	return areas;
}