		function setWait() {
			document.body.style.cursor = "wait";
		}

		// chkAll toggles all the checkboxes of a certain name -necessarily one or an array
		function chkAll(frm, arr, mark) {
		  for (i = 0; i <= frm.elements.length; i++) {
		   try{
			 if(frm.elements[i].name == arr) {
			   frm.elements[i].checked = mark;
			 }
		   } catch(er) {}
		  }
		}
		function findObj(theObj, theDoc){
		  var p, i, foundObj;  
		  if(!theDoc) theDoc = document;
		  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length){
			theDoc = parent.frames[theObj.substring(p+1)].document;
			theObj = theObj.substring(0,p);
		  }
		  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
		  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
			foundObj = theDoc.forms[i][theObj];
		  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
			foundObj = findObj(theObj,theDoc.layers[i].document);
		  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);//HIER
		  return foundObj;
		}

		function makeVisible(element) {
			if(findObj(element)){
				if(findObj(element).className == 'invisible'){
					findObj(element).className = 'visible';
				}else{
					findObj(element).className = 'invisible';
				}
				return true;
			} else {
				return false;				
			}
		}
		function toggleForm(myform, mybutton, hidetekst, showtekst) {
			if(makeVisible(myform)){
				if (findObj(mybutton)) {
					if (findObj(mybutton).value == showtekst) {
						findObj(mybutton).value = hidetekst;
					}else{
						findObj(mybutton).value = showtekst;
					}
				}
			}
		}
		function toggleAll(element_prefix,theclass,labelelement,labelon,labeloff,labeltype) {
			turnon = (findObj('').className == 'invisible');
			var theclass = (turnon) ? theclass : "invisible";
			var labeltype = (labeltype != 'value') ? 'innerHTML' : labeltype;
			var setlabel = (labelelement == null || !findObj(labelelement)) ? 0 : 1;
		  for (i = 0; i <= document.elements.length; i++) {
			  var method = frm.elements[i].value;
		   try{
			   frm.elements[i].checked = mark;
		   } catch(er) {}
		  }

			//frm = document.forms[0];
//		  for (i = 0; i <= frm.elements.length; i++) {
	//		  var method = frm.elements[i].value;
		//   try{
			//   frm.elements[i].checked = mark;
		//   } catch(er) {}
		 // }
			if(findObj(element)){
				if(force == 1) turnon = true;
				else if(force == 0) turnon = false;
				else turnon = (findObj(element).className == 'invisible');
				if(turnon){
					findObj(element).className = theclass;
					if(setlabel) thelabel = labelon;
				}else{
					findObj(element).className = 'invisible';
					if(setlabel) thelabel = labeloff;
				}
				if(setlabel) findObj(labelelement).labeltype = thelabel;
				return true;
			} else {
				return false;				
			}
		}
		function toggleAllViews(doc, prefix,affix){
		  for (i = 0; i <= doc.embeds.length; i++) {
			  var element = doc.embeds[i].id;
			  if (element == prefix + affix) {
				window.document.embeds[i].classname = 'visible';
			  } else {
				if (window.document.embeds[i].id.indexOf(prefix, 0)) {
					window.document.embeds[i].classname = 'invisible';
				}
			  }
		  }
	
		}

