/*
	To implement this script in your Web page, configure this file as
	shown below, then put this file on your Web server.
	
	Next, insert the following at the beginning of the <head> section
	of your Web page:

		<script type="text/javascript" language="JavaScript1.2" src="../[path]efa_fontsize.js"></script>

	where [path] is the path to this file on your server.
	
	Insert the following right after the <body> tag:

		<script type="text/javascript" language="JavaScript1.2">
			if (efa_fontSize) efa_fontSize.efaInit();
		</script>
	
	Finally, insert the following where you wish the links to change the
	text size to appear: 

		<script type="text/javascript" language="JavaScript1.2">
			if (efa_fontSize) document.write(efa_fontSize.allLinks);
		</script>
*/

/*
	efa_increment = percentage by which each click increases/decreases size
	efa_bigger = array of properties for 'increase font size' link
	efa_reset = array of properties for 'reset font size' link
	efa_smaller = array of properties for 'decrease font size' link

	properties array format:
		['before HTML',
		 'inside HTML',
		 'title text',
		 'class text',
		 'id text',
		 'name text',
		 'accesskey text',
		 'onmouseover JavaScript',
		 'onmouseout JavaScript',
		 'on focus JavaScript',
		 'after HTML'
		 ]
*/

var efa_default = 75; //default text size as percentage of user default
var efa_increment = 6; //percentage to increase/decrease font size
var efa_bigger = ['', //HTML to go before 'bigger' link e.g. <strong>Schrift: <' +'/strong>
	'<img class="gross" width="20px" height="20px" src="https://www.seniorenland.com/out/oxbaseshop/html/0/images/leer.gif" alt="Ansicht verg&ouml;&szlig;ern" border="0" />', //HTML to go inside 'bigger' anchor tag e.g. grösser
	'Ansicht verg&ouml;&szlig;ern', //title attribute e.g. Schrift grösser stellen
	'', //class attribute
	'', //id attribute
	'', //name attribute
	'', //accesskey attribute
	'', //onmouseover attribute
	'', //onmouseout attribute
	'', //onfocus attribute
	'' //HTML to go after 'bigger' link e.g.  • 
	]

var efa_smaller = ['', //HTML to go before 'smaller' link
	'<img class="klein" width="20px" height="20px" src="https://www.seniorenland.com/out/oxbaseshop/html/0/images/leer.gif" alt="Ansicht verkleinern" border="0" />', //HTML to go inside 'smaller' anchor tag e.g. kleiner
	'Ansicht verkleinern', //HTML to go inside 'smaller' anchor tag e.g. Schrift kleiner stellen
	'', //class attribute
	'', //id attribute
	'', //name attribute
	'', //accesskey attribute
	'', //onmouseover attribute
	'', //onmouseout attribute
	'', //onfocus attribute
	'' //HTML to go after 'bigger' link
	]

function Efa_Fontsize06(increment,bigger,smaller,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.biggerLink = this.getLinkHtml(1,bigger);
		this.smallerLink = this.getLinkHtml(-1,smaller);
	} else {
		this.biggerLink = '';
		this.smallerLink = '';
		this.efaInit = new Function('return true;');
	}

	this.allLinks = this.biggerLink + this.smallerLink;
}

Efa_Fontsize06.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) + '%';
}

Efa_Fontsize06.prototype.getLinkHtml = function(direction,properties) {
	var html = properties[0] + '<a href="#" onclick="efa_fontSize06.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];
}

Efa_Fontsize06.prototype.getPref = function() {
	var pref = this.getCookie('fontSize');
	if (pref) return parseInt(pref);
	else return this.def;
}

Efa_Fontsize06.prototype.setSize = function(direction) {
	this.pref = (direction)?this.pref+(direction*this.increment):this.def;
	this.setCookie(this.pref);
	//alert("Efa_Fontsize06 Set Cookie \n this.pref = " + this.pref);
	this.body.fontSize = Math.round(this.pref*this.base) + '%';
}

Efa_Fontsize06.prototype.getCookie = function() {
	var cookie = fontSize.getCookie("fontSize");
	//alert("Efa_Fontsize06 Get Cookie \n Cookie = " + cookie);
	return (cookie)?cookie:false;
}

Efa_Fontsize06.prototype.setCookie = function(cookieValue) {
	//alert("Set Cookie Efa soll ausgeführt werden");
	return fontSize.setCookie("fontSize", cookieValue);
}

var  efa_fontSize06 = new Efa_Fontsize06(efa_increment,efa_bigger,efa_smaller,efa_default);