Shurik, как вариант...
<!DOCTYPE html>
<html>
<head>
<!--
<script src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet" type="text/css" href="tmp.css" />
-->
<style type="text/css">
</style>
<script type="text/javascript">
</script>
</head>
<body>
<input type='text' id='test' disabled />
<button id='next' onclick='alert(1)'>next</button>
<script type="text/javascript">
var e = document.getElementById('test');
if (e) {
var t=e.getAttribute("disabled");
t=(t=='disabled'||t!=null)? 5000: 40000;
setTimeout(function() {document.getElementById("next").click();}, t);
}
</script>
</body>
</html>