CheckUserID() is not always returning a value. Add this line to the end of your function:
return false;
And how are you calling the function? You will need something like this:
<form name="frm1" onsubmit="return CheckUserID();"></form>
This will not work:
<form name="frm1" onsubmit="CheckUserID();"></form>