
function resizeGrootWindow() {

	var afb = document.getElementById( 'afbeelding' );
	var bijs = document.getElementById( 'bijschrift' );

	var aw = afb.width;
	var ah = afb.height;
	var bw = bijs.style.width;
	var bh = bijs.style.height;

/*
	alert( "bijs="+bijs);
	alert( "bijs.style="+bijs.style);
	alert( "bijs.style.width="+bijs.style.width);
	alert( "afb.height=" + ah + "\nafb.width=" + aw + "\nbijs.height=" + bh + "\nbijs.width=" + bw );
*/

	if ( window.innerWidth ) {
		iWidth = window.innerWidth;
		iHeight = window.innerHeight;
	}
	else {
		iWidth = document.body.clientWidth;
		iHeight = document.body.clientHeight;
	}

	myWidth = afb.width + 1; // border
	myHeight = afb.height + 100; // bijschrift + border
	iWidth = myWidth - iWidth;
	iHeight = myHeight  - iHeight;
	parent.window.resizeBy(iWidth, iHeight);
	self.focus();
/*
	var height = afb.height;
	var width = afb.width;
	alert( "height=" + height + "\nwidth=" + width );
	alert( "bijs.height=" + bijs.height + "\nbijs.width=" + bijs.width );
	parent.window.resizeTo( width, height );
*/
}


function printen() {
	var strHref = window.location.href;
	var idhtml = strHref.split("/");
	var id = idhtml[idhtml.length-1].split(".");	
	var url = '/lg/print/index.html?id='+id[0]+'&onderdeel='+idhtml[idhtml.length-2];
	var titel = 'Print';
	var options = 'scrollbars,resizable,width=530,height=500';
	var opdrWindow = window.open(url,titel,options);
	if (opdrWindow != null) {
		opdrWindow.focus();
	}
}

function isGood() {
    alert('That image exists!');
}

function isBad() {
    alert('That image does no exist!');
}
function groot(id) {
	var URL = "afbgroot/"+id
	var tester=new Image();
   	tester.onLoad=window.open('groot?id='+id,'Vergroting','resizable,left=0,top=0,screenX=0,screenY=0');
    	tester.onError=isBad;
    	tester.src=URL;
	//var grootwindow = 
	// var grootwindow = window.open('groot?id='+id,'Vergroting','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=520,height=800,copyhistory=0,left=0,top=0,screenX=0,screenY=0');

	//if (grootwindow != null) {
	//	grootwindow.focus();
	//}
}

function fosu(id) {

	var fswindow = window.open('fosu?id='+id,'fosu','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=550,height=452,copyhistory=0,left=0,top=0,screenX=0,screenY=0');

	if (fswindow != null) {
		fswindow.focus();
	}
}

function opdracht(id, path){
	var url = 'maak-opdracht/'+id+'.html';
	var titel = 'maakopdracht';
	var options = 'scrollbars,resizable,width=530,height=500';
	var opdrWindow = window.open(url,titel,options);
	if (opdrWindow != null) {
		opdrWindow.focus();
	}
}

      function doit(){
            var msg = "";
	    var en = "" ;
	    var t = 0 ;
            var checkboxes = document.getElementById("myform");
            for(var i = 0; i < checkboxes.length; i++){
                var chk = checkboxes[i];
                if(chk.checked){
		t++ ;
		if(t == 1) {
		en = "" ;
		}
		else {
		en = "en "
		}
                    msg += en + chk.value + " ";
                }
            }
            if(msg.length == 0){
                alert("U heeft niets geselecteerd");
                return false;
            }
            return confirm("Weet je zeker dat je klas " + msg + "wilt deleten ?");

        }

function informatie(id, path){
	if ( typeof( path ) == "undefined" ) {
		path = "";
	}
	else if ( path.substr( -1, 1) != '/' ) {
		path = path + '/';
	}
	var tzwindow = window.open('/lg/'+ path + 'informatie/'+id+'.html','Informatie','scrollbars,resizable,width=700,height=500');
	if (tzwindow != null) {
		tzwindow.focus();
	}
}



function terzijde(id, path){
	if (path  == '' ) {
        path = 'middeleeuwen';
	}
	var tzwindow = window.open('/lg/'+path+'/terzijde/'+id+'.html','Terzijde','scrollbars,resizable,width=700,height=500');
	if (tzwindow != null) {
		tzwindow.focus();
	}
}


function toggleElement(elt) {

	if ( elt.style.display == 'inline') {
		elt.style.display = 'none';
	} else {
		elt.style.display = 'inline';
	}

	return false;
}


var SWW_alopen = 0

function sww(nummer) {
	SWW_alopen = 1;
	h = 735;
	w = 1024;
	h = h + 10;
	w = w + 16;
	if (document.layers) {w = w + 2;}
	if (h+58 >= screen.height) {h=screen.height-58;}
	if (w >= screen.width)  {w=screen.width-10;}
	spreekwoordenWindow = window.open('spreekwoord.html?id='+(nummer ? nummer: 0),'spreekwoord','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width='+w+',height='+h+',copyhistory=0,left=0,top=0');
}

function spreekwoord(nummer){

	if (SWW_alopen == 0) {
		sww(nummer ? nummer : 0);
	} else {
		if (spreekwoordenWindow.closed) {
			sww(nummer ? nummer : 0);
		} else {
			spreekwoordenWindow.spreekwoord(nummer ? nummer : 0);
		}
	}
}
function geenGroot(id){
	var parent = document.getElementById(id);
	var container = document.getElementById('afbeeldingen');
	while (parent.childNodes.length > 0){
		container.insertBefore(parent.childNodes[0], parent);
	}
	container.removeChild(parent);
}
function isGood() {
    alert('That image exists!');
}


