// STEP 6

function Is() {
agent = navigator.userAgent.toLowerCase();
this.major = parseInt(navigator.appVersion);
this.minor = parseFloat(navigator.appVersion);
this.ns = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
this.ns7up = (this.ns && (this.major >= 6));
this.ie = ((agent.indexOf("msie") != -1)&& (agent.indexOf('opera')==-1));
this.ie3 = (this.ie && (this.major < 4));
this.ie4up = (this.ie && (this.major >= 4));
}

var is = new Is()

// if (is.ie4up || is.ns7up) {
   doc = "document.getElementById";
	sty = ".style";
	htm = ""
// } else {
//   doc = "document";
//  sty = "";
//  htm = ".document"
//} 

//function Is() {
//	var agent = navigator.userAgent.toLowerCase();
//	this.major = parseInt(navigator.appVersion);
//	this.minor = parseFloat(navigator.appVersion);
//	this.ns  = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
//	this.ns2 = (this.ns && (this.major == 3));
//	this.ns3 = (this.ns && (this.major == 3));
//	this.ns4 = (this.ns && (this.major >= 4));
//	this.ie   = (agent.indexOf("msie") != -1);
//	this.ie3  = (this.ie && (this.major == 2));
//	this.ie4  = (this.ie && (this.major >= 4));
//	this.op3 = (agent.indexOf("opera") != -1);
// }

// var is = new Is()

// if(is.ns4) {
//	doc = "document";
//	sty = "";
//	htm = ".document"
// } else if(is.ie4) {
//	doc = "document.all";
//	sty = ".style";
//	htm = ""
// }

// STEP 7

var count = 0;

function preLoad() {
	off = new Image();
	off.onload = loadCheck;
	off.src = "images/menuoff.gif";

	on = new Image();
	on.onload = loadCheck;
	on.src = "images/menuon.gif";

	blank = new Image();
	blank.onload = loadCheck;
	blank.src = "images/blank.gif";

        smallLogo = new Image();
	smallLogo.onload = loadCheck;
	smallLogo.src = "images/clogo_small.gif";


}

function loadCheck() {
	count++;
	if(count == 4) {
		layerSetup();
	}
}

// STEP 8

function layerSetup() {
   offLyr = eval(doc + '("offLayer")' + sty);
	offLyr.left = 0;
	offLyr.top = 0;

   onLyr = eval(doc + '("onLayer")' + sty);
	onLyr.left = 0;
	onLyr.top = 0;

   mapLyr = eval(doc + '("mapLayer")' + sty);
	mapLyr.left = 0;
	mapLyr.top = 0;

   smalllogoLyr = eval(doc + '("smalllogoLayer")' + sty);
	smalllogoLyr.left = 2;
	smalllogoLyr.top = available_height - 50;

	visibilitySetup();
}

// STEP 9

function visibilitySetup() {
	offLyr.visibility = "visible";
	onLyr.visibility = "visible";
	mapLyr.visibility = "visible";
       smalllogoLyr.visibility = "visible";
	
	arraySetup();
}

// STEP 10

function arrayValues(top,right,bottom,left) {
	this.top = top;
	this.right = right;
	this.bottom = bottom;
	this.left = left;
}

function arraySetup() {
	clippingBox = new Array()
	clippingBox[0] = new arrayValues(0,0,0,0);
	clippingBox[1] = new arrayValues(9,132,35,8);
	clippingBox[2] = new arrayValues(43,132,65,8);
	clippingBox[3] = new arrayValues(69,132,88,8);
	clippingBox[4] = new arrayValues(94,132,113,8);
	clippingBox[5] = new arrayValues(119,132,136,8);
	clippingBox[6] = new arrayValues(141,132,163,8);
	clippingBox[7] = new arrayValues(168,132,186,8);

	clipMenu(0);
}

// STEP 11

function clipMenu(box) {
	var cTop = clippingBox[box].top;
	var cRight = clippingBox[box].right;
	var cBottom = clippingBox[box].bottom;
	var cLeft = clippingBox[box].left;

	if(is.ns4) {
		onLyr.clip.top = cTop;
		onLyr.clip.right = cRight;
		onLyr.clip.bottom = cBottom;
		onLyr.clip.left =  cLeft;
	} else {
		onLyr.clip = 'rect(' + cTop + ' ' + cRight + ' ' + cBottom + ' ' + cLeft + ')';
	}
}