if (navigator.appName.indexOf("WebTV") != -1) { 
	window.location.href = "/webtv.html"; 
}


// The W3C DOM Object

function dom_object(obj) {
	this.css2 = obj;
	this.name = obj.id;
	this.objHide = domHide;
	this.objShow = domShow;
	this.objGetLeft = domGetLeft;
	this.objGetTop = domGetTop;
	this.objSetTop = domSetTop;
	this.objSetLeft = domSetLeft;
	this.objMoveSide = domMoveSide;
	this.objSetZIndex = domSetZIndex;
	this.objGetZIndex = domGetZIndex;
    this.objGetVisibility = domGetVisibility;
}


// The Navigator DOM Object

function ns_object(obj) {
	this.css2 = obj;
	this.name = obj.name;
	this.objHide = nsobjHide;
	this.objShow = nsobjShow;
	this.objGetLeft = nsobjGetLeft;
	this.objGetTop = nsobjGetTop;
	this.objSetTop = nsobjSetTop;
	this.objSetLeft = nsobjSetLeft;
	this.objMoveSide = domMoveSide;
	this.objSetZIndex = nsobjSetZIndex;
	this.objGetZIndex = nsobjGetZIndex;
    this.objGetVisibility = nsVisibility;
}


// The DOM Object Implementations

// element's top position
function domGetTop () {
    var tp = parseInt(this.css2.style.top);
	return tp;
}

// set element's top position
function domSetTop (top) {
	this.css2.style.top = top + "px";
}

// element's left position
function domGetLeft() {
    var lt = parseInt(this.css2.style.left);
	return lt;
}

// set element's left position
function domSetLeft(left) {
	this.css2.style.left = left + "px";
}

// hide element
function domHide() {
   this.css2.style.visibility = "hidden";
}

// show element
function domShow() {
   this.css2.style.visibility = "visible";
}

function domMoveSide(sidePos) {
   this.objSetLeft(sidePos);
}

// set element's zindex order
function domSetZIndex(zindex) {
   this.css2.style.zIndex = zindex;
}

// get element's current zindex order
function domGetZIndex(zindex) {
   return this.css2.style.zIndex;
}

// return visibility
function domGetVisibility() {
    return this.css2.style.visibility;
}



// The Navigator 4.x Objects

// hide element
function nsobjHide() {
	this.css2.visibility = "hidden";
}

// show element
function nsobjShow() {
	this.css2.visibility = "inherit";
}

// element's top position
function nsobjGetTop () {
	return this.css2.top;
}

// set element's top position
function nsobjSetTop(top) {
	this.css2.top = top;
}

// element's left position
function nsobjGetLeft() {
	return this.css2.left;
}

// set element's left position
function nsobjSetLeft(left) {
	this.css2.left = left;
}

// get element's width
function nsobjGetWidth() {
	return this.css2.clip.width;
}

// set element's height
function nsobjSetHeight(height) {
	this.css2.clip.height = height;
}

// set element's zindex order
function nsobjSetZIndex(zindex) {
	this.css2.zIndex = zindex;
}

// get element's current zindex order
function nsobjGetZIndex() {
	return this.css2.zIndex;
}

// return visibility
function nsVisibility() {
   return this.css2.visibility;
}


// Create the objects
// menu will not function until all objects are created and the turnOn function is called

function create_objects() {

    // if IE
    if (navigator.appName == "Microsoft Internet Explorer")
	   create_ie_objects();
    else // Navigator or Mozilla
        if (navigator.appName == "Mozilla" || navigator.appName == "Netscape")
           if (navigator.appVersion.indexOf("4.") == -1)
	      create_dom_objects();
           else 
  	      create_ns_objects();
}

var counter = 0;

// For IE, pull all DIV blocks into object array
function create_ie_objects() {
   	theelements = document.all.tags("DIV");
   	theobjs = new Array();
   
   	for (i = 0; i < theelements.length; i++){
	 	counter = i + 1;
      	if (theelements[i].id != "") {
	   	theobjs[theelements[i].id] = new dom_object(theelements[i]);
	 	}
   	}
	
   	if (counter >= theelements.length) {
		turnOn();
   	}
}

