After asking the question, I found this article (searching for the words "javascript style undefined" in Google): http://www.fusionauthority.com/Article.cfm?ArticleID=2193
It not only solved the problem with "bf" but also my old problem about closing an undefined window (posted here also, sometime ago).
This "typeof" function is really magic.
I used it like this:
if (typeof(bf) != "undefined") { bla bla bla ... }
Also, I needed a way to test the existence of the stylesheet, prior to using some definitions inside that stylesheet (bf !), so I found this function (modified by me to make it work as I wanted):
function getActiveStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 )
return a.getAttribute("title");
}
return null;
}
When I want to test the existence of the stylesheet, I use:
if (getActiveStyleSheet() != null) { bla bla bla... }
It works fine. I'm not sure though if there would be a safer way to do that.