﻿function pageLoad() {
   // var hetdomein = $('.jsPath').val();
   // alert(hetdomein);
}



$('document').ready(function() {
    Cufon.replace('h1.borisblackbloxx');

    if (!jQuery.fn.flash.hasFlash(8, 0, 0)) {
        $('.browse').hide();
        $('.browse-noflash').show();
        $('#player').hide();
        $('#player-noflash').show();
    }


    $('.blader-link').click(function() {
        $('form').after("<div id=\"overlay\">&nbsp;</div>");
        $(this).blur();
        $('#overlay').css('opacity', '0.5');

        var language = $(this).attr('language');
        var bookid = $(this).attr('bookid');
        var flashheight = $(this).attr('flashheight');
        var flashwidth = $(this).attr('flashwidth');
        var country = $(this).attr('country');
  

        $('#overlay').fadeIn(500, overlay_flash_ingeladen(language, bookid, flashheight, flashwidth,country));
        //  $("#overlay").fixedPosition();
        return false;
    });

    //breek uit frame
    if (top.location != location) {
        top.location.href = document.location.href;
    }

});      //einde document ready




    


function overlay_ingeladen() {
    $('#overlay-content').center();
    $('#overlay-content').css({'z-index':'4000'})
    $('#overlay-content').show();
    $('#overlay').click(close_overlay);
    //$('#overlay-content').fixedPosition({vpos: null,hpos: null});
}

//vanuit flash
function sluit_overlay() { $('#overlay-flash-content-container').remove(); $('#overlay-flash-content').remove(); overlay_gesloten(); }
//vanuit html popup
function close_overlay() {  
    $('#overlay-content').remove();   
    overlay_gesloten();
 }

function overlay_gesloten() {
    $('#overlay').fadeOut(500);
    setTimeout("$('#overlay').remove()", 500);
    $('overlay-flash-content-container').remove();
}



function overlay_flash_ingeladen(language, bookid, flashheight, flashwidth, country) {
    //alert(language);
    //alert(bookid);
    //alert(flashwidth);
    //alert(flashheight);
    //alert(country);
    file = "swf/flipbook/flipbook.swf";
    if (country == "nl") 
    {        
        staticPath = "http://staticcontent.orange-juice.nl/leuksteliedjesnl/";
    }
    if (country == "be" | country == "de")
     {
        staticPath = "http://staticcontent.orange-juice.nl/liedjeswebshop/";
    } 
       
    $('#overlay').click(sluit_overlay);
    $('#overlay').before('<div id="overlay-flash-content-container" style="width:' + flashwidth + 'px;height:' + flashheight + 'px;"><div id="overlay-flash-content" style="width:' + flashwidth + 'px;height:' + flashheight + 'px;"></div></div>');

    
    if (jQuery.fn.flash.hasFlash(8, 0, 0)) {
                    
                     $('#overlay-flash-content').flash(
                        { 
                          src: file,
                          width: flashwidth,
                          height: flashheight,
                          menu: "false", 
                          wmode: "transparent", 
                          allowScriptAccess: "always",
                          flashvars: { language: language, bookID: bookid, staticPath: staticPath  }
                        },
                        { version: 8 }
                    );
                                    
                }
                else { $('#alt').css('z-index', 90000); }
                setTimeout("centreer();", 100);               
  }







$(window).resize(function() {
    centreer();
});

jQuery.fn.center = function() {
    this.css("position", "absolute");
    this.css("top", ($(window).height() - this.height()) / 2 + $(window).scrollTop() + "px");
    this.css("left", ($(window).width() - this.width()) / 2 + $(window).scrollLeft() + "px");
    return this;
}


function centreer() {
    $('#overlay-content').center();
    $('#overlay-flash-content-container').center();
}


