function PreventEnterPress(evt) {
	var keyCode = evt.keyCode;

	if (keyCode != 13) {
	return true;
	}
	return false;
}

function PreventEnterInsert(element) {

	txt = element.value;
	txt=txt.replace(/\n/gi," ");
	element.value = txt;
}

function toggle_clipboard(img,elementID) {

	element = document.getElementById(elementID);
	if(!element) return false;

	img_default = 'templates/img/icons/sammelmappe/'+img+'.png';
	img_active  = 'templates/img/icons/sammelmappe/'+img+'_clipboard.png';
	img_base = basename(element.src);

	if(img_base==img+'.png') element.src = img_active;
	else element.src = img_default;

	active = document.getElementById(elementID+'_active');
	inactive = document.getElementById(elementID+'_inactive');

	if( !active || !inactive ) return;

	if(active.style.display=='inline') {
		active.style.display='none';
		inactive.style.display='inline';
	}
	else {
		active.style.display='inline';
		inactive.style.display='none';
	}

}


function basename (path, suffix) {
    // Returns the filename component of the path
    //
    // version: 910.820
    // discuss at: http://phpjs.org/functions/basename    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Ash Searle (http://hexmen.com/blog/)
    // +   improved by: Lincoln Ramsay
    // +   improved by: djmix
    // *     example 1: basename('/www/site/home.htm', '.htm');    // *     returns 1: 'home'
    // *     example 2: basename('ecra.php?p=1');
    // *     returns 2: 'ecra.php?p=1'
    var b = path.replace(/^.*[\/\\]/g, '');
        if (typeof(suffix) == 'string' && b.substr(b.length-suffix.length) == suffix) {
        b = b.substr(0, b.length-suffix.length);
    }

    return b;

}

function toggle(elementID, mode) {

	element = document.getElementById(elementID);
	if(!element) return false;

	if(mode) {
   	if (mode == 'off') element.style.display = 'none';
   	if (mode == 'on') element.style.display = 'block';
   	return true;
   }

	if(element.style.display=='none') element.style.display = 'block';
	else if(element.style.display=='block') element.style.display = 'none';

	return true;

}