function toggleView(element,force,theclass,labelelement,labelon,labeloff,labeltype) {
//HIER			alert('is coming here for ' + element);
			var theclass = (theclass == null) ? "visible" : theclass;
			var force = (force == null) ? -1 : force;
			var labeltype = (labeltype != 'value') ? 'innerHTML' : labeltype;
			var setlabel = (labelelement == null || !findObj(labelelement)) ? 0 : 1;
		//	alert('setlabel wordt ' + setlabel + 'en type is ' + labeltype + 'en de class is ' + theclass);
			if(findObj(element)){
			//	alert('wel gevonden en de force was ' + force);
				//alert ('de klasse nu was ' + findObj(element).className);
				if(force == 1) turnon = true;
				else if(force == 0) turnon = false;
				else turnon = (findObj(element).className == 'invisible');
				if(turnon){
					findObj(element).className = theclass;
					if(setlabel) {thelabel = labelon;}
				}else{
					findObj(element).className = 'invisible';
					if(setlabel) {thelabel = labeloff;}
				}
				if(setlabel) (labeltype == 'value')? findObj(labelelement).value = thelabel:  findObj(labelelement).innerHTML = thelabel;
				return true;
			} else {
				return false;				
			}
		}
		
		function refreshwithLanguage(myform, language) {
			setFormObjVal(myform, 'lang', language);
			myform.submit();
		}
		function setFormObjBool(frm, ename, val) {
		  for (i = 0; i <= frm.elements.length; i++) {
		   try{
			 if(frm.elements[i].name == ename) {
			   frm.elements[i].checked = val;
			 }
		   } catch(er) {}
		  }
		}
		
		function setFormObjVal(frm, ename, val) {
		  for (i = 0; i <= frm.elements.length; i++) {
		   try{
			 if(frm.elements[i].name == ename) {
			   frm.elements[i].value = val;
			 }
		   } catch(er) {}
		  }
		}
		
		function userAction(thisform, action) {
			setFormObjVal(thisform, "beforeaction", action );
        }
		function containerCreation(theForm, action) {
			userAction(theForm, action);
			if (theForm.cc_copyrightholder.value == "" || theForm.cc_copyrightyear.value == "") {
				alert('<?php echo "aap";?>Please specify the copyrightholder and copyright year');
				return false;
			} else {
				if (action == 'createcontainer') {
					return true;
				} else {
					return 	checkUploadForm(theForm);
				}
			}			
		}
		function checkUploadForm() {
			//Ugly: the first two types are Tree types and should be checked for a specified zip file
			if ( findObj('container_type')[0].checked && findObj('container').value !== "") {
				alert('You cannot upload files to a collection/container, a list or an image container');
				return false;
			} else {
				if (findObj('container_type')[1].checked && findObj('container').value == "") {
					alert('Please specify a zipfile location first');
					return false;
				} else {
					return true;
				}
			}
        }
		
		function showUpload(action,container_type){
			var action = (action == 1) ? 1 : 0;
			toggleView('uploadform',action,'uploadform');
		}

		function checkDownLoadForm(str) {
			//Ugly: the first two types are Tree types and should be checked for a specified zip file
			if (findObj('agreeLicense').checked){
				return true;
			} else {
				alert(str);
				return false;
			}
        }
		function checkCommentForm(theForm) {
			if (theForm.comment_namebox.value == "" || theForm.comment_emailbox.value == "") {
				alert('Please specify your name and email first');
				return false;
			} else {
				return true;
			}
		}
		function checkRegisterUserForm(theForm, msg) {
			if (theForm.firstname.value == ""  || theForm.surname.value == "" ||
				theForm.email.value == ""  || theForm.username.value == "" ||
				theForm.pwd.value == ""  || theForm.pwd2.value == "") {
				alert(msg);
				return false;
			} else {
				return true;
			}
        }
		function checkRegisterSiteForm(theForm, msg) {
			if (theForm.app_name.value == ""  || theForm.app_description.value == "" ||
				theForm.app_contact.value == ""  || theForm.app_email.value == "" ||
				theForm.app_homepage.value == "") {
				alert(msg);
				return false;
			} else {
				return true;
			}
        }
		function formCheck(formobj, alertMsg, fields_str) {
			var fieldsRequired = fields_str.split(",");
			// name of mandatory fields
			var l_Msg = alertMsg.length;
			
			for (var i = 0; i < fieldsRequired.length; i++){
				var obj = formobj.elements[fieldsRequired[i]];
				if (obj){
					if (obj.type == null){
						var blnchecked = false;
						for (var j = 0; j < obj.length; j++){
							if (obj[j].checked){
								blnchecked = true;
							}
						}
						if (!blnchecked){
							alertMsg += " - " + fieldsRequired[i] + "\n";
						}
						continue;
					}
		
					switch(obj.type){
						case "select-one":
							if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
								alertMsg += " - " + fieldsRequired[i] + "\n";
							}
							break;
						case "select-multiple":
							if (obj.selectedIndex == -1){
								alertMsg += " - " + fieldsRequired[i] + "\n";
							}
							break;
						case "textarea":
						case "password":
						case "text":
							if (obj.value == "" || obj.value == null){
								alertMsg += " - " + fieldsRequired[i] + "\n";
							}
							break;
						default:
					}
				}
			}
		
			if (alertMsg.length == l_Msg){
				return true;
			}else{
				alert(alertMsg);
				return false;
			}
		}

		function checkItemUploadForm(theForm) {
			if (theForm.item.value == ""  && theForm.item_type[0].checked) { // it was a 'file'
				alert('Please specify a file location first');
				return false;
			} else {
				if (theForm.item_meta_url.value == ""  && theForm.item_type[1].checked){ //it was a 'link'
					alert('Please specify a url first');
					return false;
				} else {
					return true;
				}
			}
        }
		
		function changeCC(field,value){
			if(field == null || value == null) return false;
			if(field == 'cu'){
				if(value == "y" || value =="none") 		findObj('imgspan_'+field).innerHTML = '';
				else if(value == "n")	findObj('imgspan_'+field).innerHTML = '<img src="styles/media/cc.nc.gif" />';
			}else if(field == 'mod'){
				if(value == "y" || value =="none") 		findObj('imgspan_'+field).innerHTML = '';
				else if(value == "sa")	findObj('imgspan_'+field).innerHTML = '<img src="styles/media/cc.sa.gif" />';
				else if(value == "n")	findObj('imgspan_'+field).innerHTML = '<img src="styles/media/cc.nd.gif" />';
			}
		}
