// THIS CODE was mutated, modified, and re-done by the K10k/virusone � semi-bald posse
// THIS CODE has parts based on the excellent work by Dan Steinman
// THIS CODE was done in 1997-2001

// ----------------------------------------------------------------------

// check client browser & platform
// call browserNaming(); whenever you need to use the browser version
//
// 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;

	}

	// we might as well pick up the variables here


// creating the mouseovers
// you need the preload function as well, but that should be placed straight on the page
// call it like this : window.onload = preloadMe;

//	function preloadMe() {
//		createObject('cellularmanoff','images/specfeature_celluar_off.gif');
//		createObject('cellularmanon','images/specfeature_celluar_on.gif');
//		etc
//		preloadFlag = true;
//	}

	function createObject(imgName,imgSrc) {
		if (browserNew && (browserName == "NS")) {
		// a DOM-compatible browser
		// which is probably NS6/mozilla (the other code works better in IE/Opera)
			var tempImg = document.createElement("img");
			tempImg.src = imgSrc;
			tempImg.id = imgName;
			tempImg.style.visibility = 'hidden';
			tempImg.style.position = 'absolute';
			tempImg.style.top = 0;
			document.body.appendChild(tempImg);
		}
		else {
		// a non-DOM-compatible browser
		// and IE/Opera
			eval(imgName+' = new Image()');
			eval(imgName+'.src = "'+imgSrc+'"');
		}
	}

// doing the actual mouseover

	function changeImage(layer,imgName,imgObj) {
		if (preloadFlag) {
			if (browserNew && (browserName == "NS")) {
			// a DOM-compatible browser
			// which is probably NS6/mozilla (the other code works better in IE/Opera)
				thisImage = document.getElementById(imgName);
				newImage = document.getElementById(imgObj);
				newSrc = newImage.getAttribute("src");
				thisImage.setAttribute("src",newSrc);
			}
			else {
			// a non-DOM-compatible browser
			// and IE/Opera
				if ((browserName == "NS") && layer!=null) eval('document.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src')
				else document.images[imgName].src = eval(imgObj+".src")
			}
		}
	}

// the modified popup window function
// if you have a statusbar on a window, IE4 on the macintosh makes the window 17 pixels too small
// this popup function solves that problem

	function spawn(desktopURL,windowName,width,height,scroll,center) {
 		if (Macintosh) {
 			if (browserNameLong == "IE4") {
				newheight = parseInt(height + 17);
			}
			else if (browserNameLong == "IE4.5") {
				newheight = parseInt(height + 17);
			}
			else {
				newheight = height;
			}
 		}
 		else { newheight = height; }
       	if(scroll == "1") {
			scrolling = "yes";
		}
		else {
			scrolling = "auto"
		}
        features='';
		if(center == "1") {
			leftpos = (screen.width) ? (screen.width-width)/2 : 0;
			toppos = (screen.height) ? (screen.height-height)/2 : 0;
        	features = ",top=" + toppos + ",left=" + leftpos
		}
		window.open(desktopURL, windowName, "toolbar=no,location=no,status=yes,menubar=no,scrollbars="+scrolling+",width="+width+",height="+newheight+",resizable=no"+features );
	}
    
    function spawnNoScroll(desktopURL,windowName,width,height) {
 		if (Macintosh) {
 			if (browserNameLong == "IE4") {
				newheight = parseInt(height + 17);
			}
			else if (browserNameLong == "IE4.5") {
				newheight = parseInt(height + 17);
			}
			else {
				newheight = height;
			}
 		}
 		else { newheight = height; }	
 		window.open(desktopURL, windowName, "toolbar=no,location=no,status=yes,menubar=no,scrollbars=no,width="+width+",height="+newheight+",resizable=no" );
	}
	
