// CHECK CLIENT BROWSER & PLATFORM
// original code from http://developer.apple.com/internet/_javascript/

	var its;
	var browserName = '';
	var browserNameLong = '';
	var browserNew = '';
	var preloadFlag = false;
	var Macintosh = navigator.userAgent.indexOf('Mac')>0;

	function its() {
		var n = navigator;
		var ua = ' ' + n.userAgent.toLowerCase();
		var pl = n.platform.toLowerCase();
		var an = n.appName.toLowerCase();

		// browser version
		this.version = n.appVersion;
		this.nn = ua.indexOf('mozilla') > 0;

		// 'compatible' versions of mozilla aren't navigator
		if(ua.indexOf('compatible') > 0) {
			this.nn = false;
		}
		
		this.opera = ua.indexOf('opera') > 0;
		this.ie = ua.indexOf('msie') > 0;
		this.major = parseInt( this.version );
		this.minor = parseFloat( this.version );

		// platform
		this.mac = ua.indexOf('mac') > 0;
		this.win = ua.indexOf('win') > 0;

		// workaround for IE5 which reports itself as version 4.0
		if(this.ie) {
			if(ua.indexOf("msie 5") > 1) {
			var msieIndex = navigator.appVersion.indexOf("MSIE") + 5;
			this.major = parseFloat(navigator.appVersion.substr(msieIndex,3));
			}
		}

		return this;
	}

	function browserNaming() {
		its = new its();
		
		// is it a DOM-enabled browser?
		if (!document.getElementById) {
			browserNew = false;
		}
		else {
			browserNew = true;
		}

		// need the name, too
		if (its.opera) {
			browserName = "Opera";
		}
		else if (its.ie) {
			browserName = "IE";
		}
		else {
			browserName = "NS";
		}

		// and the number
		browserNameLong = browserName + its.major;
	}
	

// DOM / GET PROPERTY
// original code from http://www.alistapart.com/

	function getIdProperty(id,property) {
		var styleObject = document.getElementById( id );
		if (styleObject != null) {
			styleObject = styleObject.style;
				if (styleObject[property]) {
					return styleObject[ property ];
				}
			}
		return (styleObject != null) ?
		styleObject[property] :
		null;
	}


// DOM / SET PROPERTY
// original code from http://www.alistapart.com/

	function setIdProperty(id,property,value) {
		var styleObject = document.getElementById( id );
		if (styleObject != null) {
			styleObject = styleObject.style;
			styleObject[ property ] = value;
		}
	}


// DOM / MASTER MOVE FUNCTION
// original code from http://www.alistapart.com/

	function generic_move(id,xValue,yValue,additive ) {
		var left = parseInt(getIdProperty(id, "left"));
		var top = parseInt(getIdProperty(id, "top"));
		if (additive) {
			setIdProperty(id,"left",left + xValue);
			setIdProperty(id,"top",top + yValue);
		}
		else {
			setIdProperty(id,"left",xValue);
			setIdProperty(id,"top",yValue);
		}
	}

// HIDE AND SHOW LAYERS

	function hide(id) {
		if (browserNew) {
			setIdProperty(id,"visibility","hidden");
		}
		else {
			if (browserName == "NS") { document.layers[id].visibility = "hide"; }
			else { document.all[id].style.visibility = "hidden"; }
		}
	}

	function show(id) {
		if (browserNew) {
			setIdProperty(id,"visibility","visible");
		}
		else {
			if (browserName == "NS") { document.layers[id].visibility = "show"; }
			else { document.all[id].style.visibility = "visible"; }
		}
	}


// CHANGE DISPLAY VALUE FOR LAYERS

	function switchDisplay(id,value) {
		if (browserNew) {
			setIdProperty(id,"display",value);
		}
		else {
			if (browserName == "NS") {
				document.layers[id].display = value;
			}
			else {
				document.all[id].style.display = value;
			}
		}
	}
	


	

// THE BITCHIN' RESIZE FUNCTION

	function resizeBrowser(width,height) {
		thisTargetWidth = width;
		thisTargetHeight = height;
		
		// NS6 HAS DECENT SUPPORT FOR THIS
		if (self.innerWidth) {
			frameWidth = parent.innerWidth;
			frameHeight = parent.innerHeight;
			realWidth = self.outerWidth;
			realHeight = self.outerHeight;
			widthMod = (realWidth - frameWidth);
			heightMod = (realHeight - frameHeight);
			parent.window.resizeTo(thisTargetWidth+widthMod,thisTargetHeight+heightMod);
		}
		// WHEREAS THE IE SUPPORT SUCKS ASSCOCK
		else {
			// ie4-ie4.5 mac
			if ((Macintosh) && (navigator.appVersion.indexOf("MSIE 4.") > 1)) {
				parent.window.resizeTo(thisTargetWidth,thisTargetHeight+101);
			}
			// ie5+ mac
			else if (Macintosh) {
				if (self.screen.height == 768) {
					parent.window.moveTo(20,5);
				}
				parent.window.resizeTo(thisTargetWidth,thisTargetHeight+107);
			}
			// ie pc
			else {
				frameWidth = parent.document.body.offsetWidth;
				frameHeight = parent.document.body.offsetHeight;
				calcWidth = thisTargetWidth - frameWidth;
				calcHeight = thisTargetHeight - frameHeight + 3;
				parent.window.resizeBy(calcWidth,calcHeight);
			}
		}
	}
	
	// Some menutext variables
        var textLayerHtml;
        var dontShowTextLayer = 1;

        function menuTextOn(thisSection) {
            if (browserName != "Opera") {
                thisText = eval('text' + thisSection);
                textLayerHtml = "<span style=\"color:#f9a200;\">&raquo;</span>&nbsp;<span class=\"menusml\">"+thisText+"</span>"; 
                rewriteTextLayer(textLayerHtml, 'botoverdiv');
                dontShowTextLayer = 1;
                show('botoverdiv');
            }
        }

        function rewriteTextLayer(txt, id) {
            txt += "\n";
            // NS6
            if (browserNew && browserName == "NS") {
                botOver = document.getElementById(id);
                range = document.createRange();
                range.setStartBefore(botOver);
                domfrag = range.createContextualFragment(txt);
                while (botOver.hasChildNodes()) {
                    botOver.removeChild(botOver.lastChild);
                }
                botOver.appendChild(domfrag);
            }
            // IE 4+
            else {
                document.all[id].innerHTML = txt;
            }
        }

        function menuTextOff() {
            if (browserName != "Opera") {
                dontShowTextLayer = 0;
                hide('botoverdiv');
                self.status = '';
            }
        }

