﻿window.onload = startUp;

var prints = new Array();

function startUp() {
	createPrints();
	loadTopNavi();
	setIVW();
	tm_tracker();
}

function hideNavi() {
	var navi = document.getElementById("navidata");
	navi.className = "navidatahidden";
}

function hideNaviButton() {
    var button = document.getElementById("top_button_link");
    button.className = "editdata";
}

function createPrints() {
	
	var divs = document.getElementsByTagName("div");
	for (var i=0; i<divs.length; i++) {
		var id = divs[i].id;
		if (id.indexOf("print") >= 0) prints[id] = divs[i].innerHTML;
	}
	
}

function printPage() {
	window.print();
}

function printId(id) {

	var main_css = document.getElementById("maincss").value;
	var none_edit_css = document.getElementById("noneeditcss").value;

	text = "<html>\n";
	text += "<head>\n";
	text += '<link rel="stylesheet" type="text/css" href="'+main_css+'">'+"\n";
	text += '<link rel="stylesheet" type="text/css" href="'+none_edit_css+'">'+"\n";
	text += "</head>\n";
	text += '<body class="print">';
	text += '<div class="content">';
	text += prints[id];
	text += "</div>\n";
	text += "</body>\n";
	text += "</html>";


	var win = window.open("", "mssprint");
	win.document.open();
	win.document.write(text);
	win.document.close();

	win.print();

	win.close();

}

function printHtml(html) {

	var main_css = document.getElementById("maincss").value;
	var none_edit_css = document.getElementById("noneeditcss").value;

	text = "<html>\n";
	text += "<head>\n";
	text += '<link rel="stylesheet" type="text/css" href="'+main_css+'">'+"\n";
	text += '<link rel="stylesheet" type="text/css" href="'+none_edit_css+'">'+"\n";
	text += "</head>\n";
	text += '<body class="print">';
	text += '<div class="content">';
	text += html
	text += "</div>\n";
	text += "</body>\n";
	text += "</html>";


	var win = window.open("", "mssprint");
	win.document.open();
	win.document.write(text);
	win.document.close();

	win.print();

	win.close();

}
