/*
COPYRIGHT:
	FRANK GEBHARD
	CPEACH - INTERNETDIENSTLEISTUNGEN
	FASANENSTRASSE 68
	38102 BRAUNSCHWEIG, GERMANY
	info@cpeach.de
*/

	function changeClass(objID, classID)
    {
        document.getElementById(objID).className = classID;;
    }

    function getFontSize()
    {
	    a = document.cookie;
	    cookiename = a.substr(0,a.search('='));
	    cw = a.substr(a.search('=')+1,a.search(';'));
	    if(cw == '')
	    {
	    	cw = a.substr(a.search('=')+1,a.length);
	    }
	    return cw;
    }

    function initFontSize()
    {
        i=getFontSize();
        if(i.substr(0,i.search('px')))
        {
        	//alert();
            document.getElementById("textfeld").style.fontSize ="11px";
            changeClass('tab3','std');
            //alert("1");
        }
        else
        {
        	document.getElementById("textfeld").style.fontSize =i;
            j=parseFloat(i.substr(0,i.search('em')));
            j=(j+0.1)+"em";
            document.write("<style type='text/css'><!--a{font-size:"+j+";}--></style>");
        }
    }

    function resetFontSize()
    {
        var a = new Date();
        a = new Date(a.getTime() +1000*60*60*24*365);
        document.cookie = 'fontSize=11px; expires='+a.toGMTString()+';';
        document.getElementById("textfeld").style.fontSize ="11px";
        sizeMenu("12px");
    }

    function saveFontSize(fsz)
    {
        var a = new Date();
	    a = new Date(a.getTime() +1000*60*60*24*365);
	    document.cookie = 'fontSize='+fsz+'; expires='+a.toGMTString()+';';
	    document.getElementById("textfeld").style.fontSize =fsz;
        j=parseFloat(fsz.substr(0,fsz.search('em')));
        j=(j+0.1)+"em";
        sizeMenu(j);
    }

    function showBorder(obj,borderWidth)
    {
       obj.parentNode.style.borderWidth=borderWidth;
    }

    function sizeFont(mathFunc)
    {
        i=getFontSize();
       // alert("font "+i);
        if(i.substr(0,i.search('em')))
        {
            //alert("in 1");
            j=parseFloat(i.substr(0,i.search('em')));
            if(mathFunc)
            {
                //alert("in 1a");
                j=(j+0.1)+"em";
            }
            else
            {
            //alert("in 1b");
                j=(j-0.1)+"em";
            }
            saveFontSize(j);
        }
        else
        {
            //alert("in 2");
            saveFontSize('0.8em');
        }
    }

    function sizeMenu(objSize)
    {
    	objA= document.getElementsByTagName("a");
        for(i=0;i<objA.length;i++)
        {
         	document.getElementsByTagName("a")[i].style.fontSize=objSize;

        }
    }
