// Initialize the arrays containing our size info. var pixelArray = new Array('10', '12', '14', '16', '18'); // Possible font px sizes var countOfPixels = pixelArray.length; var initSize = 1; // Array position of inital px size function fontSizer(inc) { /*if (!document.getElementById) return;*/ var size = readCookie('size'); size = parseInt(inc) + parseInt(size); if (size < 0) { size = 0; } //changed by Tim-Oliver Schulz - www.punsk.de - : remove JS error when size > allowed size //if (size > countOfPixels ) { size = countOfPixels; } if (size >= countOfPixels) { size = countOfPixels - 1; } if(createCookie("size", size, 365)) doFontSizing(size); return false; } function fontSizerOnLoad(preferredSize) { /*if (!document.getElementById) return;*/ var size = readCookie('size'); if (size < 0) { size = 0; } //changed by Tim-Oliver Schulz - www.punsk.de - : remove JS error when size > allowed size //if (size > countOfPixels ) { size = countOfPixels; } if (size >= countOfPixels) { size = countOfPixels - 1; } /*switchPic();*/ doFontSizing(size); } function doFontSizing(theFontSize) { // Bugfix: Elements inside table would not resize with only the code below, so we do them seperatly. // NOTE: This only resizes the font, nothing else. // Resize by ID does not work with this. aTables = document.getElementsByTagName('table'); for (i = 0; i < aTables.length; i++) { //changed by Tim-Oliver Schulz - www.punsk.de - : Firefox-Fix //aTables[i].style.fontSize = pixelArray[theFontSize]; aTables[i].style.fontSize = pixelArray[theFontSize] + 'px'; } // if you rather want to size an individual element by ID, use this: // resizeContainer = document.getElementById('nameOfConainingElement'); // and uncomment the if statements at the start of each function resizeContainer = document.getElementsByTagName('body')[0]; //changed by Tim-Oliver Schulz - www.punsk.de - : Firefox-Fix //resizeContainer.style.fontSize = pixelArray[theFontSize]; resizeContainer.style.fontSize = pixelArray[theFontSize] + 'px'; } function normalSize() { /*if (!document.getElementById) return;*/ var size = 2; doFontSizing(size); createCookie("size", size, 365); } function normalSizePrint() { /*if (!document.getElementById) return;*/ var size = 2; doFontSizing(size); } /*function switchPic(size){ theImage = document.getElementById('dIndexBanner').firstChild; imagePath = theImage.src; }*/ function createCookie(name, value, days) { if(JSON.parse( decodeURI(readCookie("cookie_consent"))).options.includes("font size")) { if (days) { var date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); var expires = "expires=" + date.toGMTString(); } else { expires = ""; } document.cookie = name + '=' + value + '; ' + expires + '; path=/'; return true; } else { if(confirm("Sie haben dem Speichern des Cookies für die Schriftgröße nicht zugestimmt. Möchten Sie Ihre Cookie-Einstellungen jetzt ändern?")) reOpenCookiePopup(); return false; } } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1, c.length); } if (c.indexOf(nameEQ) == 0) { return c.substring(nameEQ.length, c.length); } } return initSize; } window.onload = function (e) { if ($(document).width() > 480) fontSizerOnLoad(readCookie("size")); }