function MakeAllInvisible()
{
    document.getElementById('Friesland').style.display = "none";
    document.getElementById('Overijsel').style.display = "none";
    document.getElementById('Twente').style.display = "none";
    document.getElementById('Lelystad').style.display = "none";
    document.getElementById('Gelderland').style.display = "none";
    document.getElementById('Liemers').style.display = "none";
    document.getElementById('Brabant').style.display = "none";
    document.getElementById('Utrecht').style.display = "none";
    document.getElementById('NoordHolland').style.display = "none";
    document.getElementById('Dordrecht').style.display = "none";
    document.getElementById('ZuidHolland').style.display = "none";
    document.getElementById('Groningen').style.display = "none";
}

var bufferBlock = null;
function Overijsel()
{
    MakeAllInvisible();
    document.getElementById('Overijsel').style.display = "block";
}

var bufferBlock = null;
function Friesland()
{
    MakeAllInvisible();
    document.getElementById('Friesland').style.display = "block";
}

var bufferBlock = null;
function Twente()
{
    MakeAllInvisible();
    document.getElementById('Twente').style.display = "block";
}

var bufferBlock = null;
function NoordHolland()
{
    MakeAllInvisible();
    document.getElementById('NoordHolland').style.display = "block";
}

var bufferBlock = null;
function ZuidHolland()
{
    MakeAllInvisible();
    document.getElementById('ZuidHolland').style.display = "block";
}

var bufferBlock = null;
function Groningen()
{
    MakeAllInvisible();
    document.getElementById('Groningen').style.display = "block";
}

var bufferBlock = null;
function Lelystad()
{
    MakeAllInvisible();
    document.getElementById('Lelystad').style.display = "block";
}

var bufferBlock = null;
function Brabant()
{
    MakeAllInvisible();
    document.getElementById('Brabant').style.display = "block";
}

var bufferBlock = null;
function Liemers()
{
    MakeAllInvisible();
    document.getElementById('Liemers').style.display = "block";
}

var bufferBlock = null;
function Utrecht()
{
    MakeAllInvisible();
    document.getElementById('Utrecht').style.display = "block";
}

var bufferBlock = null;
function Gelderland()
{
    MakeAllInvisible();
    document.getElementById('Gelderland').style.display = "block";
}

var bufferBlock = null;
function Dordrecht()
{
    MakeAllInvisible();
    document.getElementById('Dordrecht').style.display = "block";
}

$(document).ready(function(){
    //News clickable rows
    $(".news tr").click(function(){
        var url = $(this).find("a").attr("href");
        window.location.href = url;
    });
    
    //Control the menu hover arrows
    $("#Menu ul li .menuHover").each(function() {
        if ($(this).parent().attr("class") != "current") {
            $(this).hide();
        } else {
            $(this).show();
        }
    });
    $("#Menu ul li").hover(function() {
        $(this).find(".menuHover").show();
    }, function() {
        $(this).find(".menuHover").hide();
    });
    
    //MenuControl
    $("#Menu ul li").hover(function() {
        $(this).children("a").addClass("selected");
        $(this).find("ul").show();
    }, function() {
        $(this).children("a").removeClass("selected");
        $(this).find("ul").hide();
    });
    

});

//MapContact Control

var bufferBlock = null;
function someFunction()
{
    document.getElementById('MapContact').style.display = "none";
}

function hideAllBlocks()
{
    $(".readMoreLink").each(function() {
        
        var target = $(this).attr("rel");
        $("#"+target).hide();
        $(this).text(">> lees verder");
        
        $(this).parent().removeClass("selected");
    });
}

$(document).ready(function(){
    $(".ExtraContent").hide();
    $(".readMoreLink").click(function() {
        
        var targetBlock = $(this).attr("rel");
        
        if(bufferBlock == targetBlock)
        {
            $(".ContentMenu").show();
            $("#MenuMaster").show();
            $("#Menu").show();
            $(".LeftBlock").show();
            
            $("#ContentWrapper").width(702);
            $("#"+targetBlock).hide();
            
            $(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();
            
            $(this).text("<< terug naar overzicht");
            bufferBlock = targetBlock;
            
            $(this).parent().addClass("selected");

        }
    });
    
});
