function set_cookie(name,value) {
		expire_date = new Date();
		in_one_year = expire_date.getTime() + (365 * 24 * 60 * 60 * 1000);
		expire_date.setTime(in_one_year);
		document.cookie = name + "=" + value + "; expires=" + expire_date.toGMTString() + ";path=/;";
}

function read_cookie_value(cookie_name) {
		if(document.cookie.match(cookie_name)) {
				cookie_name_length = cookie_name.length;
				var cookie_position = document.cookie.indexOf(cookie_name);
				var start_value_reading = cookie_position + cookie_name_length + 1;
				var interim_value = document.cookie.substr(start_value_reading);
				var position_next_separator = interim_value.indexOf(";");

				if(position_next_separator != "-1") {
						var stop_value_reading = position_next_separator;
						var cookie_value = document.cookie.substr(start_value_reading,stop_value_reading);
				} else {
						var cookie_value = document.cookie.substr(start_value_reading);
				}
				return cookie_value;
		}
}



function change_body_font(span) {
		font_size = span.substr(5,7);
		new_font_size = font_size.replace("_",".");
		set_cookie("accessibility_font_size",new_font_size);
		location.reload();
}

function show_font_switcher() {
		document.write("<div class=\"middle\"><div id=\"font_switcher\">");
		document.write("<ul>");
		document.write("<li><dfn>1:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_0_95\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"kleine Schriftgr&ouml;&szlig;e\">A<\/a><\/li>");
		document.write("<li><dfn>2:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_1_0\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"normale Schriftgr&ouml;&szlig;e\">A<\/a><\/li>");
		document.write("<li><dfn>3:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_1_2\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"gro&szlig;e Schriftgr&ouml;&szlig;e\">A<\/a><\/li>");
		document.write("<\/ul>");
		document.write("<\/div><\/div>");
}

function show_font_switcher_en() {
		document.write("<div class=\"middle\"><div id=\"font_switcher\">");
		document.write("<ul>");
		document.write("<li><dfn>1:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_0_95\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"small fontsize\">A<\/a><\/li>");
		document.write("<li><dfn>2:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_1_0\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"medium fontsize\">A<\/a><\/li>");
		document.write("<li><dfn>3:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_1_2\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"big fontsize\">A<\/a><\/li>");
		document.write("<\/ul>");
		document.write("<\/div><\/div>");
}

function show_font_switcher_ru() {
	document.write("<div class=\"middle\"><div id=\"font_switcher\">");
	document.write("<ul>");
	document.write("<li><dfn>1:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_0_95\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"малый размер шрифта\">A<\/a><\/li>");
	document.write("<li><dfn>2:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_1_0\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"средний размер шрифта\">A<\/a><\/li>");
	document.write("<li><dfn>3:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_1_2\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"крупный размер шрифта\">A<\/a><\/li>");
	document.write("<\/ul>");
	document.write("<\/div><\/div>");
}

function show_font_switcher_tr() {
	document.write("<div class=\"middle\"><div id=\"font_switcher\">");
	document.write("<ul>");
	document.write("<li><dfn>1:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_0_95\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"Kücük punto\">A<\/a><\/li>");
	document.write("<li><dfn>2:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_1_0\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"Normal punto\">A<\/a><\/li>");
	document.write("<li><dfn>3:<\/dfn><a href=\"javascript:history.go(0)\" id=\"font_1_2\" onclick=\"change_body_font(this.id);\" onkeypress=\"this.onclick\" title=\"Büyük punto\">A<\/a><\/li>");
	document.write("<\/ul>");
	document.write("<\/div><\/div>");
}

function apply_accessibility_font() {
		cookie_value = read_cookie_value("accessibility_font_size");
		document.getElementById("wrapper").style.fontSize = cookie_value + "em";
}
