function check_note(){
	dom = document.forms['noteedit'];
	if(dom.elements['cap'].value.length < 2){
		alert(JS_FIELD_ERROR+"\r\n"+JS_FIELD_CAPT);
		return false;
	}
	if(dom.elements['not'].value.length < 2){
		alert(JS_FIELD_ERROR+"\r\n"+JS_FIELD_NOTE);
		return false;
	}
	if(dom.elements['rec[]'].length){
		rec_checked = 0;
		for(i=0;i<dom.elements['rec[]'].length;i++){
			if(dom.elements['rec[]'][i].checked == true){
				rec_checked++;
			}
		}
		if(rec_checked < 1){
			alert(JS_FIELD_ERROR+"\r\n"+JS_FIELD_RECIPIENTS);
			return false;
		}
	}else{
		if(dom.elements['rec[]'].checked != true){
			alert(JS_FIELD_ERROR+"\r\n"+JS_FIELD_RECIPIENTS);
			return false;
		}
	}
	return true;
}

var note_id;
function set_note_id(id){
	note_id = id;
}

function get_note_id(){
	return note_id;
}

function save_forward(id){
   var params = '&id='+id;
   var num = 0;
   el = document.forms['forward'].elements['fwd[]'];
   if(el.length){
	   for(i=0;i<el.length;i++){
	   	if(el[i].checked){
	   		params = params+'&cID[]='+el[i].value;
	   		num++;
	   	}
	   }
   }else{
   	if(el.checked){
   		params = params+'&cID[]='+el.value;
   		num++;
   	}
   }
   if(num>0){
	window.location.href=SAVE_FORWARD_LINK+params;
   }else{
   	alert(YES_JS_ERROR_NO_RECIPIENTS);
   }
}

function mark(schalter){
	len = document.forms['notizen'].elements['nID[]'].length;
	for(i=0;i<len;i++){
		el = document.forms['notizen'].elements['nID[]'][i];
		if(el.checked==false){
			if(schalter == 1)
				el.checked=true;
		}else{
			if(schalter == 0)
				el.checked=false;
		}
	}
}
function del(){
	yes = confirm(JS_CONFIRM_REALLY_DELETE);
	if(yes)
		document.forms['notizen'].submit();
}
function mark_as_read(){
	yes = confirm(JS_CONFIRM_REALLY_MARK);
	if(yes){
		len = document.forms['notizen'].elements['nID[]'].length;
		nIDs = '';
		for(i=0;i<len;i++){
			el = document.forms['notizen'].elements['nID[]'][i];
			if(el.checked==true){
				nIDs += '&nID[]='+el.value;
			}
		}
		window.location.href=MARK_AS_READ_LINK+nIDs;
	}
}
function check_submit(){
	myaction = document.forms['notizen'].myaction.value;
	switch(myaction){
		case 'del':
			del();
			break;
		case 'mark_as_read':
			mark_as_read();
			break;
		default:
			var move_active = myaction.search(/ove_.+/);
			if(move_active == 1){
				folderID = myaction.substr(5,myaction.length);
				len = document.forms['notizen'].elements['nID[]'].length;
				nIDs = '';
				for(i=0;i<len;i++){
					el = document.forms['notizen'].elements['nID[]'][i];
					if(el.checked==true){
						nIDs += '&nID[]='+el.value;
					}
				}
				window.location.href=MOVE_FOLDER_LINK+'&folder='+folderID+nIDs;
			}
			break;
	}
}

