//nacitanie z cookies
var cookie_fontsize = getCookie('fontsize');
// document.write('FS: '+cookie_fontsize);

//pridanie zvacsovaca pisma
function fontResizer()
{
    var e = document.getElementById('productmenu');
    var resizer = document.createElement('div');
        resizer.style.textAlign = 'center';
        resizer.style.margin = '10px 0px 10px 0px';
    
    var fontsize1 = document.createElement('a');
        fontsize1.style.fontSize = '10px';
        fontsize1.style.padding = '2px 2px 2px 2px';
        fontsize1.style.color = '#DA3D00';
        fontsize1.style.textDecoration = 'none';
        fontsize1.appendChild(document.createTextNode('A'));
        fontsize1.href = "javascript:changeFontSize(0);";
        // if (cookie_fontsize == 0 || cookie_fontsize == null)
        // {
        //     fontsize1.style.background = '#DA3D00';
        //     fontsize1.style.color = '#FFFAE4';
        // }
    
    var fontsize2 = document.createElement('a');
        fontsize2.style.fontSize = '12px';
        fontsize2.style.padding = '2px 2px 2px 2px';
        fontsize2.style.color = '#DA3D00';
        fontsize2.style.textDecoration = 'none';
        fontsize2.appendChild(document.createTextNode('A'));
        fontsize2.href = "javascript:changeFontSize(1);";
        // if (cookie_fontsize == 1)
        // {
        //     fontsize2.style.background = '#DA3D00';
        //     fontsize2.style.color = '#FFFAE4';
        // }
    
    var fontsize3 = document.createElement('a');
        fontsize3.style.fontSize = '14px';
        fontsize3.style.padding = '2px 2px 2px 2px';
        fontsize3.style.color = '#DA3D00';
        fontsize3.style.textDecoration = 'none';
        fontsize3.appendChild(document.createTextNode('A'));
        fontsize3.href = "javascript:changeFontSize(2);";
        // if (cookie_fontsize == 2)
        // {
        //     fontsize3.style.background = '#DA3D00';
        //     fontsize3.style.color = '#FFFAE4';
        // }
    
    var fontsize4 = document.createElement('a');
        fontsize4.style.fontSize = '16px';
        fontsize4.style.padding = '2px 2px 2px 2px';
        fontsize4.style.color = '#DA3D00';
        fontsize4.style.textDecoration = 'none';
        fontsize4.appendChild(document.createTextNode('A'));
        fontsize4.href = "javascript:changeFontSize(3);";
        // if (cookie_fontsize == 3)
        // {
        //     fontsize4.style.background = '#DA3D00';
        //     fontsize4.style.color = '#FFFAE4';
        // }
    
    resizer.appendChild(fontsize1);
    resizer.appendChild(fontsize2);
    resizer.appendChild(fontsize3);
    // resizer.appendChild(fontsize4);
    e.appendChild(resizer);
}
addEvent(window,'load',fontResizer);

function changeFontSize(size)
{
    var fontsize = document.body.style.fontSize;
    size = size - 1 + 1;
    switch (size)
    {
        case 0:
            fontsize = '0.7em';
        break;
        case 1:
            fontsize = '0.8em';
        break;
        case 2:
            fontsize = '0.9em';
        break;
        case 3:
            fontsize = '1em';
        break;
    }
    var expires = new Date();
    expires.setTime(expires.getTime() + 10*24*60*60*1000);
    deleteCookie('fontsize','/');
    setCookie('fontsize',size,expires,'/');
    // alert(getCookie('fontsize'));
    document.body.style.fontSize = fontsize;
}

//zvacsenie podla cookies
if (cookie_fontsize)
{
    changeFontSize(cookie_fontsize);
}
