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 CheckVote1(TheForm) {
  TheForm.FullName.value=Trim(TheForm.FullName.value);
  if (TheForm.FullName.value == "") return RetFalse(TheForm.FullName, "שגיאה: הינך חייב למלא את שמך המלא.");
  if (TheForm.FullName.value.indexOf(" ")==-1) return RetFalse(TheForm.FullName, "שגיאה: תוכן השדה שם מלא אינו תקין.");
  if (!(/^[A-Za-zא-ת\-_\'\" ]+$/.test(TheForm.FullName.value))) return RetFalse(TheForm.FullName, "שגיאה: תוכן השדה שם מלא אינו תקין.");
  TheForm.LawyerID.value=Trim(TheForm.LawyerID.value);
  if (TheForm.LawyerID.value == "") return RetFalse(TheForm.LawyerID, "שגיאה: הינך חייב למלא את מספר רישיון עורך הדין שלך.");
  if ((TheForm.LawyerID.value<1) || (TheForm.LawyerID.value>70000) || (!(/^[0-9]+$/.test(TheForm.LawyerID.value)))) return RetFalse(TheForm.LawyerID, "שגיאה: מספר רישיון אינו תקין.");
  return true;
}

function CheckVote2(TheForm) {
/*
  for (i=1; i<=8; i++) {
    document.getElementById("Q"+i).value=Trim(document.getElementById("Q"+i).value);
    if (document.getElementById("Q"+i).value == "") return RetFalse(document.getElementById("Q"+i), "שגיאה: תשובה לא מולאה.");
    if (!(/^[A-Za-zא-ת\-_\'\" ]+$/.test(document.getElementById("Q"+i).value))) return RetFalse(document.getElementById("Q"+i), "שגיאה: תשובה לא תקינה.");
    document.getElementById("Q"+i+"Desc").value=Trim(document.getElementById("Q"+i+"Desc").value);
    if (document.getElementById("Q"+i+"Desc").value == "") return RetFalse(document.getElementById("Q"+i+"Desc"), "שגיאה: תשובה לא מולאה.");
  }
*/
  return true;
}

var dayarray=new Array("ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת");
var montharray=new Array("ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר");
var montharrayE=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
function getthedate() {
  var mydate=new Date();
  var year=mydate.getFullYear();
  var day=mydate.getDay();
  var month = mydate.getMonth(); // JS starts counting at 0!
  var daym=mydate.getDate();
  if (daym < 10) daym="0"+daym;
  if (month < 10) month="0"+month;

  var hours=mydate.getHours();
  var minutes=mydate.getMinutes();
  var seconds=mydate.getSeconds();

  if (minutes<=9) minutes="0"+minutes;
  if (seconds<=9) seconds="0"+seconds;

  var cdate="יום "+dayarray[day]+", "+daym+" ב"+montharray[parseInt(month)]+" "+year+"<br>"+hours+":"+minutes+":"+seconds;

  if (document.all) document.all.clock.innerHTML=cdate;
  else if (document.getElementById) document.getElementById("clock").innerHTML=cdate;
}
  if (!document.all&&!document.getElementById) getthedate();
  else if (document.all||document.getElementById) setInterval("getthedate()",1000);



//Based on Dynamic countdown Script II - © Dynamic Drive (www.dynamicdrive.com)
//Customized By Netanel Wachshtein (netanel7@012.net.il)

var yr,mo,da,hr,min,sec;
function SetCountDown(theyear,themonth,theday,thehour,themin,thesec){
  yr=theyear;mo=themonth;da=theday;hr=thehour;min=themin;sec=thesec
}
SetCountDown(2004,12,21,00,00,00); //Set the date

function countdown() {
  var today=new Date();
  var todayy=today.getYear();
  if (todayy < 1000) todayy+=1900;
  var todaym=today.getMonth();
  var todayd=today.getDate();
  var todayh=today.getHours();
  var todaymin=today.getMinutes();
  var todaysec=today.getSeconds();
  var todaystring=montharrayE[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec;
  var futurestring=montharrayE[mo-1]+" "+da+", "+yr+" "+hr+":"+min+":"+sec;
  dd=Date.parse(futurestring)-Date.parse(todaystring);
  dday=Math.floor(dd/(60*60*1000*24)*1);
  dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1);
  dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);
  dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);
  if (dhour<=9) dhour="0"+dhour;
  if (dmin<=9) dmin="0"+dmin;
  if (dsec<=9) dsec="0"+dsec;
//  document.getElementById("Timer").innerHTML=dday+":"+dhour+":"+dmin+":"+dsec+" ימים";
//  setTimeout("countdown()",1000);
}
