app/helpers/application_helper.rb
# cause periodical state change of element(given by div id)  with interval of time sec.
cause periodical state change of element(given by div id)  with interval of time sec.
cause periodical state change of element ( given by div id ) with interval of time sec .
def cause_periodical_change(time = 60, element = "periodical_change")
    time <= 0 and return ""  
    javascript_tag do 
      <<-CODE
      function toggleStateOfElement(element){
        if (element == null) clearInterval(intervaled);
        else{ if  (element.getValue() <= 0) element.value = 1;  else element.value = 0;}
      }
      function setPeriodicalChange(time, element){
        intervaled = setInterval( toggleStateOfElement, time*1000, element ); 
      }
      setPeriodicalChange(#{time}, $('#{element}'))
      CODE
    end
  end
def cause_periodical_change ( time = 60 , element = "periodical_change" ) time <= 0 and return "" javascript_tag do <<-CODE 
      function toggleStateOfElement(element){
        if (element == null) clearInterval(intervaled);
        else{ if  (element.getValue() <= 0) element.value = 1;  else element.value = 0;}
      }
      function setPeriodicalChange(time, element){
        intervaled = setInterval( toggleStateOfElement, time*1000, element ); 
      }
      setPeriodicalChange( #{ time } , $(' #{ element } '))
       CODE end end
cause periodical state change of element(given by div id)  with interval of time sec.
cause periodical state change of element ( given by div id ) with interval of time sec .
# no effective setting
time
<not_specific>
element
<not_specific>