﻿function renderHeaders() {
    //return;
    for(var iOuter=1;iOuter<=6;iOuter++) {
        var oHeaders = document.getElementsByTagName("h"+iOuter);
        for (var iInner = 0; iInner < oHeaders.length; iInner++) {
            oHeaders[iInner].replaceChild(GetRenderImgTag(iOuter, oHeaders[iInner].innerHTML),oHeaders[iInner].firstChild);
        }
    }
    return;
}
function GetRenderImgTag(iHi, strText) {
    strText += " ";
    
    var iHeight = 24;
    var iAntialias = 5;//4..Antialias,5..ClearType
    var strARGB = "ff000000"; //black
    var strBGARGB = "fff9f9f9";
    var iFont = 2; //1..Lane,2..Arial Narrow
    var lSpacing=0;
    switch (iHi) {
        case 1: //große Überschriften
            iFont=1;
            iAntialias=4;
            iHeight = 17;
            strARGB = "ff133a80";
            strBGARGB = "fffafaee";
            strText = encodeURI(strText.toUpperCase());
            break;
        case 2: //kleine Überschrift
            iFont=1;
            iAntialias=4;
            iHeight = 12;
            strARGB = "ff133a80";
            strBGARGB = "";//transparent
            strText = encodeURI(strText.toUpperCase());
            break;
        case 3:
            iHeight = 24;
            strARGB = "fffafaee";
            break;
        case 4://metanav
            iHeight = 14;
            iAntialias=4;
            strARGB="ff999999";
            strBGARGB="000000";
            break;
        case 5://nav 1. Hirarchieebene aktiv
            iAntialias=4;
            iHeight = 22;
            strARGB="ff133a80";
            strBGARGB="00000000";
            lSpacing="0,5";
            strText = encodeURI(" "+strText.toUpperCase());
            break;
        case 6://nav 1. Hirarchieebene inaktiv
            iAntialias=4;
            iHeight = 22;
            strARGB="66ffffff";
            strBGARGB="00ffffff";
            lSpacing="0,5";
            strText = encodeURI(" "+strText.toUpperCase());
            break;
    }
    
    
    strText = strText.replace(/&amp;/g, "%26"); //"&"
    strText = strText.replace(/%20/g, "+");     //{space}
    
    var strImgSrc="renderText/renderCustomFont.aspx?font="+iFont+"&spacing="+lSpacing+"&aa="+iAntialias+"&height="+iHeight+"&argb="+strARGB+"&bgargb="+strBGARGB+"&text="+strText;
    var imgTag=document.createElement("img");
    imgTag.setAttribute("src",strImgSrc);
    return imgTag;
}