var bufferBlock = null;
function someFunction()
{
    document.getElementById('IntroBackgroundId').style.display = "none";
}

function hideAllBlocks()
{
    $(".readMoreLink").each(function() {
        
        var target = $(this).attr("rel");
        var CheckLang = $('.Logo').parent('a').attr('href');
        var GetLang = _siteRoot + 'en-us/';
        $("#"+target).hide();
        if(CheckLang == GetLang.toLowerCase()) {
            $(this).text(">> read more");
        } else {
            $(this).text(">> lees verder");
        }
        
        $(this).parent().removeClass("selected");
    });
}

$(document).ready(function(){
    $(".ExtraContent").hide();
    
    var CheckLang = $('.Logo').parent('a').attr('href');
    var GetLang = _siteRoot + 'en-us/';

    $(".readMoreLink").click(function() {
        
        var targetBlock = $(this).attr("rel");
        
        if(bufferBlock == targetBlock)
        {
            $(".ContentMenu").show();
            $("#MenuMaster").show();
            $("#Menu").show();
            $(".LeftBlock").show();
            
            $("#ContentWrapper").width(702);
            $("#"+targetBlock).hide();
            
            if(CheckLang == GetLang.toLowerCase()) {
    
            } else {
                $(this).text(">> lees verder");
            }
            
            // clear buffer for the same link is clicked
            bufferBlock = null;
            
            $(this).parent().removeClass("selected");
            
        }
        else
        {
            hideAllBlocks();
            $(".ContentMenu").hide();
            $("#MenuMaster").hide();
            $("#Menu").hide();
            $(".LeftBlock").hide();
            
            $("#ContentWrapper").width(900);
            $("#"+targetBlock).show();
            
            if(CheckLang == GetLang.toLowerCase()) {
                $(this).text("<< back to overview");
            } else {
                $(this).text("<< terug naar overzicht");
            }
            bufferBlock = targetBlock;
            
            $(this).parent().addClass("selected");

        }
    });     
});