function trim(str) {
  return str.replace(/^\s+|\s+$/g, '');
}


function isEmpty(str) {
  str = trim(str);
  return ((str == null) || (str.length == 0))
}


function isDigit(c) {
  return ((c >= "0") && (c <= "9"))
}


function isInteger(str) {  
  var i;
  for (i = 0; i < str.length; i++) {
	var c = str.charAt(i);
	if (!isDigit(c)) return false;
  }
  return true;
}

function initForm(oForm, element_name, init_txt) {
	frmElement = oForm.elements[element_name];
	frmElement.value = init_txt;
}

function clearFieldFirstTime(element) {
  if (element.counter==undefined) {
	element.counter = 1;
  }

  else {
	element.counter++;
  }

  if (element.counter == 1) {
	element.value = '';
  }
}




