// ver. 1.3.2

var unself
var activeMenu = 0;

function turnOff() {
	if (activeMenu) {
		hideMenu(activeMenu);
		activeMenu = 0;
	}
}

function timer(offon) {
	if (offon == 0)	{
		unself = setTimeout('turnOff()', 1200);
	}
	if (offon ==1)	{
		clearTimeout(unself);
	}
}

var loadcheck;

var FREELAYERS = new Array();
var browser = new browserObject();

function browserObject() {
	this.ver = navigator.appVersion;
	this.dom = document.getElementById?1:0;
	this.ie = (navigator.appName == "Microsoft Internet Explorer");
	this.ns = (navigator.appName == "Netscape");
	this.moz = ((navigator.userAgent.indexOf("Mozilla")!=-1)&&(navigator.userAgent.indexOf("Gecko")!=-1)&&(navigator.userAgent.indexOf("Netscape6")==-1));
	this.mac = (navigator.appVersion.indexOf("Mac")>0);
	this.win = (navigator.appVersion.indexOf("Win")>0);
	this.xwin = (navigator.appVersion.indexOf("X11")>0);
	this.opera = (navigator.userAgent.indexOf('Opera')!=-1);
	this.ie4 = (this.ie && !this.dom);
	this.ie5 = (this.ie && this.ver.indexOf("MSIE 5")>-1);
	this.ie6 = (this.ie && this.ver.indexOf("MSIE 6")>-1);
	this.ns4 = (this.ns && this.ver.indexOf("4.")>-1);
	this.ns6 = (this.ns && this.ver.indexOf("5.")>-1&&this.dom);
	this.ns60 = (this.ns6 && navigator.userAgent.indexOf('6.0')!=-1);
	this.ns61 = (this.ns6 && navigator.userAgent.indexOf('6.1')!=-1);
	this.compatible=((this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6) && !this.opera);
	this.width = null; //to be set later after document is loaded;
	this.height = null; //to be set later after document is loaded;
	return this;
}

function initBrowserComp() {
	if (browser.compatible) {
		if (browser.ie) {
			browser.width = document.body.clientWidth;
			browser.height = document.body.clientHeight;
			if(!browser.ie6) {
				Array.prototype.push = ArrayPush;
				Array.prototype.pop = ArrayPop;
			}
		}
		else if (browser.ns4) {
			browser.width = window.innerWidth;
			browser.height = window.innerHeight;
			initResizeBug();
		}
		else if (browser.ns6) {
			browser.width = window.innerWidth;
			browser.height = window.innerHeight;
		}
		else if(browser.opera) {
			browser.width = window.innerWidth;
			browser.height = window.innerHeight;
		}
		return (true);
	}
	else {
		return (true);
	}
}

function layerGetRef( ID ) {
	if (browser.ns6) return document.getElementById(ID);
	else if (browser.ns4) return document.layers[ID];
	else return document.all[ID];
}

function layerMoveTo( ID, x, y) {
	var thisID = layerGetRef(ID);
	if (browser.ns4) thisID.moveTo(x, y);
	else {
		thisID.style.left = x;
		thisID.style.top = y;
	}
}
function layerResizeTo( ID, w, h) {
	var thisID = layerGetRef(ID);
	if (browser.ns4) {
		thisID.resizeTo(w,h);
		thisID.document.width = w;
		thisID.document.height = h;
	}
	else {
		thisID.style.width = w+"px";
		thisID.style.height = h+"px";
	}
}
function layerShow( ID ) {
	var thisID = layerGetRef(ID);
	if (browser.ns4) thisID.visibility = "show";
	else thisID.style.visibility = "visible";
}
function layerHide( ID ) {
	var thisID = layerGetRef(ID);
	if (browser.ns4) thisID.visibility = "hide";
	else thisID.style.visibility = "hidden";
}
function layerGetX( ID ) {
	var thisID = layerGetRef(ID);
	if(browser.ns4) return thisID.left;
	else return parseInt(thisID.style.left);
}
function layerGetY( ID ) {
	var thisID = layerGetRef(ID);
	if(browser.ns4) return thisID.top;
	else return parseInt(thisID.style.top);
}

function initResizeBug() {
	document.orPageWidth = innerWidth;
	document.orPageHeight = innerHeight;
	onresize = nsResizeBug;
}
function nsResizeBug() {
	if (innerWidth != document.orPageWidth || innerHeight != document.orPageHeight) location.reload();
}
function ArrayPush(the_element) {
	this[this.length] = the_element;
}
function ArrayPop(the_element) {
	var the_value = this[this.length-1];
	this.length--;
	return(the_value);
}
function layerHTMLWrite( ID, str) {
	var thisID = layerGetRef(ID);
	if (browser.ns4) {
		thisID.document.open();
		thisID.document.write(str);
		thisID.document.close();
	}
	else {
		if(browser.mac) str += "<br>";
		thisID.innerHTML = str;
	}
}