// the modified popup window function
// if you have a statusbar on a window, IE4 on the macintosh makes the window 17 pixels too small
// this popup function solves that problem

	function printwindow(desktopURL,windowName,width,height) {
 		if (Macintosh) {
 			if (browserNameLong == "IE4") {
				newheight = parseInt(height + 17);
			}
			else if (browserNameLong == "IE4.5") {
				newheight = parseInt(height + 17);
			}
			else {
				newheight = height;
			}
 		}
 		else { newheight = height; }	
 		window.open(desktopURL, windowName, "toolbar=no,location=no,status=yes,menubar=yes,scrollbars=yes,width="+width+",height="+newheight+",resizable=no" );
	}


// DOM / GET PROPERTY
// original code from http://www.alistapart.com/
//
// NOTES:	given an id and a property (as strings), return the given property of that id.
// WORKS:	ie5+, ns6+, opera5+

	function getIdPropertyStyle(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/
//
// NOTES:	given an id and a property (as strings), set the given property of that id to the value provided.
// WORKS:	ie5+, ns6+, opera5+

	function setIdProperty(id,property,value) {
		var styleObject = document.getElementById( id );
		if (styleObject != null) {
			styleObject = styleObject.style;
			styleObject[ property ] = value;
		}
	}

// DOM / GET PROPERTY
// original code from http://www.alistapart.com/
//
// NOTES:	given an id and a property (as strings), return the given property of that id.
// WORKS:	ie5+, ns6+, opera5+

	function getIdProperty(id,property) {
		var styleObject = document.getElementById( id );
		if (styleObject != null) {
			if (styleObject[property]) {
				return styleObject[ property ];
			}
		}
		return (styleObject != null) ?
		styleObject[property] :
		null;
	}



// removes the link border in IE and NS6
// original code by evil@chelu.ro. thanks, chris!

	function unblur() {
		this.blur();
	}

	function getLinksToBlur() {
		if (!document.getElementById) return
		links = document.getElementsByTagName("a");
		for(i=0; i<links.length; i++) {
			links[i].onfocus = unblur
		}
	}
	

	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"; }
		}
	}
    
function doHop(pagename) {
    var pageValue = document.hopper.hop.options[document.hopper.hop.selectedIndex].value;
    document.location = pagename + "?currPage=" + pageValue;
}

function goBack(formID, action) {
    
    document.forms[formID].op.value = "edit";
    document.forms[formID].action = action;
    document.forms[formID].submit();
}

