
function limitMaxSize(comment, maxSize) {
	if (comment.length > maxSize) {
		document.forms['contactForm'].elements['message'].value = document.forms['contactForm'].elements['message'].value.substr(0, maxSize);
	}
}

function checkemail (e, t) {
  var len = e.length;
  if (len == 0) return true;
  
  var atidx = e.indexOf("@", 1);
  if (atidx == -1) {
    ok = 0;
    alert (t);
    return (false); }
  var a = e.substring(atidx, atidx + 1);
  if (a == ".") {
    ok = 0;
    alert (t);
    return (false); }
  var dotidx = e.indexOf(".",atidx + 2);
  if ((dotidx == -1) || (dotidx >= len - 1)) {
    ok = 0;
    alert (t);
    return (false); }

  var numstr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@._-+";
  var tmpchar;
  for (i = 0; i < len; i++) {
   tmpchar = e.substring(i, i + 1);
   if (numstr.indexOf(tmpchar, 0) == -1) {
    ok = 0;
    alert (t);
    return (false); }
  }
  ok = 1;
  return (true);
}

function notEmpty(field_name, msg) {
  var b = (field_name.value == '');
  if (b) alert(msg);
  return (!b);
}

function checkSearch(searched) {
	 if (searched.length > 2) {
	 	document.forms['searchForm'].submit();
	 }
	 else {
	 	return false;
	 }
}