function initFontResize() {
	textChanger.init();
}
var textChanger = {
	defaultFS : 1.2,
	init: function() {
		var el = document.getElementsByTagName("body")[0];
		var sz = textChanger.getCookie();
		el.style.fontSize = sz ? sz + 'em' : textChanger.defaultFS + 'em';
		var incr = document.getElementById('increase');
		if(incr)
			incr.onclick = function(){textChanger.changeSize(1); return false;};
		var decr = document.getElementById('decrease');
		if(decr)
			decr.onclick = function(){textChanger.changeSize(-1); return false;};
		var reset = document.getElementById('reset');
		if(reset)
			reset.onclick = function(){textChanger.changeSize(0); return false;};
	},
	changeSize: function(val) {
		var el = document.getElementsByTagName("body")[0];
		var size = el.style.fontSize.substring(0, 4);
		var fSize = parseFloat(size, 10);
		if (val == 1)	{
			fSize += 0.1;
			if (fSize > textChanger.defaultFS*1.5) fSize = textChanger.defaultFS*1.5;
		} 
		if (val == -1) {
			fSize -= 0.1;
			if (fSize < textChanger.defaultFS/1.5) fSize = textChanger.defaultFS/1.5;
		}       
		if (val == 0) fSize = textChanger.defaultFS;
		el.style.fontSize = fSize.toFixed(2) + 'em';
		textChanger.updateCookie(fSize);
	},
	updateCookie: function(vl)	{
		var today = new Date();
		var exp = new Date(today.getTime() + (365*24*60*60*1000));
		document.cookie = 'textChangerL=size=' + vl + ';' +'expires=' + exp.toGMTString() + ';' +'path=/';
	},
	getCookie: function()	{ 
		var cname = 'textChangerL=size=';   
		var start = document.cookie.indexOf(cname);
		var len = start + cname.length;
		if ((!start) && (cname != document.cookie.substring(0,cname.length))) {return null;}
		if (start == -1) return null;
		var end = document.cookie.indexOf(";",len);
		if (end == -1) end = document.cookie.length;
		return unescape(document.cookie.substring(len, end));
	}
}
if (window.addEventListener)
	window.addEventListener("load", initFontResize, false);
else if (window.attachEvent && !window.opera)
	window.attachEvent("onload", initFontResize);
	
function openZeitung(ziel) {
	  var h = screen.availHeight - 20;
	  var w = screen.availWidth - 20;
	  var x=0, y=0, parameter="";
	  if (w < screen.availWidth || h < screen.availHeight) {
	    x = (screen.availWidth - w - 20) / 2;
	    y = (screen.availHeight - h - 20) / 2;
	    if (window.opera) y = 0; // Opera positioniert unter den Symbolleisten
	    if (x<0 || y<0) { x=0; y=0; }
	    else parameter = "width=" + w + ",height=" + h + ",";
	  }
	  parameter += "left=" + x + ",top=" + y;
	  parameter += ",menubar=no,location=no,toolbar=no,status=no";
	  parameter += ",resizable=no,scrollbars=no";
	  var Fenster = window.open(ziel,"Zeitung_Tips",parameter);
	  if (Fenster) Fenster.focus();
	  return !Fenster;
}

function printDiv(grafik) {
	var win1 = window.open('', 'printdiv', 'width=840,height=500,scrollbars=yes');
	win1.document.open();
	win1.document.write('<img src='+grafik+' >');
	win1.document.close();
}

