

function handle_scroll(me, eventinfo)
{
    switch(project.getTag("SIGNALS_SCROLL")){
    case 0:
         project.showDialog("SIGNALS_SCROLL0.jmx");
        
        
        project.closeDialog("SIGNALS_SCROLL1.jmx");
         project.closeDialog("SIGNALS_SCROLL2.jmx");
         project.closeDialog("SIGNALS_SCROLL3.jmx");
          project.closeDialog("SIGNALS_SCROLL4.jmx");
        
        break;
    case 1:
         project.showDialog("SIGNALS_SCROLL1.jmx");
        
        project.closeDialog("SIGNALS_SCROLL0.jmx");
         project.closeDialog("SIGNALS_SCROLL2.jmx");
         project.closeDialog("SIGNALS_SCROLL3.jmx");
          project.closeDialog("SIGNALS_SCROLL4.jmx");
        break;
        
         case 2:
             project.showDialog("SIGNALS_SCROLL2.jmx");
            
            project.closeDialog("SIGNALS_SCROLL0.jmx");
             project.closeDialog("SIGNALS_SCROLL1.jmx");
             project.closeDialog("SIGNALS_SCROLL3.jmx");
              project.closeDialog("SIGNALS_SCROLL4.jmx");
            break;
             
              case 3:
                  project.showDialog("SIGNALS_SCROLL3.jmx");
                 
                 project.closeDialog("SIGNALS_SCROLL0.jmx");
                  project.closeDialog("SIGNALS_SCROLL1.jmx");
                  project.closeDialog("SIGNALS_SCROLL2.jmx");
                   project.closeDialog("SIGNALS_SCROLL4.jmx");
                 break;
                  
              case 4:
                       project.showDialog("SIGNALS_SCROLL4.jmx");
                      
                      project.closeDialog("SIGNALS_SCROLL0.jmx");
                       project.closeDialog("SIGNALS_SCROLL1.jmx");
                       project.closeDialog("SIGNALS_SCROLL2.jmx");
                        project.closeDialog("SIGNALS_SCROLL3.jmx");
                  break;
 default:
     
     project.showDialog("SIGNALS_SCROLL0.jmx");
     
        project.setTag("SIGNALS_SCROLL",0);
     project.closeDialog("SIGNALS_SCROLL1.jmx");
      project.closeDialog("SIGNALS_SCROLL1.jmx");
      project.closeDialog("SIGNALS_SCROLL2.jmx");
       project.closeDialog("SIGNALS_SCROLL3.jmx");

    }
}

function VIEW_UP(me, eventInfo)
{
   var i=  project.getTag("SIGNALS_SCROLL");
    if(i==2){
        i=-1;
    }

    if(i<4){
    i=i+1;
    }
   
    project.setTag("SIGNALS_SCROLL",i);
     sleepFor(0.1);
 handle_scroll();
}
function VIEW_DOWN(me, eventInfo)
{
    var i=  project.getTag("SIGNALS_SCROLL");
    if(i==0){
        i=3;
    }

    if(i>0){
     i=i-1;
    }
   
     project.setTag("SIGNALS_SCROLL",i);
       sleepFor(0.1);
  handle_scroll();
}
function close()
{
        project.closeDialog("SIGNALS_SCROLL0.jmx");
    project.closeDialog("SIGNALS_SCROLL1.jmx");
     project.closeDialog("SIGNALS_SCROLL2.jmx");
     project.closeDialog("SIGNALS_SCROLL3.jmx");
      project.closeDialog("SIGNALS_SCROLL4.jmx");
    
}
function sleepFor(sleepDuration){
    var now = new Date().getTime();
    while(new Date().getTime() < now + sleepDuration){ /* Do nothing */ }
}



function numeric3_onDataUpdate(me, eventInfo)
{
       
    var newTargetFromBase =page.getWidget("GridLayout7.GroupWgt4.TARGET_DISTANCE_FROM_BASE").getProperty("value")
      project.setTag("LASER_IN_POSITION",false,0,true);
  
    var newTargetFromDatum = (425 - newTargetFromBase);
    var Target = newTargetFromDatum * 5000;
   
    if(Target > -1){
        
         project.setTag("TARGET_PULSES",Target,0,true);
        
 
  
   }
    return false; 
}