
$(function()
{
    if($("#grid-wrapper").length > 0)
    {
        // homepage thumbs special effect
        var vg = $("#grid-wrapper").vgrid({
        easeing: "easeOutQuint",
        time: 800,
        delay: 60,
        selRefGrid: "#grid-wrapper div.x1",
        selFitWidth: ["#container", "#footer"],
        gridDefWidth: 220 + 15 + 15 + 5,
        forceAnim: 1    });

        $(window).load(function(e){
            setTimeout(function(){
                // prevent flicker in grid area - see also style.css
                $("#grid-wrapper").css("paddingTop", "0px");
            }, 1000);
        });
    }

    // homepage thumbs mouse over / out special effect
    if($('.slider_thumbs').length > 0)
    {
        $('.slider_thumbs').hover(function()
        {
            $(this).attr('src', 'images/thumb-over.png').animate({}, 300);
        }, function()
        {
            $(this).attr('src', 'images/thumbs/' + $(this).attr('id') + '.jpg').animate({}, 300);
        });
    }
    $("a img").fadeTo("fast", .9); // This sets the opacity of the thumbs to fade down to 60% when the page loads


    $('.boxgrid.captionfull').hover(function(){
    $(".cover", this).stop().animate({top:'50px'},{queue:false,duration:160});
    $(".image", this).stop().animate({top:'-90px'},{queue:false,duration:160});
    }, function() {
        $(".cover", this).stop().animate({top:'140px'},{queue:false,duration:160});
        $(".image", this).stop().animate({top:'0px'},{queue:false,duration:160});
    });
});


document.write("<style type='text/css'>#thephoto {visibility:hidden;}</style>");
function initImage() {
    if($('#thephoto').length > 0)
    {
        imageId = 'thephoto';
        image = document.getElementById(imageId);
        setOpacity(image, 0);
        image.style.visibility = "visible";
        fadeIn(imageId,0);
    }
}
function fadeIn(objId,opacity) {
    if (document.getElementById) {
        obj = document.getElementById(objId);
        if (opacity <= 100) {
            setOpacity(obj, opacity);
            opacity += 10;
            window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
        }
    }
}
function setOpacity(obj, opacity) {
    opacity = (opacity == 100)?99.999:opacity;
    // IE/Win
    obj.style.filter = "alpha(opacity:"+opacity+")";
    // Safari<1.2, Konqueror
    obj.style.KHTMLOpacity = opacity/100;
    // Older Mozilla and Firefox
    obj.style.MozOpacity = opacity/100;
    // Safari 1.2, newer Firefox and Mozilla, CSS3
    obj.style.opacity = opacity/100;
}

window.onload = function() {initImage()}
