var PRO_PREFIX = "PR_";

function changeInputs() {

	var els = document.getElementsByTagName('input');
	var elsLen = els.length;
	var i = 0;
	
	for ( i=0;i<elsLen;i++ ) {
	
		if ( els[i].getAttribute('type') ) {
	
			if ( els[i].getAttribute('type') == "text" ) {
	
				if (els[i].className == '') { 
	
					els[i].className = 'text';
	
				} else {
	
					els[i].className = 'text ' + els[i].className;
	
				}
	
			}
	
			if ( els[i].getAttribute('type') == "password" ) {
	
				els[i].className = 'text';
	
			}
	
			if ( els[i].getAttribute('type') == "submit" ) {
	
				els[i].className = 'submit';
	
			}
	
			if ( els[i].getAttribute('type') == "radio" ) {
	
				els[i].className = 'radio';
	
			}
	
		}
	
	}

}

function activate(element) {
	document.getElementById(element).className = "active"; 
}

function show_spec(div) {
	d = document.getElementById(div);
	
	if (d.style.display == "block") {
		d.style.display = "none";
	} else {
		d.style.display = "block";
	}
}

function delete_project(id,title,return_to) {
	
	if (confirm("Project: "+title+" verwijderen?")) {
		
		window.location = HTTP_ROOT+return_to+"&delete="+id;
	
	}
	
}

function popup(page,width,height) {
  myWindow = window.open('/popup.php?page='+page,'bn_popup','width='+width+',height='+height+',scrollbars=1,toolbar=0,location=0,resizable=1');
  myWindow.focus();
}

function popup_doc(doc,width,height) {
  myWindow = window.open(doc,'bn_doc_popup','width='+width+',height='+height+',scrollbars=1,toolbar=0,location=0,resizable=1');
  myWindow.focus();
}

function check_all(form_name,el_name) {

	// find all child checkboxes of parent
	var form = $(form_name);
	
	var boxes = form.getInputs('checkbox',el_name);
	//var boxes = form.getInputs('checkbox');
	
	// loop trough boxes
	for( i = 0; i < boxes.length; i++ ) {
	
		boxes[i].checked = true;
	
	}
	
}