/**
*
*  Javascript trim, ltrim, rtrim
*  http://www.webtoolkit.info/
*
*
**/
 
function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

//---------------------------------------------------------------------------
//------------------------------------------
function notEmpty(elem, helperMsg){
	var textik = trim(elem.value);
	if(textik.length == 0){
		alert(helperMsg);
		elem.focus();
		return false;
	}
	else{
   return true;
  }

}

//----------------------------------

function notEmptyEmail(elem){
	var textik = trim(elem.value);
	if(textik.length == 0){
		alert('Vyplňte e-mail.');
		elem.focus();
		return false;
	}
	
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert('Nekorektní e-mail.');
		elem.focus();
		return false;
	}
	
	
}
//-----------------------------------



