function checkKandidaat(nr) {
	box = 'document.formpje.kan_'+nr;
	if (!eval(box).checked) {
		 eval(box).checked = true;
	} else {
		 eval(box).checked = false;
	}
	fillNummer(nr);
}

function fillNummer(nr) {
	value = document.formpje.cvid.value;
	if (value.indexOf(nr) >= 0) {
		value = value.replace(','+nr,"")
		value = value.replace(nr,"")
		box = 'document.formpje.kan_'+nr;
		if (eval(box).checked)
			eval(box).checked = false;
	} else {
		if (value != "")
			value = value+','+nr;
		else
			value = nr;
	}
	document.formpje.cvid.value = value;
}

function makeOfficeButton(w, img, title, func, skin, alt) {
         if (!alt)
            alt = "";
    document.write("<td width="+w+" height=25 align=center onClick=\""+func+";\">");
    document.write("<table cellpadding=1><tr><td onmouseover=\"button_over(this);\" onmouseout=\"button_out(this);\" onmousedown=\"button_down(this);\" width="+ (w-5) +" height=22 align=center style=\"cursor:pointer;\">");
    if (img != ""){ document.write("<img alt=\""+alt+"\" src=\"/lib/skins/"+skin+"/images/"+ img +"\" border=0 align=absmiddle>&nbsp;"); }
    document.write(title+"</td></tr></table></td>");
}

function setClass(obj, classname) {
    obj.className = classname;
}

function checkLogin(){
    if ((document.login.username.value == '') || (document.login.password.value == '')) {
        window.alert('Beide velden moeten worden ingevuld!');
        return false;
    } 
}

function Help() {
    showHelp('help.asp?show='+escape(parent.mainFrame.location.pathname));
}


function refresh(pagename) {
    window.opener.location.href = pagename;
}

function changePage() {
    if (self.parent.frames.length != 0){
        self.parent.location=document.location;
    }
}

function checkChoice(field, i) {
    if (i == 1) {
        for (i = 0; i < field.length; i++)
            field[i].checked = true;
        }
    else  {  // A checkbox other than "Any" selected.
        for (i = 0; i < field.length; i++)
            field[i].checked = false;
        }
}

function setFocusOnFirstField() {
    for (var i = 0; i < document.forms[0].length; i++) {
        if (document.forms[0].elements[i].type == "text"){
            document.forms[0].elements[i].focus();
            break;
        }
    }
}

function showFullImage(id){
    WindowInfo = window.open('/show_image.asp?id='+id,'Image','scrollbars=yes,width=600,height=475');
    WindowInfo.focus();
}

function showUser(id){
    WindowInfo = window.open('personen_info.asp?id='+id,'Personen','scrollbars=yes,width=650,height=475');
    WindowInfo.focus();
}
    
function viewPicture(pic) {
    PicWin = window.open('/image_view.asp?pic='+pic,'PicWin','scrollbars=no,width=400,height=275');
    PicWin.focus();
}

function showCalendar(obj, datum, js) {
    var winWidth = 200;
    var winHeight = 170;
    var leftPos = (screen.availWidth-winWidth) / 2;
    var topPos = (screen.availHeight-winHeight) / 2;
    var WindowInfo = window.open('/lib/calendar.asp?d='+datum+'&obj='+obj+'&js='+escape(js), 'Kalender', 'scrollbars=no,resizable=no,status=no,toolbar=no,width='+winWidth+',height='+winHeight+',top=' + topPos + ',left=' + leftPos);
    //WindowInfo.focus();
}


function showBericht(id) {
    berichtWin = window.open('/components/berichten/showartikel.asp?home=true&berichtid='+id,'bericht','scrollbars=yes,resizable=yes,toolbar=no,width=500,height=400,top=0,left=200');
    berichtWin.focus()
}

function download(id) {
    document.location = '/download.asp?id='+id;
}

function button_over(eButton) {
    eButton.className = "officeButtonOver";
}

function button_out(eButton) {
    eButton.className = "officeButtonOut";
}

function button_down(eButton){  
    eButton.className = "officeButtonDown";
}

function button_up(eButton) {
    eButton.className = "officeButtonUp";
    eButton = null; 
}

function ViewImage(id){
    var leftPos = (screen.availWidth-600) / 2;
    var topPos = (screen.availHeight-475) / 2;
    WindowInfo = window.open('/image_view.asp?id='+id,'Image','scrollbars=no,width=600,height=475,top='+topPos+',left='+leftPos);
    WindowInfo.focus();
}
function viewPicture(id){
    var leftPos = (screen.availWidth-600) / 2;
    var topPos = (screen.availHeight-475) / 2;
    WindowInfo = window.open('/image_view.asp?id='+id,'Image','scrollbars=no,width=600,height=475,top='+topPos+',left='+leftPos);
    WindowInfo.focus();
}

/*functies voor het openen van items in de objecten*/

function OpenActiviteit(id, type){
    document.location = '/components/activiteiten/activiteit.asp?id='+id+'&type='+type;
}

function openPage(id){
    document.location = '/page.asp?id='+id;
}

function OpenNews(id){
    document.location = '/components/nieuws/nieuws.asp?id='+id;
}

function openFAQ(id) {
    document.location  = '/components/faq/showvraag.asp?id='+id;
}

function OpenWebshop(id){
    document.location = '/components/webshop/product.asp?id='+id+'&u='+escape(document.location);
}

function OpenDiscussie(id, groepid){
    document.location = '/components/forum/forum_reacties.asp?id='+id+'&groep_id='+groepid;
}

function OpenHandboekPage(boekid,id) {
    document.location = '/components/boeken/book.asp?boekid='+boekid+'&id='+id;
}

function Filemanager(ObjectID){
    var url = escape(document.location);
    var leftPos = (screen.availWidth-500) / 2
    var topPos = (screen.availHeight-380) / 2
    
    var uploadWindow = window.open('/file.asp?url='+url+'&objectid='+ObjectID,'myWindow', 'scrollbars=no,resizable=yes,status=yes,toolbar=no,width=500,height=380,top=' + topPos + ',left=' + leftPos);
    uploadWindow.focus();
}