<HTML>
<title> Test</title>
<HEAD>
<Script language="Javascript">
// This code was created by Reuben Lawrence Owens
// Global variables
var isNav, isIE
var insideWindowWidth
var range = ""
var styleObj = ""
if (navigator.appVersion.charAt(0) >= "4"

{
if (navigator.appName == "Netscape"

{
isNav = true
insideWindowWidth = window.innerWidth
} else {
isIE = true
range = "all."
styleObj = ".style"
}
}
function getObj(obj) {
var theObj;
if (typeof obj == "string"

{
theObj = eval("document." + range + obj + styleObj);
} else {
theObj = obj;
}
return theObj
}
// Setting the visibility of an object to visible
function show(obj) {
var theObj = getObj(obj)
theObj.visibility = "visible"
}
// Setting the visibility of an object to hidden
function hide(obj) {
var theObj = getObj(obj)
theObj.visibility = "hidden"
}
// Cross Plateform Layer obj
function layer_setLayerTable(LayerTable){
this.LayerTable = LayerTable
}
function layer_setInnerLayer(InnerLayer){
this.InnerLayer = InnerLayer
}
function layer_writePrototype(doc){
var backgroundcolor = "";
var position = "";
var width = "";
var height = "";
var visibility = "";
var top = "";
var left="";
if (this.bgcolor != null) backgroundcolor = "background-color:"+this.bgcolor+";";
if (this.position != null) position = "position:"+this.position+";";
if (this.width != null) width = "width:"+this.width+";";
if (this.height != null) height = "height:"+this.height+";";
if (this.visibility != null) visibility = "visibility:"+this.visibility+";";
if (this.top != null) top = "top:"+this.top+";";
if (this.left != null) left = "left:"+this.left+";";
doc.write("<style type='text/css'>"

;
doc.write(this.name + " {"+position+" "+width+" "+height+" "+visibility+" "+top+" "+left+"}"

;
doc.write("</style>"

;
if (this.InnerLayer != null) this.InnerLayer.writePrototype(doc);
}
function layer_write(doc){
var backgroundcolor = "";
var position = "";
var width = "";
var height = "";
var visibility = "";
var top="";
var left="";
if (navigator.appVersion.charAt(0) >= "4"

{
if (navigator.appName == "Netscape"

this.browser = "Nav"
else this.browser = "IE"
}
if (this.browser == "IE"

{
if (this.bgcolor != null) backgroundcolor = "background-color:"+this.bgcolor+";";
if (this.position != null) position = "position:"+this.position+";";
if (this.width != null) width = "width:"+this.width+";";
if (this.height != null) height = "height:"+this.height+";";
if (this.visibility != null) visibility = "visibility:"+this.visibility+";";
if (this.top != null) top = "top:"+this.top+";";
if (this.left != null) left = "left:"+this.left+";";
doc.write("<div id='"+this.name + "' style= '" +position+" "+backgroundcolor+" "+width+" "+height+" "+visibility+" "+top+" "+left+"' >"

if (this.data != null) doc.write(this.data);
if (this.LayerTable != null) this.LayerTable.colorWrite(doc);
if (this.InnerLayer != null) this.InnerLayer.write(doc);
doc.write("</div>"

;
}
else {
if (this.bgcolor != null) backgroundcolor = "BGCOLOR='" + this.bgcolor + "'";
if (this.width != null) width = "width=" + this.width;
if (this.height != null) height = "height=" + this.height;
if (this.visibility != null) visibility = "visibility='" + this.visibility + "'";
if (this.top != null) top = "top = "+this.top;
if (this.left != null) left = "left = "+this.left;
doc.write("<layer name='" + this.name + "' " + width + " " + height + " " + backgroundcolor+" "+visibility+" "+top+" "+left+">"

;
if (this.data != null) doc.write(this.data);
if (this.LayerTable != null) this.LayerTable.colorWrite(doc);
if (this.InnerLayer != null) this.InnerLayer.write(doc);
doc.write("</layer>"

;
}
}
function layer(name){
this.browser = null
this.name=name
this.top=null
this.left=null
this.position = "absolute"
this.width = null
this.height = null
this.bgcolor = null
this.visibility = null
this.data = null
this.LayerTable = null
this.InnerLayer=null
this.setLayerTable = layer_setLayerTable
this.setInnerLayer = layer_setInnerLayer
this.write = layer_write
this.writePrototype = layer_writePrototype
}
</script>
<Script language="JavaScript">
Test1 = new layer("First"

;
Test1.left="0";
Test1.top="50";
Test1.width = "200";
Test1.height = "200";
Test1.bgcolor = "#008000";
Test1.visibility = "visible";
Test1.data = "This is the first Layer";
Test1.writePrototype(document);
Test2 = new layer("Second"

;
Test2.left="0";
Test2.top="50";
Test2.width = "200";
Test2.height = "200";
Test2.bgcolor = "White";
Test2.visibility = "hidden";
Test2.data = "This is the SECOND Layer";
Test2.writePrototype(document);
function Switch(){
var Obj1 = getObj("First"

;
var Obj2 = getObj("Second"

;
if (Obj1.visibility == "show" || Obj1.visibility == "visible"

{
hide(Obj1);
show(Obj2);
}
else {
hide(Obj2);
show(Obj1);
}
}
</Script>
</HEAD>
<BODY >
<FORM>
<INPUT TYPE="button" VALUE="Switch" onClick="Switch()" onDblClick="Switch()">
<Script language="Javascript">
Test1.write(document);
Test2.write(document);
</script>
</form>
</BODY>
</HTML>