﻿function autoJumpNext(evt,thisFieldId, nextFieldId) 
{
    // Jumps cursor from this field (thisFieldId )to next field (nextFieldId) after set number of chars typed
    var ValidChars = "0123456789`abcdefghi"; 
    var noChars = 4;
    var thisField = document.getElementById(thisFieldId);
    var nextField = document.getElementById(nextFieldId); 
    var e = evt || window.event;

    if(window.event)
        code = window.event.keyCode; // IE hack
    else
        code = e.which;
     
    var character = String.fromCharCode(code);
    if( ValidChars.indexOf(character) < 0 )
    {
        thisField.value = thisField.value.substr(0, thisField.value.length-1);
    }
   if(thisField.value.length >= noChars)
   nextField.focus();
}
