var font_default = 100; //Schriftgröße Standard in Prozent
var font_increment = 10; //Schrittweite Schriftgröße in Prozent
var font_max = 170; //Schriftgröße maximal
var font_min = 60; ////Schriftgröe minimal
var font_bigger = ['',
				  '<span class="schrift">&nbsp;+&nbsp;</span>',
				  'Schrift größer',
				  '',
				  '',
				  '',
				  '',
				  '',
				  '',
				  '',
				  '</div>'
				  ]

var font_reset = ['',
				 '<span class="schrift">&nbsp;=&nbsp;</span>',
				 'Schriftgröße zurückstellen',
				  '',
				  '',
				  '',
				  '',
				  '',
				  '',
				  '',
				  '<span class="hidden">&nbsp;|&nbsp;</span>'
				  ]

var font_smaller = ['<div style="margin-top:15px;margin-bottom:5px;"><span class="schrift1" style="line-height:2.8;">Schrift:<br /></span>',
				   '<span class="schrift">&nbsp;-&nbsp;</span>',
				   'Schrift kleiner',
				   '',
				   '',
				   '',
				   '',
				   '',
				   '',
				   '',
				   '<span class="hidden">&nbsp;|&nbsp;</span>'				   
				   ]

function font_fontSize(increment,bigger,reset,smaller,def) {
	this.w3c = (document.getElementById);
	this.ms = (document.all);
	this.userAgent = navigator.userAgent.toLowerCase();
	this.isOldOp = ((this.userAgent.indexOf('opera') != -1)&&(parseFloat(this.userAgent.substr(this.userAgent.indexOf('opera')+5)) <= 7));

	if ((this.w3c || this.ms) && !this.isOldOp && !this.isMacIE) {
		this.name = "font_fontSize";
		this.cookieName = 'fontSize';
		this.increment = increment;
		this.def = def;
		this.defPx = Math.round(16*(def/100))
		this.base = 1;
		this.pref = this.getPref();
		this.testHTML = '<div id="fontTest" style="position:absolute;visibility:hidden;line-height:1em;">&nbsp;</div>';
		this.biggerLink = this.getLinkHtml(1,bigger);
		this.resetLink = this.getLinkHtml(0,reset);
		this.smallerLink = this.getLinkHtml(-1,smaller);
	} else {
		this.biggerLink = '';
		this.resetLink = '';
		this.smallerLink = '';
		this.fontInit = new Function('return true;');
	}

	this.allLinks = this.smallerLink + this.resetLink + this.biggerLink;
}

font_fontSize.prototype.fontInit = function() {
		document.writeln(this.testHTML);
		this.body = (this.w3c)?document.getElementsByTagName('body')[0].style:document.all.tags('body')[0].style;
		this.fontTest = (this.w3c)?document.getElementById('fontTest'):document.all['fontTest'];
		var h = (this.fontTest.clientHeight)?parseInt(this.fontTest.clientHeight):(this.fontTest.offsetHeight)?parseInt(this.fontTest.offsetHeight):999;
		if (h < this.defPx) this.base = this.defPx/h;
		this.body.fontSize = Math.round(this.pref*this.base) + '%';
}

font_fontSize.prototype.getLinkHtml = function(direction,properties) {
	var html = properties[0] + '<a href="#" onclick="font_fontSize.setSize(' + direction + '); return false;"';
	html += (properties[2])?'title="' + properties[2] + '"':'';
	html += (properties[3])?'class="' + properties[3] + '"':'';
	html += (properties[4])?'id="' + properties[4] + '"':'';
	html += (properties[5])?'name="' + properties[5] + '"':'';
	html += (properties[6])?'accesskey="' + properties[6] + '"':'';
	html += (properties[7])?'onmouseover="' + properties[7] + '"':'';
	html += (properties[8])?'onmouseout="' + properties[8] + '"':'';
	html += (properties[9])?'onfocus="' + properties[9] + '"':'';
	return html += '>'+ properties[1] + '<' + '/a>' + properties[10];
}

font_fontSize.prototype.getPref = function() {
	var pref = this.getCookie(this.cookieName);
	if (pref) return parseInt(pref);
	else return this.def;
}

font_fontSize.prototype.setSize = function(direction) {
	this.pref = (direction)?this.pref+(direction*this.increment):this.def;
	this.setCookie(this.cookieName,this.pref);
	if (Math.round(this.pref*this.base) < font_max && Math.round(this.pref*this.base) > font_min) this.body.fontSize = Math.round(this.pref*this.base) + '%';
}

font_fontSize.prototype.getCookie = function(cookieName) {
	var cookie = cookieManager.getCookie(cookieName);
	return (cookie)?cookie:false;
}

font_fontSize.prototype.setCookie = function(cookieName,cookieValue) {
	return cookieManager.setCookie(cookieName,cookieValue);
}

var  font_fontSize = new font_fontSize(font_increment,font_bigger,font_reset,font_smaller,font_default);

function preloadImg() {
  if (document.images) {
    var imgFiles = preloadImg.arguments;
    if (document.preloadArray==null) document.preloadArray = new Array();
    var i = document.preloadArray.length;
    with (document) for (var j=0; j<imgFiles.length; j++) if (imgFiles[j].charAt(0)!="#"){
      preloadArray[i] = new Image;
      preloadArray[i++].src = imgFiles[j];
  } }
}
/*Mouseover Netscape*/
function swapImg(imgName,newImg){
  if ((navigator.appName == 'Netscape' && parseFloat(navigator.appVersion) >= 3) || (parseFloat(navigator.appVersion) >= 4)){
			eval('document.' + imgName + '.src = "' + newImg + '"');
		}
	}