function FindObject(oName, oFrame, oDoc ) { /*Function that handles browser differences If not working on a layer, document should be set to the document of the working frame If the working frame is not set, use the window object of the current document WARNING: - cross frame scripting will cause errors if your page is in a frameset from a different domain */ if( !oDoc ) { if( oFrame ) { oDoc = oFrame.document; } else { oDoc = window.document; } } //check for images, forms, layers if( oDoc[oName] ) { return oDoc[oName]; } //check for pDOM layers if( oDoc.all && oDoc.all[oName] ) { return oDoc.all[oName]; } //check for DOM layers if( oDoc.getElementById && oDoc.getElementById(oName) ) { return oDoc.getElementById(oName); } //check for form elements for( var x = 0; x < oDoc.forms.length; x++ ) { if( oDoc.forms[x][oName] ) { return oDoc.forms[x][oName]; } } //check for anchor elements //NOTE: only anchor properties will be available, NOT link properties! for( var x = 0; x < oDoc.anchors.length; x++ ) { if( oDoc.anchors[x].name == oName ) { return oDoc.anchors[x]; } } //check for any of the above within a layer in layers browsers for( var x = 0; document.layers && x < oDoc.layers.length; x++ ) { var theOb = FindObject( oName, null, oDoc.layers[x].document ); if( theOb ) { return theOb; } } //check for frames, variables or functions if( !oFrame && window[oName] ) { return window[oName]; } if( oFrame && oFrame[oName] ) { return oFrame[oName]; } //if checking through frames, check for any of the above within each child frame for( var x = 0; oFrame && oFrame.frames && x < oFrame.frames.length; x++ ) { var theOb = FindObject( oName, oFrame.frames[x], oFrame.frames[x].document ); if( theOb ) { return theOb; } } return null; } function ShowHideL(state, oName, oFrame, oDoc){ ObjPtr = FindObject(oName, oFrame, oDoc); if(!ObjPtr) { window.alert('Browser is not supported[1] or couldnt find object'); return false; } if(ObjPtr.style) { ObjPtr = ObjPtr.style; } if(!ObjPtr.visibility) { //Unsupported browser if(state == 0) { window.alert('Browser is not supported [no .visibility]\n Aborting attempt to hide Layer: '+oName+'\n [ Possible cause : Layer style doesnt have specific inline-declaration of visibility state ]'); } else if(state == 1) { window.alert('Browser is not supported [no .visibility]\n Aborting attempt to hide Layer: '+oName+'\n [ Possible cause : Layer style doesnt have specific inline-declaration of visibility state ]'); } return false; } if(state == 0) { ObjPtr.visibility = 'hidden'; } else if(state == 1) { ObjPtr.visibility = 'visible'; } return; }