/*********************************************************************************************/
/* Hiding things before jQuery gets ready avoids flickering */
/*********************************************************************************************/
document.write('<style type="text/css">#main_div{display:none}</style>');

/*********************************************************************************************/
/* This is the callback for jQuery - when the Document is ready this function will be called */
/*********************************************************************************************/
$(document).ready(function(){

    /* set default size */
    show_main();
    $("[rel='fotos']").colorbox({
                                resize:"true", 
                                rel:"fotos", 
                                speed: "1000"
                                });

    $("[rel='cbox']").click(function() {

        wd = "970";
        ht = "650";

        var content = $(this).attr('alt');
        if (content == "guestbook") { wd = "740"; }
        if (content == "news")      { wd = "800"; }
        if (content == "info")      { wd = "900"; ht= "700"; }
        if (content == "impressum") { wd = "600"; }

        /* call colorbox without object context */
        $(this).colorbox({
                         width:wd + "px",
                         height:ht + "px",
                         open:true,
                         iframe:true,
                         title: $(this).attr("alt")
                     });

        // To prevent default action
        return false;
    });
});


/* centers then main div vertically */
function show_main(ht) {

    $("div#main_div").hide();
    ht = 620;
    bd = ($(window).height() - ht )/2;

    if (bd < 20) { bd = 20; }

    $("div#main_div").css("margin-top", bd + "px");
    $("div#main_div").fadeIn(3500);


}
