   	//*********************************************
	// Popup window
	//*********************************************
 	function savewin(x, y, title, url) {
    	window.open(url ,title ,'width=' + x + ',height=' + y + ',toolbar=0,location=1,directories=0,resizable=1,scrollbars=1,status=1');
	}

	//*********************************************
	// Sets all checkboxes on page
	//*********************************************
	function check_all_checkbox(){
		var element=document.getElementsByTagName('INPUT');
		for(i=0;i<element.length;i++)
		void(element[i].checked=!element[i].checked)
	}


   	//*********************************************
	// Ask form
	//*********************************************
	function validate(form, message){
 		if (check_box(form)) {
 			if (confirm(message)){
        		return true;
	        } else{
    	    	return false;
        	}
		} else{
    	   	return false;
        }
	}


   	//*********************************************
	// Ask form
	//*********************************************
	function ask(message){
		if (confirm(message)){
       		return true;
        } else{
   	    	return false;
       	}
	}


    //*********************************************
	// Menu switch
	//*********************************************
	function menu_switch(id){
		document.menu.id.value = id;
        document.menu.submit();
	}


   	//*********************************************
	// Popup window
	//*********************************************
	function newwin(x, y, title, url, scroll){
    	window.open(url ,title ,'width=' + x + ',height=' + y + ',toolbar=0,location=0,directories=0,resizable=0,scrollbars=' + scroll + ',status=0');
	}


   	//*********************************************
	// Special Popup window
	//*********************************************
	function popup(x, y, title, table){
    	window.open('popups/popup.php?id=' + table + '&title=' + title + '',title ,'width=' + x + ',height=' + y + ',toolbar=0,location=0,directories=0,resizable=0,scrollbars=1,status=0');
	}


   	//*********************************************
	// Image window
	//*********************************************
	function image(x, y, title, image){
    	win = window.open('', '','width=' + x + ',height=' + y + ',toolbar=0,location=0,directories=0,resizable=0,scrollbars=0,status=0');
    	win.document.write('<html><head><title>' + title + '</title></head><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" bottommargin="0" rightmargin="0" marginwidth="0" marginheight="0">');
    	win.document.write('<img src="' + image + '" width="' + x + '" height="' + y + '" border=0>');
    	win.document.write('</body></html>');
	}


    //*********************************************
	// Page switch
	//*********************************************
	function page_switch(id, page){
		document.menu.id.value = id;
		document.menu.page.value = page;
        document.menu.submit();
	}

	//*********************************************
	// Check if any checkbox is selected
	//*********************************************
	function check_box(form){
		var count = 0;
		with (form) {
	    	for (var i=0; i < elements.length; i++) {
        		if (elements[i].type == 'checkbox' && elements[i].checked) count++;
			}
		}

		var wm = "Let op:\n\r\n";
		var noerror = 1;

		// --- any checkbox selected ? ---
		if (count < 1) {
			wm += "Selecteer minimaal 1 item!\r\n";
			noerror = 0;
		}

		// --- check if errors occurred ---
		if (noerror == 0) {
			alert(wm);
			return false;
		}
		else {
		    return true;
		}
	}

	//*********************************************
	// Add text in textarea on cursor location
	//*********************************************
	function insertAtCursor(myField, myValue) {
		//IE support
		if (document.selection) {
			myField.focus();
			sel = document.selection.createRange();
			sel.text = myValue;
		}

		//MOZILLA/NETSCAPE support
		else if (myField.selectionStart || myField.selectionStart == '0') {
			var startPos = myField.selectionStart;
			var endPos = myField.selectionEnd;

			myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
		} else {
			myField.value += myValue;
		}

        return false;
	}