// This code is free software 
// Highlighting HTML Access Keys by Christian Schmidt
// This code may be freely used, copied, modified, distributed etc.
// Slightly amended by Edwin Veenendaal

// Iterates through all elements that support the ACCESSKEY attribute.
function highlightAccessKeys() {
    //don't do anything in old browsers
    if (!document.getElementsByTagName) return;

    var labels = document.getElementsByTagName('LABEL');
    for (var i = 0; i < labels.length; i++) {
        var control = document.getElementById(labels[i].htmlFor);
        if (control && control.accessKey) {
            highlightAccessKey(labels[i], control.accessKey);
        } else if (labels[i].accessKey) {
            highlightAccessKey(labels[i], labels[i].accessKey);
        }
    }

    var tagNames = new Array('BUTTON','INPUT');
    for (var j = 0; j < tagNames.length; j++) {
        var elements = document.getElementsByTagName(tagNames[j]);
        for (var i = 0; i < elements.length; i++) {
            if (elements[i].accessKey) {
                highlightAccessKey(elements[i], elements[i].accessKey);
            }
        }
    }
}

// Highlights the specified character in the specified element
// Added by Edwin Veenendaal: for elements without text childnodes, we highlight in a textual manner
function highlightAccessKey(e, accessKey) {
	var txt;
	if (e.tagName == "INPUT") {
		var inputtype;
		inputtype = e.type;
		if (inputtype == "button" || inputtype == "submit" || inputtype == "reset") {
			txt = e.value;
			if (txt.toLowerCase().indexOf(accessKey.toLowerCase()) != -1) {
				var txt1, txt2, pos;
				pos  = txt.toLowerCase().indexOf(accessKey.toLowerCase());
				txt1 = txt.substr(0, pos);
				txt2 = txt.substr(pos + 1);
				e.value = (txt1 + '[' + accessKey + ']' + txt2);
			}
		}
		return;
	}
	
    if (e.hasChildNodes()) {
        var childNode;
        
        //find the first text node that contains the access character
        for (var i = 0; i < e.childNodes.length; i++) {
            txt = e.childNodes[i].nodeValue;
            if (e.childNodes[i].nodeType == 3 &&
                txt.toLowerCase().indexOf(accessKey.toLowerCase()) != -1) {
                childNode = e.childNodes[i];
                break;
            }
        }
        
        if (!childNode) {
            //access character was not found
            return;
        }

        var pos = txt.toLowerCase().indexOf(accessKey.toLowerCase());
        var span = document.createElement('SPAN');
        var spanText = document.createTextNode(txt.substr(pos, 1));
        span.className = 'accesskey';
        span.appendChild(spanText);

        //the text before the access key
        var text1 = document.createTextNode(txt.substr(0, pos));
        //the text after the access key
        var text2 = document.createTextNode(txt.substr(pos + 1));
        
        if (text1.length > 0) e.insertBefore(text1, childNode);
        e.insertBefore(span, childNode);
        if (text2.length > 0) e.insertBefore(text2, childNode);

        e.removeChild(childNode);
    }
}

		//HIER Wellicht niet nodig
		function viewItem(net, rep, cid, itid) {
			var locationitem = "'item.php?itemAction=extraview&netid="+ net +"&repid="+rep + "&cid=" + cid + "&itid=" + itid + "'";
			window.location=locationitem;
		}