/**
 * @description		root page ts config
 * @project			Jugendforum Courage Website
 * @site			www.jugendforum-courage.de
 * @revision		$Revision: 22 $
 * @lastmodified	$Date: 2009-04-05 17:16:37 +0200 (So, 05. Apr 2009) $
 */

var efa_bigger = ['<strong>Ansicht:</strong> ',
	'Größer',
	'Darstellung vergrößern',
	'header',
	'',
	'',
	'',
	'',
	'',
	'',
	' | '
	]

var efa_smaller = ['',
	'Kleiner',
	'Darstellung verkleinern',
	'header',
	'',
	'',
	'',
	'',
	'',
	'',
	''
	]

/* cookie configuration */
var font_timelimit = 1;		// font_timelimit = integer expressing time in units (default is 7 [days])
var time_unit = 'hours';	// units = 'miliseconds' | 'seconds' | 'minutes' | 'hours' | 'days' | 'months' | 'years' (default is [7] 

/* getExpiration */ 
var expires = getExpiration(font_timelimit, time_unit);

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_fontSize";
		this.cookieName = 'jfc_fs';
		this.increment = increment;
		this.def = def;
		this.base = 1;
		this.pref = this.getPref();
		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() {
	this.body = (this.w3c)?document.getElementsByTagName('body')[0].style:document.all.tags('body')[0].style;
	this.body.fontSize = (this.pref*this.base)/100 + 'em';
}

Efa_Fontsize06.prototype.getLinkHtml = function(direction,properties) {
	var html = properties[0] + '<a href="#" onclick="efa_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];
}

Efa_Fontsize06.prototype.getPref = function() {
	var pref = this.getCookie(this.cookieName);
	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.cookieName,this.pref, expires);
	this.body.fontSize = (this.pref*this.base)/100 + 'em';
}

Efa_Fontsize06.prototype.getCookie = function(cookieName) {
	//var cookie = cookieManager.getCookie();
	var cookie = get_cookie(cookieName);
	return (cookie)?cookie:false;
}

Efa_Fontsize06.prototype.setCookie = function(cookieName,cookieValue,expires) {
	return set_cookie(cookieName, cookieValue, expires);
}

// gets an expiration date for a cookie as a GMT string
// expiration = integer expressing time in units (default is 7 days)
// units = 'miliseconds' | 'seconds' | 'minutes' | 'hours' | 'days' | 'months' | 'years' (default is 'days') 
function getExpiration(expiration,units) {
	// set default expiration time if it wasn't supplied
	expiration = (expiration)?expiration:7;
	// supply default units if units weren't supplied
	units = (units)?units:'days';
	// new date object we'll use to get the expiration time
	var date = new Date();
	// set expiration time according to units supplied
	switch(units) {
	    case 'years':
			date.setFullYear(date.getFullYear() + expiration);
			break;
		case 'months':
			date.setMonth(date.getMonth() + expiration);
			break;
		case 'days':
			date.setTime(date.getTime()+(expiration*24*60*60*1000));
			break;
		case 'hours':
			date.setTime(date.getTime()+(expiration*60*60*1000));
			break;
		case 'minutes':
			date.setTime(date.getTime()+(expiration*60*1000));
			break;
		case 'seconds':
			date.setTime(date.getTime()+(expiration*1000));
			break;
		default:
			date.setTime(date.getTime()+expiration);
			break;
    }
	// return expiration as GMT string
	return date;
}


// Cookie Toolbox Javascript
// copyright 4th September 2002, by Stephen Chapman, Felgall Pty Ltd

// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.
// For instructions on how to use these functions see "A Cookie Toolbox"
// in the Javascript section of our site at http://www.felgall.com/
var dbug = 0;
function d_a(ary) {
	var beg = next_entry(ary) - 1;
	for (var i = beg ; i > -1; i--) {
		ary[i] = null;
	}
}
function init_array() {
	if (dbug) alert('init_cookie');
	var ary = new Array(null);
	return ary;
}
function set_cookie(name,value,expires) {
	if (dbug) alert('set_cookie');
	if (!expires) expires = new Date();
	document.cookie = name + '=' + escape(value) + '; expires=' + expires.toGMTString() + '; path=/';
}
function get_cookie(name) {
	if (dbug) alert('get_cookie');
	var dcookie = document.cookie;
	var cname = name + "=";
	var clen = dcookie.length;
	var cbegin = 0;
	while (cbegin < clen) {
		var vbegin = cbegin + cname.length;
		if (dcookie.substring(cbegin, vbegin) == cname) {
			var vend = dcookie.indexOf (";", vbegin);
			if (vend == -1) vend = clen;
			return unescape(dcookie.substring(vbegin, vend));
		}
		cbegin = dcookie.indexOf(" ", cbegin) + 1;
		if (cbegin == 0) break;
	}
	return null;
}
function del_cookie(name) {
	if (dbug) alert('del_cookie');
	document.cookie = name + '=' + '; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/';
}
function get_array(name, ary) {
	if (dbug) alert('get_array'); d_a(ary);
	var ent = get_cookie(name);
	if (ent) {
		i = 1; 
		while (ent.indexOf('^') != '-1') {
			ary[i] = ent.substring(0,ent.indexOf('^')); i++;
			ent = ent.substring(ent.indexOf('^')+1, ent.length);
		}
	}
}
function set_array(name, ary, expires) {
	if (dbug) alert('set_array');
	var value = '';
	for (var i = 1; ary[i]; i++) {
		value += ary[i] + '^';
	}
	set_cookie(name, value, expires);
}
function del_entry(name, ary, pos, expires) {
	if (dbug) alert('del_entry');
	var value = '';
	get_array(name, ary);
	for (var i = 1; i < pos; i++) {
		value += ary[i] + '^';
	}
	for (var j = pos + 1; ary[j]; j++) {
		value += ary[j] + '^';
	}
	set_cookie(name, value, expires);
}
function next_entry(ary) {
	if (dbug) alert('next_entry');
	var j = 0;
	for (var i = 1; ary[i]; i++) {
		j = i
	}
	return j + 1;
}
function debug_on() {
	dbug = 1;
}
function debug_off() {
	dbug = 0;
}
function dump_cookies() {
	if (document.cookie == '') document.write('No Cookies Found');
	else {
		thisCookie = document.cookie.split('; ');
		for (i=0; i<thisCookie.length; i++) {
			document.write(thisCookie[i] + '<br \/>');
		}
	}
}