//creates a jump-menu
//original code by ??, mods by greg@417north.com	

	function buildArray() {
				
	  	var a = buildArray.arguments;
	  	for (i=0; i<a.length; i++) {
			this[i] = a[i];
	  	}
	  	this.length = a.length;
	}

	function go(which, num, win) {
	    n = which.selectedIndex;
	    if (n != 0) {
		  var url = eval("urls" + num + "[n]")
		  if (win) {
		    openWindow(url);
		 } else {
		    location.href = url;
		 }
	   }
	}

    function resizeFrameBrowser(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.width > 1024) {
					parent.window.moveTo(20,5);
				}
				else {
					parent.window.moveTo(0,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);
			}
		}
	}

	function resizeBrowser(width,height) {
		thisTargetWidth = width;
		thisTargetHeight = height;

		// NS6 HAS DECENT SUPPORT FOR THIS
		if (self.innerWidth) {
            frameWidth = self.innerWidth;
			frameHeight = self.innerHeight;
			realWidth = self.outerWidth;
			realHeight = self.outerHeight;
            widthMod = (realWidth - frameWidth);
			heightMod = (realHeight - frameHeight);
            defWidth = (thisTargetWidth - widthMod + widthMod*2);
			defHeight = (thisTargetHeight - heightMod + heightMod*2);
			window.resizeTo(defWidth,defHeight);
		}
		// WHEREAS THE IE SUPPORT SUCKS ASSCOCK
		else {
			// ie4-ie4.5 mac
			if ((Macintosh) && (navigator.appVersion.indexOf("MSIE 4.") > 1)) {
				window.resizeTo(thisTargetWidth,thisTargetHeight+101);
			}
			// ie5+ mac
			else if (Macintosh) {
				if (self.screen.width > 1024) {
					window.moveTo(20,5);
				}
				else {
					window.moveTo(0,5);
				}
				window.resizeTo(thisTargetWidth,thisTargetHeight+107);
			}
			// ie pc
			else {
				frameWidth = document.body.offsetWidth;
				frameHeight = document.body.offsetHeight;
				calcWidth = thisTargetWidth - frameWidth;
				calcHeight = thisTargetHeight - frameHeight + 3;
				window.resizeBy(calcWidth,calcHeight);
			}
		}
	}

    /*
	Webmonkey GET Parsing Module
	Language: JavaScript 1.0

	The parsing of GET queries is fundamental
	to the basic functionality of HTTP/1.0.
	This module parses GET with JavaScript 1.0.

	Source: Webmonkey Code Library
	(http://www.hotwired.com/webmonkey/javascript/code_library/)

	Author: Patrick Corcoran
	Author Email: patrick@taylor.org
	*/

	function createRequestObject() {

		FORM_DATA = new Object();
			// The Object ("Array") where our data will be stored.

		separator = ',';
			// The token used to separate data from multi-select inputs

		query = '' + this.location;
			// Get the current URL so we can parse out the data.
			// Adding a null-string '' forces an implicit type cast
			// from property to string, for NS2 compatibility.

		query = query.substring((query.indexOf('?')) + 1);
			// Keep everything after the question mark '?'.

		if (query.length < 1) { return false; }  // Perhaps we got some bad data?

		keypairs = new Object();
		numKP = 1;
			// Local vars used to store and keep track of name/value pairs
			// as we parse them back into a usable form.

		while (query.indexOf('&') > -1) {
			keypairs[numKP] = query.substring(0,query.indexOf('&'));
			query = query.substring((query.indexOf('&')) + 1);
			numKP++;
			// Split the query string at each '&', storing the left-hand side
			// of the split in a new keypairs[] holder, and chopping the query
			// so that it gets the value of the right-hand string.
		}

		keypairs[numKP] = query;
			// Store what's left in the query string as the final keypairs[] data.

		for (i in keypairs) {
			keyName = keypairs[i].substring(0,keypairs[i].indexOf('='));
			// Left of '=' is name.
			keyValue = keypairs[i].substring((keypairs[i].indexOf('=')) + 1);
			// Right of '=' is value.
			while (keyValue.indexOf('+') > -1) {
			keyValue = keyValue.substring(0,keyValue.indexOf('+')) + ' ' + keyValue.substring(keyValue.indexOf('+') + 1);
				// Replace each '+' in data string with a space.
			}

			keyValue = unescape(keyValue);
			// Unescape non-alphanumerics

			if (FORM_DATA[keyName]) {
			FORM_DATA[keyName] = FORM_DATA[keyName] + separator + keyValue;
				// Object already exists, it is probably a multi-select input,
				// and we need to generate a separator-delimited string
				// by appending to what we already have stored.
			} else {
			FORM_DATA[keyName] = keyValue;
				// Normal case: name gets value.
			}
		}

		return FORM_DATA;
	}

	// This is the array/object containing the GET data.
	// Retrieve information with 'FORM_DATA [ key ] = value'.
	//GET = createRequestObject();

	// FIXES THE OS X IFRAME DISPLAY PROBLEMS
// Notes: Only needed for IE5/mac under OS X

	function fix_OSX_IE_DisplayBug() {
		if ((Macintosh) && (browserName == 'IE') && (browserNew)) {
			try {
				objBody = document.getElementsByTagName("body");
				for (i=0; i < objBody.length; i++) {
					objBody[i].style.visibility = "hidden";
					objBody[i].style.visibility = "visible";
				}
			}
			catch(error) {
				// ignore error
			}
		}
	}
