function LoadNormalSize(img, descr)
{
    document.formphoto.normalphoto.src = img;
    document.formphoto.normalphoto.alt = descr;
    document.formphoto.normalphoto.title = descr;
    document.getElementById('photodscr').innerHTML = descr;
    return false;
}

function ShowOriginalPicture(img)
{
    NewWindow=window.open('', '','width='+780+',height='+580+',toolbar=no,directories=no,menubar=no,locations=no,status=no,scrollbars=yes,resizable=yes,fullscreen=no');
    NewWindow.document.writeln("<html><head></head>");
    NewWindow.document.writeln("<body leftmargin=0 topmargin=0 style=\"font-family: Arial, Tahoma, Helvetica, sans-serif; font-size: 11pt;\"><div align=center>");
    NewWindow.document.writeln("<title>Favore.pl - Zdjęcie</title><br><br>");
    NewWindow.document.writeln("<a href=\"javascript:window.close();\"><img src=\"" + img + "\" style=\"border: solid 1px #EBEBEB;\"></a><br><br>");
    NewWindow.document.writeln("<input type=\"button\" class=\"bold\" value=\"Zamknij okno\" onclick=\"javascript:window.close();\"/>");
    NewWindow.document.writeln("</div></body></html>");
    NewWindow.document.close();
    NewWindow.focus();
}

function adjustToResolution()
{
    var wndWidth = document.body.offsetWidth;
    var wndExtraWidth = wndWidth - 1024;

    if(wndExtraWidth > 0)
    {
        var newWidthMainPhoto = 280;
        var newHeightMainPhoto = 210;
        if(wndExtraWidth > 20)
        {
            newWidthMainPhoto = newWidthMainPhoto + wndExtraWidth;
            if(newWidthMainPhoto > 400)
                newWidthMainPhoto = 400;

            var restWidth = wndExtraWidth - newWidthMainPhoto + 280;
            if(restWidth > 80)
                restWidth = 80;

            if(restWidth >= 20)
            {
                var newPadd = parseInt(restWidth / 2);
                document.getElementById('photoblock').style.paddingLeft = (10+newPadd) + 'px';
                document.getElementById('thirdcol').style.paddingLeft = (10+newPadd) + 'px';
            }
            newHeightMainPhoto = parseInt(newWidthMainPhoto * 0.75);
        }
        document.getElementById('mainphoto').style.width = newWidthMainPhoto + 'px';
        document.getElementById('mainphoto').style.height = newHeightMainPhoto + 'px';
        document.getElementById('photodscr').style.width = newWidthMainPhoto + 'px';
        var forThird = wndExtraWidth - newWidthMainPhoto + 280 - restWidth;
        document.getElementById('showmorebox').style.width = (document.getElementById('showmorebox').offsetWidth + forThird) + 'px';
    }
    return false;
}


function ShowMoreCats(show)
{
    if(show)
    {
        document.getElementById('showlink').style.display = 'none';
        $("#showmorecats").toggle(500);
    }
    else
    {
        document.getElementById('showlink').style.display = '';
        $("#showmorecats").toggle(500);
    }
}
