function confirmAndRedirect(message,page){

    var answer = confirm(message)
    if (answer){
        window.location = page;
    }

}

function toggleEditor(id) {
    if (!tinyMCE.get(id))
        tinyMCE.execCommand('mceAddControl', false, id);
    else
        tinyMCE.execCommand('mceRemoveControl', false, id);
}

function changeDiv(divId,divText){
          
    document.getElementById(divId).innerHTML = divText;
    
}


function textCounter(field,cntfield,maxlimit) {
    if (document.getElementById(field).value.length > maxlimit) // if too long...trim it!
        document.getElementById(field).value = document.getElementById(field).value.substring(0, maxlimit);
    // otherwise, update 'characters left' counter
    else
        document.getElementById(cntfield).value = maxlimit - document.getElementById(field).value.length;
}

function change_img(image,name){
    document[name].src=image;
}

function changeBgImage (image, id) {
    if (window.selected!=id){ 
        var element = document.getElementById(id);
        element.style.backgroundImage = "url("+image+")";  
    }
    
    
    
}
function popup(mylink, windowname)
            {
            if (! window.focus)return true;
            var href;
            if (typeof(mylink) == 'string')
               href=mylink;
            else
               href=mylink.href;
            window.open(href, windowname, 'width=600,height=500,scrollbars=yes');
            return false;
            }


function sponsorUit(){
    document.getElementById('sponsoren_advertentie').style.display = 'none';
}
function sponsorAan(sponsor){
    document.getElementById('sponsoren_advertentie').innerHTML = '<img src="'+sponsor+'">';
    document.getElementById('sponsoren_advertentie').style.display = '';
}
