function dub_checkstr_email(str) {
	res = str.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/);
	return res;
}
function dub_trim(s) {
  	while (s.substring(0,1) == ' ') {
    	s = s.substring(1,s.length);
  	}
  	while (s.substring(s.length-1,s.length) == ' ') {
    	s = s.substring(0,s.length-1);
  	}
  	return s;
}
function dub_popup(url, width, height, complete) {
	var winleft = (screen.width - width) / 2;
	var wintop = (screen.height - height) / 2;
	if (complete==true) {
		popwin=window.open(url, "PopUp", "left="+winleft+", top="+wintop+", width="+width+", height="+height+" ,scrollbars=yes, resizable=yes, status=yes, toolbar=yes, location=yes");
	} else {
		popwin=window.open(url, "PopUp", "left="+winleft+", top="+wintop+", width="+width+", height="+height+" ,scrollbars=yes, resizable=yes");
	}
	popwin.focus();
}
function dub_limit_input_characters(id_element, limit_num) {
	elem = document.getElementById(id_element);	
	/*
	if (elem.nodeName == "TEXTAREA") {	
		if (elem.value.length > limit_num) {
			elem.value = elem.value.substring(0, limit_num);
		}
	} else if (elem.nodeName == "INPUT") {
		if (elem.value.length > limit_num) {
			elem.value = elem.value.substring(0, limit_num);
		}
	}
	*/
	if (elem.value.length > limit_num) {
		elem.value = elem.value.substring(0, limit_num);
		alert("Sie haben mehr Zeichen eingegeben als erlaubt.\nDer Text wurde abgeschnitten.");		
	}
}
