How to submit form when countdown timer ends
===

i have a 30 min countdown timer . 30 min countdown timer working .when the timer completes form as to submit. 

i tried this code but not working 

   

     <form name="counter"><input
    name="d2" type="text" size="8" readonly="readonly">
      <input type="submit" name="submit" id="submit" value="Submit" />
    </form>
    
    <script>
    <!--
    //
    var minutes=30
    var seconds=00
    
    document.counter.d2.value='30:00'
    
    function display(){
    if (seconds<=0){
    minutes-=1
    seconds+=59
    }
    if (minutes<=-1){
    minutes==1
    seconds=0
    
    }
    else
    seconds-=1
    document.counter.d2.value=minutes+":"+seconds
    setTimeout("display()",1000)
    }
    if(minutes==29&&seconds==56)
    {
    	setTimeout('document.test.submit()',5000);
    }
    display()
    -->
    </script>

