var defaultSize = 100;
var incrementSize = 10;
var decreaseSize = ['<p id="fontSize"><strong>Ansicht:</strong> ',
	'Ansicht verkleinern',
	'kleiner',
	'/wp-content/themes/default_de/img_rewirpower/btn/ansicht-kleiner.gif',
	'decSize',
	' '
	]
	
var resetSize = ['',
	'Ansicht zurücksetzen',
	'zurücksetzen',
	'/wp-content/themes/default_de/img_rewirpower/btn/ansicht-zuruecksetzen.gif',
	'resSize',
	' '
	]

var increaseSize = ['',
	'Ansicht vergrössern',
	'grösser',
	'/wp-content/themes/default_de/img_rewirpower/btn/ansicht-groesser.gif',
	'incSize',
	'</p>'
	]

function scaling(increment,smaller,reset,bigger,def) {
	this.w3c = (document.getElementById);
	this.ms = (document.all);
	this.userAgent = navigator.userAgent.toLowerCase();
	this.isMacIE = ((this.userAgent.indexOf('msie') != -1) && (this.userAgent.indexOf('mac') != -1) && (this.userAgent.indexOf('opera') == -1));
	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 = "efa_fontSize06";
		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="efaTest" style="position:absolute;visibility:hidden;line-height:1em;">&nbsp;</div>';
		this.smallerLink = this.getLinkHtml(-1,smaller);
		this.resetLink = this.getLinkHtml(0,reset);
		this.biggerLink = this.getLinkHtml(1,bigger);
	} else {
		this.biggerLink = '';
		this.resetLink = '';
		this.smallerLink = '';
		this.efaInit = new Function('return true;');
	}

	this.allLinks = this.smallerLink + this.resetLink + this.biggerLink;
}

scaling.prototype.efaInit = function() {
		document.writeln(this.testHTML);
		this.body = (this.w3c)?document.getElementsByTagName('body')[0].style:document.all.tags('body')[0].style;
		this.efaTest = (this.w3c)?document.getElementById('efaTest'):document.all['efaTest'];
		var h = (this.efaTest.clientHeight)?parseInt(this.efaTest.clientHeight):(this.efaTest.offsetHeight)?parseInt(this.efaTest.offsetHeight):999;
		if (h < this.defPx) this.base = this.defPx/h;
		this.body.fontSize = Math.round(this.pref*this.base) + '%';
}

scaling.prototype.getLinkHtml = function(direction,properties) {
	var html = properties[0] + '<a href="#" onclick="efa_fontSize06.setSize(' + direction + '); return false;"';
	html += (properties[4])? 'id="' + properties[4] + '"':'';
	html += (properties[2])?'title="' + properties[2] + '"':'';
	html += '><img width="16" height="16" ';
	html += (properties[1])?'alt="' + properties[1] + '"':'';
	html += (properties[3])?'src="' + contextPath + properties[3] + '"':'';
	return html += '/></a>' + properties[5];
}

scaling.prototype.getPref = function() {
	var pref = this.getCookie();
	if (pref) return parseInt(pref);
	else return this.def;
}

scaling.prototype.setSize = function(direction) {
	this.pref = (direction)?this.pref+(direction*this.increment):this.def;
	this.setCookie(this.pref);
	this.body.fontSize = Math.round(this.pref*this.base) + '%';
}

scaling.prototype.getCookie = function() {
	var cookie = cookieManager.getCookie('fontSize');
	return (cookie)?cookie:false;
}

scaling.prototype.setCookie = function(cookieValue) {
	return cookieManager.setCookie('fontSize', cookieValue);
}

var  efa_fontSize06 = new scaling(incrementSize,decreaseSize,resetSize,increaseSize,defaultSize);