// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
//	disabled ein formular (nach klick auf submit-button)
function jfg_disable_form(g49bpform) {
	if (document.all || document.getElementById) {
		for (i = 0; i < g49bpform.length; i++) {
			if (g49bpform.elements[i].type) {
				if (g49bpform.elements[i].type.toLowerCase() == "submit" || 
				    g49bpform.elements[i].type.toLowerCase() == "button") {
					g49bpform.elements[i].disabled = true;
				}
			}	
		}
	}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
//	aktiviert oder deaktiviert alle checkboxen in einem formular mit entsprechendem prefix
function jfg_select_all(g49bpform,prefix,checked) {
	if (document.all || document.getElementById) {
		for (i = 0; i < g49bpform.length; i++) {
			if (g49bpform.elements[i].type.toLowerCase() == "checkbox" && 
				g49bpform.elements[i].name.substr(0,prefix.length) == prefix) {
				g49bpform.elements[i].checked = checked;
			}	
		}
	}
} 
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
function jfg_do_nothing() {}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
//	Layer bei Mauszeiger einblenden
function jfg_show_div(event,divid){
	if (window.event) {
		event = window.event;
	}
	tempX = event.clientX + 10;
	tempY = event.clientY + 10;
	
	document.getElementById(divid).style.top		= tempY + 'px';
	document.getElementById(divid).style.left		= tempX + 'px';
	document.getElementById(divid).style.visibility = "visible";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
//	Layer ausblenden
function jfg_hide_div(divid){
	document.getElementById(divid).style.visibility = "hidden";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
// Funktion für den Wysiwyg-editor (entfernt Zeilenschaltungen)
function jfg_wysi_cleanbr(mytext){
	mytext = mytext.replace(/<br \/><br \/>/g,'doublebr');
	mytext = mytext.replace(/<br \/>/g,' ');
	mytext = mytext.replace(/doublebr/g,'<br /><br />');
	
	return mytext;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
//	Cursor-Position in Feld ermitteln
function jfg_get_cursor_pos(element) {
	if (element.selectionStart) {
		return element.selectionStart;
	} else if (document.selection) {
		element.focus();
		var r = document.selection.createRange();
		if (r == null) {
			return 0;
		}
		var re = element.createTextRange();
		var rc = re.duplicate();
		re.moveToBookmark(r.getBookmark());
		rc.setEndPoint('EndToStart', re);
		return rc.text.length;
	} 
	return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
//	Text an Cursorposition eines Elementes einfügen
function jfg_paste_in_element(element_id,str_paste) {
	var element			= document.getElementById(element_id);
	var cursor_pos		= jfg_get_cursor_pos(element);
	var str_current		= element.value;
	var str_new			= str_current.substring(0,cursor_pos) 
							+ str_paste 
							+ str_current.substr(cursor_pos);
	element.value		= str_new;
	
	var cursor_pos_new	= cursor_pos + str_paste.length;
	element.setSelectionRange(cursor_pos_new,cursor_pos_new);
	
	element.focus();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

