function numberOnly(text) {
	if(text != "") {
		return text.match(new RegExp("^[0-9 ]+$"));
	} else {
		return true;
	}
}

function alphaOnly(text) {
	if(text != "") {
		return text.match(new RegExp("^[a-zA-ZěščřžýáíúůéäëïöóüďťňĚŠČŘŽÝÁÍÉÚŮÄËÏÖÓÜĎŤŇ ]+$"));
	} else {
		return true;
	}
}

/**
 *	Funkce pro ruzne pouzivane kontroly pomoci RegExp
 *
 *	vytvoril zdolf
 */

function alphanumOnly(text) {
	if(text != "") {
		return text.match(new RegExp("^[0-9a-zA-ZěščřžýáíúůéäëïöóüďťňĚŠČŘŽÝÁÍÉÚŮÄËÏÖÓÜĎŤŇ _\.]+$"));
	} else {
		return true;
	}
}

function checkHeading(text) {
	if(text != "") {
		return text.match(new RegExp("^[0-9a-zA-ZěščřžýáíúůéäëïöóüďťňĚŠČŘŽÝÁÍÉÚŮÄËÏÖÓÜĎŤŇ :!&#,\"\*\(\)_\.\\\-\?]+$"));
	} else {
		return true;
	}
}

function checkEmail(text) {
	if(text != "") {
		return text.match(new RegExp("^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$"));
	} else {
		return true;
	}
}

function passStrength(text) {
	var strength = 0;

	if(text != "") {
		if(text.match(new RegExp("^.*([a-z]+).*$"))) { strength++; }
		if(text.match(new RegExp("^.*([A-Z]+).*$"))) { strength++; }
		if(text.match(new RegExp("^.*([0-9]+).*$"))) { strength++; }
		if(text.match(new RegExp("^.*([ěščřžýáíúůéäëïöüňĚŠČŘŽÝÁÍÉÚŮÄËÏÖÜŇ]+).*$"))) { strength++; }
	}

	return strength;
}
