function Trim(str) { if(str) return( str.replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1') ); else return ""; }
function RetFalse(obj,msg) { alert(msg);obj.focus();obj.select();return false; }

function CheckContactForm(TheForm,checkNotes) {
  TheForm.FullName.value=Trim(TheForm.FullName.value);
  if (TheForm.FullName.value == "") return RetFalse(TheForm.FullName, "שגיאה: אתה חייב להכניס שם.");
  if (!(/^[A-Za-zא-ת\-_ ]+$/.test(TheForm.FullName.value))) return RetFalse(TheForm.FullName, "שגיאה: שם אינו תקין.");
  TheForm.EMail.value=Trim(TheForm.EMail.value);
  if (TheForm.EMail.value == "") return RetFalse(TheForm.EMail, "שגיאה: אתה חייב להכניס דואל.");
  if (!/^([\w\+\.\-])+@([\w\-]+\.)+\w{2,3}$/.test(TheForm.EMail.value)) return RetFalse(TheForm.EMail, "שגיאה: דואל אינו תקין");
  TheForm.Phone.value=Trim(TheForm.Phone.value);
  if (TheForm.Phone.value == "") return RetFalse(TheForm.Phone, "שגיאה: אתה חייב להכניס מספר טלפון.");
  if (!(/^[0-9\-_]+$/.test(TheForm.Phone.value))) return RetFalse(TheForm.Phone, "שגיאה: טלפון אינו תקין.");
  if (checkNotes) {
    TheForm.Notes.value=Trim(TheForm.Notes.value);
    if (TheForm.Notes.value == "") return RetFalse(TheForm.Notes, "שגיאה: אתה חייב להכניס תוכן.");
  }
  return true;
}

function CheckContactForm2(TheForm) {
  TheForm.FullName.value=Trim(TheForm.FullName.value);
  if (TheForm.FullName.value == "") return RetFalse(TheForm.FullName, "שגיאה: אתה חייב להכניס שם.");
  if (!(/^[A-Za-zא-ת\-_ ]+$/.test(TheForm.FullName.value))) return RetFalse(TheForm.FullName, "שגיאה: שם אינו תקין.");
  TheForm.EMail.value=Trim(TheForm.EMail.value);
  if (TheForm.EMail.value == "") return RetFalse(TheForm.EMail, "שגיאה: אתה חייב להכניס דואל.");
  if (!/^([\w\+\.\-])+@([\w\-]+\.)+\w{2,3}$/.test(TheForm.EMail.value)) return RetFalse(TheForm.EMail, "שגיאה: דואל אינו תקין");
  return true;
}

function CheckClubForm(TheForm) {
  TheForm.EMail.value=Trim(TheForm.EMail.value);
  if (TheForm.EMail.value == "") return RetFalse(TheForm.EMail, "שגיאה: אתה חייב להכניס דואל.");
  if (!/^([\w\+\.\-])+@([\w\-]+\.)+\w{2,3}$/.test(TheForm.EMail.value)) return RetFalse(TheForm.EMail, "שגיאה: דואל אינו תקין");
  return true;
}

var visibleLayer=1;
function ChangeLayer2(layerNum) {
/*
  document.getElementById("Content"+visibleLayer).style.visibility="hidden";
  document.getElementById("Content"+visibleLayer).style.display="none";
  if (visibleLayer==1) {
    document.getElementById("Content2").style.visibility="hidden";
    document.getElementById("Content2").style.display="none";
  }
  document.getElementById("Content"+layerNum).style.visibility="visible";
  document.getElementById("Content"+layerNum).style.display="block";
  if (layerNum==1) {
    document.getElementById("Content2").style.visibility="visible";
    document.getElementById("Content2").style.display="block";
  }
  visibleLayer=layerNum;
*/
}

function CheckDetailsForm(TheForm) {
  return true;
}