// // each browser gets its own object, with the same interfaces but differing implementations // create IE DHTML object function ie_object(obj) { this.css = obj; this.name = obj.name; this.objHide = domHide; this.objShow = domShow; this.objChangeFontColor = domChangeFontColor; this.objChangeBackgroundColor = domChangeBackgroundColor; } // create DOM object function dom_object(obj) { this.css = obj; this.name = obj.name; this.objHide = domHide; this.objShow = domShow; this.objChangeFontColor = domChangeFontColor; this.objChangeBackgroundColor = domChangeBackgroundColor; } // IE/DOM hide element function domHide() { this.css.style.visibility = "hidden"; } // IE/DOM show element function domShow() { this.css.style.visibility = "visible"; } // IE/DOM change font function domChangeFontColor(clr) { this.css.style.color=clr; } // IE/DOM change font function domChangeBackgroundColor(clr) { this.css.style.backgroundColor = clr; } // // The Navigator specific scripting object methods // // Navigator object function ns_object(obj) { this.css = obj; this.name = obj.name; this.objHide = nsHide; this.objShow = nsShow; this.objChangeFontColor = nsChangeFontColor; this.objChangeBackgroundColor = nsChangeBackgroundColor; } // hide element function nsHide() { this.css.visibility = "hidden"; } // show element function nsShow() { this.css.visibility = "inherit"; } // change color function nsChangeFontColor(clr) { } // change background function nsChangeBackgroundColor(clr) { this.css.bgColor = clr; } // Create the objects // //**************************************************************************************** // create IE objects function create_ie_objects() { theelements = document.all.tags("DIV"); theobjs = new Array(); for (i = 0; i < theelements.length; i++) theobjs[theelements[i].id] = new ie_object(theelements[i]); } // create Navigator objects function create_ns_objects() { theobjs = new Array(); for (i = 0; i < document.layers.length; i++) theobjs[document.layers[i].name] = new ns_object(document.layers[i]); } // create DOM objects function create_dom_objects() { theelements = document.getElementsByTagName("DIV"); theobjs = new Array(); for (i = 0; i < theelements.length; i++) { var obj = theelements[i]; theobjs[obj.id] = new dom_object(obj); } } // call correct object loading method function create_objects() { // if 5.0 browser if (navigator.appVersion.indexOf("5.0") != -1) create_dom_objects(); else if (navigator.appName == "Microsoft Internet Explorer") create_ie_objects(); else create_ns_objects(); }