/*
www.schober.co.at
loesungsmodule
module javascript lib
11 2008 erik wunderlich
*/

var hasSbTop = (top && top.Shadowbox);

// utility function
// changes the shadowbox size while opening the given url
function openShadowLink(href, w, h) {
	if (hasSbTop || window.Shadowbox) {
		var sbObj = (hasSbTop) ? top.Shadowbox : window.Shadowbox;
		sbObj.open({
				player:		'iframe',
				content:	href,
				height:		h,
				width:		w
		});
	} else document.location.href = href
}

function setPrintnav() {
	// create a new element before the printable content
	// as a container for the CLOSE WINDOW and PRINT AGAIN links
	var pNavObj = document.createElement("div");
	var pNav = '<div id="printNav"><strong>Druckansicht</strong><a href="#" onclick="top.close();return false">Fenster schließen</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" onclick="window.print();return false">Ausdruck erneut starten</a></div>';
	document.body.insertBefore(pNavObj, document.getElementsByTagName('div')[0]);
	document.getElementsByTagName('div')[0].innerHTML = pNav;
}

function loadFuncs() {
	setPrintnav();
	if (window.print) window.print();
}

if (window.name == 'modulprint' && document.documentElement) {
	window.onload = loadFuncs;
}
