	// Global Variables //
	var _isMoz = (navigator.appName == "Netscape");
	var _isIE = (navigator.appName == "Microsoft Internet Explorer");
	var _isIE6 = (navigator.appVersion.search("MSIE 6.0") != -1);
	var _isSafari = (navigator.userAgent.indexOf("Safari") != -1);
	var _isLoaded = false, _i = _j = _numCheckboxes = _navCount = _subNavCount = _setKropLink = _paletteAngle = _width = _height = 0, _canAni = "show", _animateBy = 40, _paletteIsCPW = false;
	var dragsort, junkdrawer, _colourBoxOrder = "0|1|2|3|4", _incArrayMenu = [0,6,11,16,25], _incArrayUL = [158,153,148,143,136], _incArrayMenuH = [25,16,11,6,0], _incArrayULH = [136,143,148,153,158];
	var _currentPage = "";

	showHoverInfo = function(){}
	hideHoverInfo = function(){}

	//getS3URL = function(_url) {
	//	return "http://colourlovers.com.s3.amazonaws.com" + _url;
	//}

	$S = function(_elementID) {
		return $(_elementID).style;
	}

	// init function //
	init = function() {
		addEvent(onLoad,"load");
	}

	setOpacity = function(_elementID,_opacity) {
		$S(_elementID).opacity = _opacity;
		$S(_elementID).MozOpacity = _opacity;
		$S(_elementID).filter = "alpha(opacity=" + (_opacity * 100) + ")";
	}

	within = function(_val,_low,_high) {
		return ((_val >= _low) && (_val <= _high));
	}

	dec2hex = function(_dec) {
		var _hexChars = "0123456789ABCDEF", _hex = "";
		while (_dec > 15) {
			_hex = (_hexChars.charAt((_dec - (Math.floor(_dec / 16)) * 16)) + _hex);
			_dec = Math.floor(_dec / 16);
		}
		return (_hexChars.charAt(_dec) + _hex);
	}

	hex2dec = function(_hex) {
		return parseInt(_hex,16);
	}

	// Manage events //
	addEvent = function(_function,_event) {
		if ((document.all) && (window.attachEvent)) {
			window.attachEvent("on" + _event,_function);
		} else if (window.addEventListener) {
			window.addEventListener(_event,_function,false);
		}
	}

	isHex = function(_hex) {
		return /^[a-fA-F0-9]{6}$/.test(_hex);
	}

	domEvent = function(_event) {
		_event = (_event) ? _event : window.event;

		// Opera hates this for some reason:
		if (!window.opera && _event.srcElement) {
			_event.target = _event.srcElement;
		}
		if (_event.keyCode) {
			_event.code = _event.keyCode;
		} else if (_event.which) {
			_event.code = _event.which;
		} else {
			_event.code = _event.charCode
		}
		return _event;
	}


	// Show subNav //
	showSubNav = function(_elementID) {
		_wait = 0;
		if (_canAni == "show") {
			$S("navUL").marginBottom = 0;
			if ($("subNavContainer").style.height != (_incArrayMenuH[0] + "px")) {
				// If subNavContainer is closed...
				_canAni = "";
				for (_i=0;_i<_incArrayMenu.length;_i++) {
					setTimeout("aniSubNav(" + _incArrayMenu[_i] + "," + _incArrayUL[_i] + ")",(_animateBy * _i));
				}
				$S("subNavContainer").display = "block";
			}
			_wait = (_incArrayMenu.length * _animateBy);
			setTimeout("menuAniStop('hide')",(_wait + 19));
		}

		fadeElement("sub" + _elementID,0);
		for (_i=1;_i<=10;_i++) {
			setTimeout("fadeElement('sub" + _elementID + "'," + _i + ")",(_wait + (_animateBy * _i)));
		}
		highlightNav(_elementID);

		// Close any SubNavs we have open //
		for (_i=0;_i<=_subNavCount;_i++) {
			$S("subNav" + _i).display = "none";
		}
		$S("sub" + _elementID).display = "block";
	}

	aniSubNav = function(_howMuchMenu,_howMuchUL) {
		$S("subNavContainer").height = (_howMuchMenu + "px");
		$S("navUL").marginTop = (_howMuchUL + "px");
	}

	// Hide subNav //
	hideSubNav = function() {
		_wait = 0;
		if (_canAni == "hide") {
			if ($S("subNavContainer").height == (_incArrayMenuH[0] + "px")) {
				_canAni = "";
				for (_i=0;_i<_incArrayMenu.length;_i++) {
					setTimeout("aniSubNav(" + _incArrayMenuH[_i] + "," + _incArrayULH[_i] + ")",(_animateBy * _i));
				}
				_wait = (_incArrayMenu.length * _animateBy);
				setTimeout("menuAniStop('show')",(_wait + 20));
			}
		}
	}

	menuOver = function() {
		try {
			clearTimeout(_timeOut);
		} catch(_e) {}
	}

	menuOut = function() {
		_timeOut = setTimeout("hideSubNav(); highlightNav();",1200);
	}

	// Called when the menu is done animating [either up or down]
	menuAniStop = function(_showHide) {
		_canAni = _showHide;
	}

	// Highlight whatever _elementID is passed //
	highlightNav = function(_elementID) {
		// Clear any Nav Anchors we have higlighted //
		for (_i=0;_i<=_navCount;_i++) {
			// See .nav li a in ./global.css for values //
			$S("Nav" + _i).background = "";
			$S("Nav" + _i).color = "#fff";
		}
		if (_elementID) {
			// See .nav li a:hover in ./global.css for values //
			//$S(_elementID).background = "#94b3c5";
			$S(_elementID).background = "#fecc0c";
			$S(_elementID).color = "#383731";
		}
	}

	// Fades _elementID to _opacity, called from timeouts //
	fadeElement = function(_elementID,_opacity) {
		// Safari seems to think it's funny to throw a moueover event when you move your mouse, so this will flicker: //
		if (_isIE) {
			$(_elementID).style.filter = "alpha(opacity=" + (_opacity * 10) + ")";
		} else if (_isMoz) {
			$(_elementID).style.MozOpacity = (_opacity / 10);
			$(_elementID).style.opacity = (_opacity / 10);
		}
	}

	swapImage = function(_elementID,_src) {
		var _element = "";
		if (_element = _src.match(/(.+)_off\.png$/)) {
			$(_elementID).src = _element[1] + "_on.png";
		} else {
			$(_elementID).src = _src.match(/(.+)_on\.png$/)[1] + "_off.png";
		}
	}

	toggleDisplay = function(_elementIDs,_flow) {
		if (_elementIDs.constructor != Array) {
			_elementIDs = [_elementIDs];
		}
		for (_i=0;_i<_elementIDs.length;_i++) {
			$(_elementIDs[_i]).style.display = (_flow) ? _flow : "none";
		}
	}



	// Prototypes //
	Array.prototype.implode = function(_char) {
		return this.toString().replace(/,/g,_char);
	}
	Array.prototype.in_array = function(_needle) {
		var _i;
		for (_i=0;_i<=this.length;_i++ ) {
			if (this[_i] == _needle) {
				return true;
			}
		}
		return false;
	}

	String.prototype.padHex = function() {
		var _str = ("000000".toString() + this.toString());
		return _str.substring((_str.length - 6),_str.length); // THANKS IE!!!!
	}

	String.prototype.base64_encode = function() {
		input = this;
		var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;

		while (i < input.length) {
			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);

			enc1 = (chr1 >> 2);
			enc2 = (((chr1 & 3) << 4) | (chr2 >> 4));
			enc3 = (((chr2 & 15) << 2) | (chr3 >> 6));
			enc4 = (chr3 & 63);

			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}

			output += (_keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4));
		}

		return output;
	}

	String.prototype.base64_decode = function() {
		input = this;
		var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;

		input = input.replace(/[^A-Za-z0-9\+\/\=]/g,"");

		while (i < input.length) {
			enc1 = _keyStr.indexOf(input.charAt(i++));
			enc2 = _keyStr.indexOf(input.charAt(i++));
			enc3 = _keyStr.indexOf(input.charAt(i++));
			enc4 = _keyStr.indexOf(input.charAt(i++));

			chr1 = ((enc1 << 2) | (enc2 >> 4));
			chr2 = (((enc2 & 15) << 4) | (enc3 >> 2));
			chr3 = (((enc3 & 3) << 6) | enc4);

			output += String.fromCharCode(chr1);

			if (enc3 != 64) {
				output += String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output += String.fromCharCode(chr3);
			}
		}
		return output;
	}

