ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;
ns6 = (document.getElementById)? true:false;

function navOver(id,hex) 
{
	var color = '#'+hex;
	
	
	if (document.all)
		document.all[id].style.backgroundColor = color;
	else if (document.getElementById)
		document.getElementById(id).style.backgroundColor = color;
	else if (document.layers)
	{
		if( document.layers[id] )
		{
			document.layers[id].bgColor = color;
		}
	}
}

function navOff(id,hex) 
{
	var color2 = '#'+hex;
	
	
	if (document.all)
		document.all[id].style.backgroundColor = color2;
	else if (document.getElementById)
		document.getElementById(id).style.backgroundColor = color2;
	else if (document.layers)
	{
		if( document.layers[id] )
		{
			document.layers[id].bgColor = color2;
		}  
	}
}

function chgSqr(id,hex) 
{
	var color = '#'+hex;
	
	
	if (document.all)
		document.all[id].style.backgroundColor = color;
	else if (document.getElementById)
		document.getElementById(id).style.backgroundColor = color;
	else if (document.layers)
	{
		if( document.layers[id] )
		{
			document.layers[id].bgColor = color;
		}
	}
}


function chgImg(imgField,newImg) {
             if (document.images) {
				document[imgField].src = eval(newImg + ".src");
					}
				}

function changeText(id,newText) {
	if (document.all) {
		document.all[id].innerHTML = newText;
		}
	else if (document.getElementById) {
		document.getElementById(id).innerHTML = newText;
		}
	}		

function show(id) {
	if (ns4) {
		document.layers[id].visibility = "show";
	}
	else if (ie4) {
		document.all[id].style.visibility = "visible";
	} 
	else if (ns6) {
		document.getElementById(id).style.visibility = "visible";
	}
}

function hide(id) {
	if (ns4) {
		document.layers[id].visibility = "hide";
	}
	else if (ie4) {
		document.all[id].style.visibility = "hidden";
	} 
	else if (ns6) {
		document.getElementById(id).style.visibility = "hidden";
	}
}


  
function startDrift() {
	setTimeout("goDrift()",300000);
 }
 
 function goDrift() {
	if (ns4) {
		document.layers["square1"].posTop += 4;
		document.layers["square2"].posTop += 3;
		document.layers["square3"].posTop += 5;
	}
	else if (ie4) {
		document.all["square1"].style.posTop += 4;
		document.all["square2"].style.posTop += 3;
		document.all["square3"].style.posTop += 5;
	} 
	else if (ns6) {
		document.getElementById("square1").style.posTop += 4;
		document.getElementById("square2").style.posTop += 3;
		document.getElementById("square3").style.posTop += 5;
	}
	setTimeout("goDrift()",30);
 }
 
 function putHtml(id,page) {
	if (ns4) {
		document.layers[id].visibility = "show";
		document.textLayer.src = page;
	}
	else if (ie4) {
		document.all[id].style.visibility = "visible";
		parent.textFrame.document.location = page;
	}
	else if (ns6) {
		document.getElementById(id).style.visibility = "visible";
		parent.textFrame.document.location = page;
	}
}

function setLyr(obj,lyr)
{
	var newX = findPosX(obj);
	var newY = findPosY(obj);
	newX += 37;
	if (ns4) {
		newY -= 284;
	}
	else if (ie4) {
		newY -= 284;
	}
	else if (ns6) {
		newY -= 284;
	}
	var x = new getObj(lyr);
	x.style.top = newY + 'px';
	x.style.left = newX + 'px';
}

function setLyr2(obj,lyr)
{
	var newX = findPosX(obj);
	var newY = findPosY(obj);
	newX += 300;
	if (ns4) {
		newY -= 60;
	}
	else if (ie4) {
		newY -= 60;
	}
	else if (ns6) {
		newY -= 60;
	}
	var x = new getObj(lyr);
	x.style.top = newY + 'px';
	x.style.left = newX + 'px';
}

function findPosX(obj)
{
        var curleft = 0;
        if (obj.offsetParent)
        {
                while (obj.offsetParent)
                {
                        curleft += obj.offsetLeft
                        obj = obj.offsetParent;
                }
        }
        else if (obj.x)
                curleft += obj.x;
        return curleft;
}

function findPosY(obj)
{
        var curtop = 0;
        if (obj.offsetParent)
        {
                while (obj.offsetParent)
                {
                        curtop += obj.offsetTop
                        obj = obj.offsetParent;
                }
        }
        else if (obj.y)
                curtop += obj.y;
        return curtop;
} 


function getObj(name)
{
 if (document.getElementById)
 {
	   this.obj = document.getElementById(name);
	   this.style = document.getElementById(name).style;
 }
 else if (document.all)
 {
	   this.obj = document.all[name];
	   this.style = document.all[name].style;
 }
 else if (document.layers)
 {
	   if (document.layers[name])
	   {
	   	this.obj = document.layers[name];
	   	this.style = document.layers[name];
	   }
	   else
	   {
	    this.obj = document.layers.testP.layers[name];
	    this.style = document.layers.testP.layers[name];
	   }
 }
}