I don't think you are checking what you think you are.
For example:
Code:
<script type="text/javascript">
var reqtype = "REQUEST"
reqtype = reqtype.length
var doctype = "DOCUMENT"
doctype = doctype.length
alert(reqtype+'\n'+doctype);
</script>
The alert will always return 7 and 8 because that's the length of the variable strings
before they are turned into numbers with the .length command
The 'if ...' test will not change the results.
Also, for what it's worth, if you are after the length of the string you could just as easily do this in one step...
Code:
<script type="text/javascript">
var reqtype = "REQUEST".length
var doctype = "DOCUMENT".length
alert(reqtype+'\n'+doctype);
</script>