I am using OCX for some functionality, for that I have used the <object> and want to referring the same thru the JavaScript as a global variable. Its give error "'b' is null or not an object"

<OBJECT ID="OCXID" class="hidden" width="0" height="0"
type="application/x-oleobject"
CLASSID="some_Correct_ClassID" CODEBASE="MyOCX.ocx"
</OBJECT>


Global variables are Not Working:

var b = window.document.getElementById("OCXID");
//var b = document.OCXID; //this also not working fine...
function callOCXmethod(){
b.someOCXMethod();

}


Local variables are Working:

function callOCXmethod(){
var b = window.document.getElementById("OCXID");
//var b = document.OCXID; //this also working fine...

b.someOCXMethod();

}