// For Navigator 4.x, pull all DIV blocks into object array
function create_ns_objects(newarray) {
	theobjs = new Array();
	for (i = 0; i < document.layers.length; i++) {
	 	counter = i + 1;
		if (document.layers[i].name != "") {
			theobjs[document.layers[i].name] = new ns_object(document.layers[i]);
		}
	}

   	if (counter >= document.layers.length) {
		turnOn();
   	}
}

// For W3C DOM (Navigator 6.x, Mozilla, IE), pull all named DIV blocks into an array
function create_dom_objects() {
	theelements = document.getElementsByTagName("DIV");
	theobjs = new Array();
	for (i = 0; i < theelements.length; i++) {
	 	counter = i + 1;
		var obj = theelements[i];
		if (obj.id != "") {
			theobjs[obj.id] = new dom_object(obj);
		}
	}

   	if (counter >= theelements.length) {
		turnOn();
   	}
}

// nav script

var isModelsOn = false;
var y1,y2;
var mainSwitch = 0;
var bName = navigator.appName;
var browser;
var menuTop = 85;
var layerSwitch = 'off';

//get browser type
if(bName == "Netscape") {
	browser = "nn";
}


function turnOn() {
	mainSwitch = 1;
	layerSwitch = 'on';
}


if (window.captureEvents) {
        window.captureEvents(Event.MOUSEMOVE);
        window.onmousemove = modelsTracker;
} else {
        document.onmousemove = modelsTracker;
        
}

function modelsTracker(e){
	e = e || window.Event || window.event;
    window.pageY = e.pageY || e.clientY;

	setTimeout("",2000);

	if (isModelsOn == true) {
			y1 = 30;		//pixels above nav
			y2  = 100;		//pixels below nav
		
		if (window.pageY < (y1) || window.pageY > y2) {
				hide();
		}

	}

	if (isMenuOn == true) { 
			aboveNav = menuTop - 23;;		//pixels above nav
			belowNav = menuTop + 280;	//pixels below nav
		if (window.pageY < aboveNav || window.pageY > belowNav) {
				hideMenu();
		}
	}

}

// hide element  
function hide() {

	if (mainSwitch == 1) {
		isModelsOn = false;
  		theobjs["models"].objHide();
	}
}

// show element
function show() {

	if (mainSwitch == 1) {
		isModelsOn = true;
	   	theobjs["models"].objShow();
		menuTop = window.pageY;
	}

}

function modelsOn(img) {
	if (mainSwitch == 1) {
		if (browser == 'nn') {
			document.layers['models'].document.images[img].src = eval(img + "on.src");
		} else {
			window.document.images[img].src = eval(img + "on.src");
		}
	}
}

function modelsOff(img) {
	if (mainSwitch == 1) {
		if (browser == 'nn') {
			document.layers['models'].document.images[img].src = eval(img + "off.src");
		} else {
			window.document.images[img].src = eval(img + "off.src");
		}
	}
}

//content nav script begins
var isMenuOn = false;
var aboveNav, belowNav; 

// hide element  
function hideMenu() {
	if (mainSwitch == 1) {
		isMenuOn = false;
  		theobjs["menu"].objHide();
	}
}

// show element
function showMenu() {
	if (mainSwitch == 1) {
		isMenuOn = true;
	   	theobjs["menu"].objShow();
		menuTop = window.pageY;
	}

}

function menuOn(img) {
	if (mainSwitch == 1) {
		if (browser == 'nn') {
			document.layers['menu'].document.images[img].src = eval(img + "on.src");
		} else {
			window.document.images[img].src = eval(img + "on.src");
		}
	}
}

function menuOff(img) {
	if (mainSwitch == 1) {
		if (browser == 'nn') {
			document.layers['menu'].document.images[img].src = eval(img + "off.src");
		} else {
			window.document.images[img].src = eval(img + "off.src");
		}
	}
}

// popup for showroom
function showWin(url) {
	newWin = window.open(url,"theWin","width=500,height=400,menubar,scrollbars=auto,resizable=yes,toolbar=yes")
}



// create objects
create_objects();
turnOn();


