function isInteger (s)
{
	var i;

	if (isEmpty(s))
		if (isInteger.arguments.length == 1) return 0;
		else return (isInteger.arguments[1] == true);
	for (i = 0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if (!isDigit(c)) return false;
	}
	return true;
}
function isEmpty(s)
{
	return ((s == null) || (s.length == 0))
}
function isDigit (c)
{
	return ((c >= "0") && (c <= "9"))
}
function formValidator(type){
	if(type=="comment"){
		nume = document.getElementById('commentname');
		email = document.getElementById('commentemail');
		text = document.getElementById('commenttext');
		
		document.getElementById('errorname').style.visibility = "hidden";
		document.getElementById('erroremail').style.visibility = "hidden";
		document.getElementById('errortext').style.visibility = "hidden";
		document.getElementById('errortext').style.display = "none";

		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

		if (isEmpty(nume.value)){
			document.getElementById('errorname').style.visibility = "visible";
			nume.focus();
			return (false);
		}
		if (isEmpty(email.value)){
			document.getElementById('erroremail').style.visibility = "visible";
			email.focus();
			return (false);
		} else if(reg.test(email.value) == false) {
			document.getElementById('erroremail').style.visibility = "visible";
			return false;
		}
		if (isEmpty(text.value)){
			document.getElementById('errortext').style.visibility = "visible";
			document.getElementById('errortext').style.display = "block";
			text.focus();
			return (false);
		}
	}
	return (true);
}
function valbaza(id, text){
	if (id.value == ""){
		id.value = text;
	}
}
function valnula(id, text){
	if (id.value == text){
		id.value = "";
	}
}
