function changeLevel(formID){
          var theForm = document.getElementById("form"+formID);
          theForm.submit();
       }
       
       var Scroller = function(frameId,contentId,direction,tempo,w,h){
	                     // default parameters
	                     var thisObj        = this;
	                     this.nXlocation    = 0;
	                     this.nYlocation    = 0;
	                     this.nFrameHeight  = h;
	                     this.nFrameWidth   = w;
	                     this.nTempo        = tempo;
	                     this.strDirection  = direction;
	                     this.scrollerStat  = true;
	                     this.objFrame      = document.getElementById(contentId);
	
	                     // frame parameter
	                     f              = document.getElementById(frameId);
	                     f.style.height = h+'px';
	                     f.style.width  = w+'px';

	                     this.MoveScroller = function(){
		                                        switch(this.strDirection){
		                                           case 'u':	// moving up
				                                      this.nXlocation--;
				                                      this.objFrame.style.top=this.nXlocation+"px";
				                                      break;
			                                       case 'd':	// moving sown
				                                      this.nXlocation++;
				                                      this.objFrame.style.top=this.nXlocation+"px";
				                                      break;
			                                       case 'r':	// moving right
				                                      this.nYlocation++;
				                                      this.objFrame.style.left=this.nYlocation+"px";
				                                      break;
			                                       case 'l':	// moving left
				                                      this.nYlocation--;
				                                      this.objFrame.style.left=this.nYlocation+"px";
				                                      break;
		                                        }
	                                         }

	                     this.CheckScroller = function(){
		                                         switch(this.strDirection){
			                                        case 'u':
				                                       if ((0-this.nXlocation) > this.objFrame.offsetHeight){
				                                          this.nXlocation = this.nFrameHeight;
				                                       }
				                                       break;
			                                        case 'd':
				                                       if (this.nXlocation > this.nFrameHeight){
				                                          this.nXlocation = -this.objFrame.offsetHeight;
				                                       }
				                                       break;
			                                        case 'r':
				                                       if (this.nYlocation > this.nFrameWidth){
				                                          this.nYlocation = -this.objFrame.offsetWidth;
				                                       }
				                                       break;
			                                        case 'l':
				                                       if ((0-this.nYlocation) > this.objFrame.offsetWidth){
				                                          this.nYlocation = this.nFrameWidth;
				                                       }
				                                       break;
		                                         }	
	                                          }
	
	                     this.RunScroll = function(){
		                                     if (this.scrollerStat){
			                                    this.MoveScroller();
			                                    this.CheckScroller();
		                                     }
	                                      }
	
	                     this.StartScroll = function(){
		                                       setInterval(function() { thisObj.RunScroll(); },thisObj.nTempo);
	                                        }
	                     // for stop on mouse over
	                     this.StopScroll = function(){
                                              this.scrollerStat = false;
                                           }

                         this.ContinueScroll = function(){
                                                  this.scrollerStat = true;
                                               }
	
                      }


function OpenWin(page,w,h)
{
   window.open(page,'mem','resizable=1,scrollbars=1,width='+w+',height='+h+',top=0,left=0')
}

function OpenWinScroll(page,w,h)
{
   window.open(page,'mem','resizable=0,scrollbars=0,width='+w+',height='+h+',top=0,left=0')
}
function showBig(img){
   var bigImg=document.getElementById("bigImg");
   bigImg.src=img;
}
function openImg(imgsrc){
       var sndImg=new Image();
       sndImg.src=imgsrc;
       var imgwin=window.open(sndImg.src,"imgwin1","height="+sndImg.height+",width="+sndImg.width+",status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no");
    }
function CheckEmail(str)
{
	var thestr=/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/
	if (str.search(thestr)==-1)
	return false;
	return true;
}


function IsLegalData()
{
   if(!document.ad.Name.value)
   {
      alert("חובה לרשום שם");
      document.ad.Name.focus();
      return false;
   }
   if ((!document.ad.Phone.value) && (!document.ad.Cell.value))
   {
    alert("חובה לבחור מספר טלפון אחד לפחות ");
      document.ad.Cell.focus();
      return false;
   }

   if(document.ad.Email.value)
      {
          if (CheckEmail(document.ad.Email.value)==false && document.ad.Email.value != '')
                 {
                    alert("דואר אלקטרוני לא תקין");
                    document.ad.Email.focus();
                    return false;
                 }
   }

}

function IsLegalData2()
{
   if(!document.ad.Name.value)
   {
      alert("חובה לרשום שם");
      document.ad.Name.focus();
      return false;
   }
   if ((!document.ad.Phone.value))
   {
    alert("חובה לבחור מספר טלפון ");
      document.ad.Cell.focus();
      return false;
   }

   if(document.ad.Email.value!="")
      {
          if (CheckEmail(document.ad.Email.value)==false && document.ad.Email.value != '')
                 {
                    alert("דואר אלקטרוני לא תקין");
                    document.ad.Email.focus();
                    return false;
                 }
   }

}
