
function isEmpty(inputStr) {
	if (inputStr == null || inputStr == "") {
	return true
	}
	return false
}
function isNumber(inputStr) {
	for (var i = 0; i < inputStr.length; i++) {
	var oneChar = inputStr.charAt(i)
		if (oneChar < "0" || oneChar > "9") {			
			return false
		}
	}
	return true
}
function isEmailAddr(email)
{
  var result = false;
  var theStr = new String(email);
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}
function validateLogin(theform) {
	if(isEmpty(theform.login.value) || isEmpty(theform.pass.value)) {
		alert("Prosze wypelnic wszystkie pola");
		return false
	} else {
		return true;
	}
}

function validateFile(theform,state) {
	if(isEmpty(theform.file.value) && state!="edit") {
		alert("Nie podano żadnego pliku");
		return false;
	} else {
		Layer1.style.visibility='visible';
		return true;
	}
}
function confirm_back() {
	text="Nastapi zamiana całej zawartosci tabeli w bazie danych danymi z pliku. Czy kontynuowac?";
	res=confirm(text);
	if(res) {
		Layer1.style.visibility='visible';
	}
	return res;
}
function CheckForm(){	
	var args=CheckForm.arguments;
	var theform=args[0];
	for (i=1; i<args.length; i++) {
		var obj=eval('theform.'+args[i]);
		if(isEmpty(obj.value)) {
			alert("Prosze wypełnić wymagane pola. Pola te oznaczone są symbolem *.");
			obj.focus();
			return false;
		}			
	}
	return true;
}
