function CookieSet(name,value) {
	document.cookie=name + "=" + escape(value) + ";expires=Thu Feb 10 2028 12:00:00 GMT+0100;path=/;domain=" + document.domain;
}

function CookieGet( name ) {
	var name = name + "=";
	var cs = document.cookie.split(';');
	for (var i=0; i<cs.length; i++) {
		var c = cs[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
	}
	return null;
}

function fontlarger() {
	if(StyleActual()=='normal') {
		StyleActivate('large');
	} else if(StyleActual()=='small') {
		StyleActivate('normal');
	}
}


function fontsmaller() {
	if(StyleActual()=='normal') {
		StyleActivate('small');
	} else if(StyleActual()=='large') {
		StyleActivate('normal');
	}
}



function StyleActivate( value ) {
	if (value == '') { return; }
	CookieSet( 'preferences_fontsize', value );
	var i, lnk;
	for( i = 0; (lnk = document.getElementsByTagName("link")[i]); i++ ) {
		if ( lnk.getAttribute('rel').indexOf('style') != -1 && lnk.getAttribute('title') ) {
			lnk.disabled = true;
			if ( lnk.getAttribute('title') == value ) {
				lnk.disabled = false;
			}
		}
	}
}

function StyleActual( prefix ) {
	var i, lnk;
	for( i = 0; (lnk = document.getElementsByTagName("link")[i]); i++ ) {
		if ( lnk.getAttribute('rel').indexOf('style') != -1 && lnk.getAttribute('title') && !lnk.disabled ) {
			return lnk.getAttribute('title');
		}
	}
	return null;
}


function betumeretstart() {
	var elozostilus=CookieGet('preferences_fontsize');
	if(elozostilus==null) {
		elozostilus='normal';
	}
	StyleActivate( elozostilus );
}
