	// Global Variables //
	var _isMoz = (navigator.appName == "Netscape");
	var _isIE = (navigator.appName == "Microsoft Internet Explorer");
	var _isSafari = (navigator.userAgent.indexOf("Safari") != -1);
	var _isLoaded = false, _i = _j = _numCheckboxes = _navCount = _subNavCount = _setKropLink = _paletteAngle = _width = _height = 0, _canAni = "show";
	var krop_affiliate_id = "s5cx";
	var dragsort, junkdrawer;
	var _colourBoxOrder = "0|1|2|3|4";

	// Ugly as HELL //
	var _incArrayMenu = [0,10,17,21,22];
	var _incArrayUL = [37,27,20,16,15];
	var _incArrayMenuH = [22,21,17,10,0];
	var _incArrayULH = [15,16,20,27,37];
	var _animateBy = 40;

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

	// getElementById //
	$ = function(_elementID) {
		return document.getElementById(_elementID);
	}

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

	// Manage onLoad events //
	addEvent = function(_function,_event) {
		if (eval(_function)) {
			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);
	}

	// onLoad //
	onLoad = function() {
		var _ypos = new Array();
		var _queryString = window.location.search;
		var _regExp = /ypos=(\d+)/;

		// If the url tells y us to scroll, then do so.
		if (_regExp.test(_queryString)) {
			_ypos = _regExp.exec(_queryString);
			_ypos = parseInt(_ypos[1]);

			if (_ypos > 0) {
				window.scroll(0,_ypos);
			}
		}
		if ($("Radio_BBCode")) {
			$("Radio_BBCode").checked = true;
		}
/*		if (_isIE) {
			$("hoverInfo").style.filter = "alpha(opacity=" + (70) + ")";
		} else if (_isMoz) {
			$("hoverInfo").style.MozOpacity = 0.7;
			$("hoverInfo").style.opacity = 0.7;
		}*/

		try {
			initLightbox();
		} catch (_e) {}

		_setKropLink = setInterval("setKropPostLink()",1000);
		_isLoaded = true;
	}

	setKropPostLink = function() {
		if ($("krop_post")) {
			_url = "http://www.krop.com/jobs/step1_configure/?krop_affiliate=" + krop_affiliate_id;
			clearInterval(_setKropLink);
			$("krop_post").style.cursor = "pointer";
			$("krop_post").onclick = function() {
				if (_isIE) {
					window.open(_url);
				} else {
					window.open(_url,_url);
				}
			}
		}
	}

	// Init drag //
	initDD = function() {
		dragsort.makeListSortable($("ddItems"),function(_item) {
				_item.toolManDragGroup.register("dragend",clEndDrag);
			}
		);
	}

	// End drag //
	clEndDrag = function() {
		_colourBoxOrder = "";
		var _colourBoxes = $("ddItems").getElementsByTagName("li");
		for (_i=0;_i<_colourBoxes.length;_i++) {
			_colourBoxOrder += _colourBoxes[_i].title;
			if ((_i + 1) != _colourBoxes.length) {
				_colourBoxOrder += "|";
			}
		}
	}

	// Remove Avatar Confirmation //
	rmAvatarConf = function() {
		if (confirm("Are you sure you want to Delete your Avatar?")) {
			window.location.href = "/op/rmAvatar";
		}
	}

	httpPost = function() {
		var _httpPostSocket;
		// Send request //
		this.sendRequest = function(_contentElement,_args) {
			var _url = ("/ajax/" + _contentElement), _continue = true, _method = "POST", _postArgs = "";

			if (window.XMLHttpRequest) {
				_httpPostSocket = new XMLHttpRequest();
			} else if (window.ActiveXObject) {
				try {
					_httpPostSocket = new ActiveXObject("Msxml2.XMLHTTP");
				} catch(_e) {
					_httpPostSocket = new ActiveXObject("Microsoft.XMLHTTP");
				}
			}

			if (_contentElement == "addComment") {
				// commentsID, title, contextType, contextID, comments
				_postArgs += "commentsID=" + _args[0] + "&title=" + _args[1] + "&contextType=" + _args[2] + "&contextID=" + _args[3] + "&comments=" + _args[4];
			}

			if (_continue) {
				// Tell Google that we have another page view //
				try {
					urchinTracker(_url);
				} catch (_e) {}
				if (window.XMLHttpRequest) {
					_httpPostSocket.onreadystatechange = this.xmlhttpChange;
					_httpPostSocket.open(_method,_url,true);
					_httpPostSocket.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
					_httpPostSocket.send(_postArgs);
				} else if (window.ActiveXObject) {
					if (_httpPostSocket) {
						_httpPostSocket.onreadystatechange = this.xmlhttpChange;
						_httpPostSocket.open(_method,_url,true);
						_httpPostSocket.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
						_httpPostSocket.send(_postArgs);
					}
				}
			}
		}

		// AJAX Listener //
		this.xmlhttpChange = function() {
			if (_httpPostSocket.readyState == 4) {
				var _responseArray = [];
				var _responseText = _httpPostSocket.responseText;
				var _PFSResponseType = _httpPostSocket.getResponseHeader("PFSResponseType");

				// IE seems to think this is a static object, I think not //
				if (_isIE) {
					_httpPostSocket.abort();
				}

				if (_PFSResponseType == "addComment") {
					_responseArray = _responseText.split("|");

					if (_responseArray[0] == "login") {
						window.location.href = "/login?referer=" + _responseArray[1];
					} else {
						(new httpRequest()).sendRequest(_responseArray[0],eval(_responseArray[1]),false);
					}
				}
			}
		}
	}

	// AJAX //
	httpRequest = function() {
		var _httpSocket;

		// Send request //
		this.sendRequest = function(_contentElement,_args,_registerNewPageView) {
			var _url = "";
			_registerNewPageView = (_registerNewPageView != "undefined") ? _registerNewPageView : false;
			if ((_contentElement == "loversBlog1") || (_contentElement == "loversBlog2") || (_contentElement == "loversBlog3") || (_contentElement == "loversBlog4")) {
				_url = ("/ajax/loversBlog") , _continue = true, _method = "GET";
			} else {
				_url = ("/ajax/" + _contentElement) , _continue = true, _method = "GET";
			}

			if (window.XMLHttpRequest) {
				_httpSocket = new XMLHttpRequest();
			} else if (window.ActiveXObject) {
				try {
					_httpSocket = new ActiveXObject("Msxml2.XMLHTTP");
				} catch(_e) {
					_httpSocket = new ActiveXObject("Microsoft.XMLHTTP");
				}
			}

			if (_contentElement == "loversFriendsComments") {
				// userName, userID, page
				_url += "?userName=" + _args[0] + "&id=" + _args[1] + "&page=" + _args[2];
			} else if (_contentElement == "loversFlickr") {
				// flickrID, howMany
				_url += "?flickrID=" + _args[0] + "&howMany=" + _args[1];
			} else if (_contentElement == "loversWhoLoves") {
				// userName, id [user], page
				_url += "?userName=" + _args[0] + "&id=" + _args[1] + "&page=" + _args[2];
			} else if (_contentElement == "loversWhoILove") {
				// id [user], page
				_url += "?id=" + _args[0] + "&page=" + _args[1];
			} else if (_contentElement == "tagCloud") {
				// page
				_url += "?page=" + _args[0];
			} else if (_contentElement == "indexRandColours") {
				// howMany, hue, lover [id]
				_url += "?howMany=" + _args[0] + "&hue=" + _args[1] + "&lover=" + _args[2];
			} else if (_contentElement == "similarColours") {
				// howMany, hue
				_url += "?howMany=" + _args[0] + "&hue=" + _args[1];
			} else if (_contentElement == "indexRandPalettes") {
				// howMany, lover [id]
				_url += "?howMany=" + _args[0] + "&lover=" + _args[1];
			} else if (_contentElement == "indexTopColours") {
				// howMany, page
				_url += "?howMany=" + _args[0] + "&page=" + _args[1];
			} else if (_contentElement == "newPalettes") {
				// howMany
				_url += "?howMany=" + _args[0];
			} else if (_contentElement == "coloursInPalettes") {
				// id [colour], page
				_url += "?id=" + _args[0] + "&page=" + _args[1];
			} else if (_contentElement == "loversFavouritePalettes") {
				// id [user], howMany
				_url += "?id=" + _args[0] + "&howMany=" + _args[1];
			} else if (_contentElement == "loversFavouriteColours") {
				// id [user], howMany
				_url += "?id=" + _args[0] + "&howMany=" + _args[1];
			} else if (_contentElement == "coloursFriendsComments") {
				// title, id [colour], page
				_url += "?title=" + _args[0] + "&id=" + _args[1] + "&page=" + _args[2];
			} else if (_contentElement == "myComments") {
				// userName, id [user], page
				_url += "?userName=" + _args[0] + "&id=" + _args[1] + "&page=" + _args[2];
			} else if (_contentElement == "coloursWhoLoves") {
				// title, id [colour], page
				_url += "?title=" + _args[0] + "&id=" + _args[1] + "&page=" + _args[2];
			} else if (_contentElement == "palettesInColours") {
				// id [palette], howMany
				_url += "?id=" + _args[0] + "&howMany=" + _args[1];
			} else if (_contentElement == "palettesWhoLoves") {
				// title, id [palette], page
				_url += "?title=" + _args[0] + "&id=" + _args[1] + "&page=" + _args[2];
			} else if (_contentElement == "palettesFriendsComments") {
				// title, id [palette], page
				_url += "?title=" + _args[0] + "&id=" + _args[1] + "&page=" + _args[2];
			} else if (_contentElement == "indexTopPalettes") {
				// howMany
				_url += "?howMany=" + _args[0];
			} else if (_contentElement == "loversColours") {
				// section, id [user], howMany
				_url += "?section=" + _args[0] + "&id=" + _args[1] + "&howMany=" + _args[2];
			} else if (_contentElement == "interviewsFriendsComments") {
				// NULL, id [interview], page
				_url += "?title=" + _args[0] + "&id=" + _args[1] + "&page=" + _args[2];
			} else if (_contentElement == "blogsComments") {
				// title [desc], id [article], page
				_url += "?title=" + _args[0] + "&id=" + _args[1] + "&page=" + _args[2];
			} else if (_contentElement == "articlesComments") {
				// title, id [article], page
				_url += "?title=" + _args[0] + "&id=" + _args[1] + "&page=" + _args[2];
			} else if (_contentElement == "interviewsInterview") {
				updateIBC(_args[0],_args[1],_args[2],_args[3]);
				_url += "?name=" + _args[0] + "&intervieweeUrl=" + _args[1] + "&id=" + _args[2] + "&page=" + _args[3];
			} else if (_contentElement == "rate") {
				// contextType, contextID, score
				_url += "?contextType=" + _args[0] + "&contextID=" + _args[1] + "&score=" + _args[2];
			} else if (_contentElement == "loversPalettes") {
				// section, id [user], howMany
				_url += "?section=" + _args[0] + "&id=" + _args[1] + "&howMany=" + _args[2];
			} else if (_contentElement == "loversFavouriteLovers") {
				// userName, id [user], page
				_url += "?userName=" + _args[0] + "&id=" + _args[1] + "&page=" + _args[2];
			} else if (_contentElement == "searchColours") {
				// sortType, sortBy, query, hsb, lover, hex, page
				_url += "?sortType=" + _args[0] + "&sortBy=" + _args[1] + "&query=" + _args[2] + "&hsb=" + _args[3] + "&lover=" + _args[4] + "&page=" + _args[6];
			} else if (_contentElement == "searchPalettes") {
				// sortType, sortBy, query, hsb, lover, hex, page
				_url += "?sortType=" + _args[0] + "&sortBy=" + _args[1] + "&query=" + _args[2] + "&hsb=" + _args[3] + "&lover=" + _args[4] + "&hex=" + _args[5] + "&page=" + _args[6];
			} else if (_contentElement == "searchLovers") {
				// sortType, sortBy, query, hsb, lover, hex, page
				_url += "?sortType=" + _args[0] + "&sortBy=" + _args[1] + "&query=" + _args[2] + "&lover=" + _args[4] + "&hex=" + _args[5] + "&page=" + _args[6];
			} else if (_contentElement == "recentLovers") {
				// NULL, page
				_url += "?page=" + _args[1];
			} else if (_contentElement == "recentComments") {
				// contextType, page
				_url += "?contextType=" + _args[0] + "&page=" + _args[1];
			} else if ((_contentElement == "loversBlog1") || (_contentElement == "loversBlog2") || (_contentElement == "loversBlog3") || (_contentElement == "loversBlog4")) {
				// data, howMany
				_url += "?data=" + _args[0] + "&howMany=" + _args[1] + "&contentElement=" + _contentElement;
			} else if (_contentElement == "checkIfColoursExist") {
				// paletteColours, pickerType
				_url += "?paletteColours=" + _args[0] + "&pickerType=" + _args[1];
			} else if (_contentElement == "trendsTrends") {
				// year, month, query, hsb, trendType, page
				_url += "?year=" + _args[0] + "&month=" + _args[1] + "&query=" + _args[2] + "&hsb=" + _args[3] + "&trendType=" + _args[4] + "&page=" + _args[5];
			} else if (_contentElement == "prevCoverColours") {
				// howMany, id [trend]
				_url += "?howMany=" + _args[0] + "&id=" + _args[1];
			} else if (_contentElement == "trendsComments") {
				// title, id [trend], page
				_url += "?title=" + _args[0] + "&id=" + _args[1] + "&page=" + _args[2];
			} else if (_contentElement == "newsNews") {
				// NULL, page
				_url += "?page=" + _args[1];
			} else if (_contentElement == "blogBlog") {
				// NULL, page
				_url += "?page=" + _args[1];
			} else if (_contentElement == "addColourReference") {
				// hex
				_url += "?hex=" + _args[0];
			} else if ((_contentElement == "loverUnsubscribeAll") || (_contentElement == "loverSubscribeAll")) {
				// subscriptionContextType
				_url += "?subscriptionContextType=" + _args[0];
			} else if (_contentElement == "picturePaletteInspiration") {
				// url
				_url += "?url=" + _args[0];
			}

			if (_continue) {
				if ((_contentElement != "rate") && (_contentElement != "checkIfColoursExist") && (_contentElement != "loverUnsubscribeAll") && (_contentElement != "loverSubscribeAll") && (_contentElement != "picturePaletteInspiration")) {
					$(_contentElement).innerHTML = "<div style=\"width: 92px; height: 32px; margin: 50px auto;\"><img src=\"/images/loading.gif\" style=\"width: 92px; height: 32px;\" alt=\"Loading ...\" /></div>";
				}

				if ((_contentElement == "loverUnsubscribeAll") || (_contentElement == "loverSubscribeAll")) {
					var _subscriptionAction = (_contentElement == "loverUnsubscribeAll") ? "u" : "s";
					var _text = (_contentElement == "loverUnsubscribeAll") ? "Unsubscribing" : "Subscribing";
					$("d" + _args[0] + "s_" + _subscriptionAction + "a").innerHTML = (_text + " ...");
				}

				if (_registerNewPageView) {
					// Tell Google that we have another page view //
					try {
						urchinTracker(_url);
					} catch (_e) {}
				}
				if (window.XMLHttpRequest) {
					_httpSocket.onreadystatechange = this.xmlhttpChange;
					_httpSocket.open(_method,_url,true);
					_httpSocket.send(null);
				} else if (window.ActiveXObject) {
					if (_httpSocket) {
						_httpSocket.onreadystatechange = this.xmlhttpChange;
						_httpSocket.open(_method,_url,true);
						_httpSocket.send();
					}
				}
			}
		}

		// AJAX Listener //
		this.xmlhttpChange = function() {
			if (_httpSocket.readyState == 4) {
				var _responseArray = [], _alertText, _ns = [];
				var _responseText = _httpSocket.responseText;
				var _PFSResponseType = _httpSocket.getResponseHeader("PFSResponseType");

				// IE seems to think this is a static object, I think not //
				if (_isIE) {
					_httpSocket.abort();
				}

				if (_PFSResponseType == "rate") {
					_responseArray = _responseText.split("|");

					if (_responseArray[0] == "login") {
						window.location.href = "/login?referer=" + _responseArray[1];
					} else if (_responseArray[0] == "alert") {
						if (_responseArray[1] == "priorVote") {
							_alertText = "You have already voted for this Palette / Color.\nYou can vote again next month.";
						} else if (_responseArray[1] == "noCP") {
							_alertText = "ERROR => Color / Palette does not exist!";
						} else if (_responseArray[1] == "invalidScore") {
							_alertText = "Score was out of range!";
						} else if (_responseArray[1] == "invalidContextType") {
							_alertText = "ERROR => Bad `contextType`.";
						}
						alert(_alertText);
					} else if (_responseArray[0] == "success") {
						_ns = eval(_responseArray[1]);
						$("rateNumVotes").innerHTML = _ns[0];
						$("rateScore").innerHTML = _ns[1];
					}
				} else if ((_PFSResponseType == "loverUnsubscribeAll") || (_PFSResponseType == "loverSubscribeAll")) {
					if (_responseText == "login") {
						window.location.href = "/login"; // Just in case their session times out //
					} else if (_responseText != "") {
						_responseArray = _responseText.split("|");
						if (_responseArray[0]) {
							var _subscriptionAction = (_PFSResponseType == "loverUnsubscribeAll") ? "u" : "s";
							var _text = (_PFSResponseType == "loverUnsubscribeAll") ? "Unsubscribed!" : "Subscrition[s] Confirmed";
							$("d" + _responseArray[1] + "s_" + _subscriptionAction + "a").innerHTML = _text;
						}
					} else {
						alert("Bad subscriptionContextType");
					}
				} else if (_PFSResponseType == "checkIfColoursExistP") {
					_coloursChecked = true;
					_newColours = _responseText;
					addPalette();
				} else if (_PFSResponseType == "checkIfColoursExistC") {
					_coloursChecked = true;

					if (_responseText == "ce") {
						_colourExists = true;
					} else if (_responseText == "cdne") {
						_colourExists = false;
					}
					addColour();
				} else if (_PFSResponseType == "picturePaletteInspiration") {
					if (_responseText == "badimg") {
						$("picturePaletteInspirationInnerDiv").innerHTML = "<div style=\"color: #d40000; margin-top: 50px;\"><strong>ERROR:</strong> The URL you provided is invalid.</div>";
					} else {
						_responseText = _responseText.split("|");

						$("picturePaletteInspirationInnerDiv").innerHTML = "";
						for (_i=0;_i<_responseText.length;_i++) {
							$("picturePaletteInspirationInnerDiv").innerHTML += "<a href=\"JavaScript:updateHexDiv('" + _responseText[_i] + "');%20setHex(_currentColourDiv);\" style=\"background-color: #" + _responseText[_i] + ";\" title=\"#" + _responseText[_i] + "\"></a>";
						}
					}
				} else {
					$(_PFSResponseType).innerHTML = _responseText;
				}
			}
		}
	}

	buildRequest = function(_contentElement,_args) {
		(new httpRequest()).sendRequest(_contentElement,_args,true);
	}

	goToAnchor = function(_anchor) {
		window.location.href = ((/^([^#]+)#?(.*)?$/.exec(window.location.href))[1] + "#" + _anchor);
	}

	rotatePalette = function(_args) {
		_paletteAngle += 1;
		if (_paletteAngle == 4) {
			_paletteAngle = 0;
		}
		$("paletteImg").src = ("/paletteImg/" + _args + "?angle=" + _paletteAngle);
	}

	getPicturePaletteInspirationColors = function() {
		var _url = $("picturePaletteInspiration").value;
		if ((_url.indexOf("http://") != -1) || (_url.indexOf("https://") != -1)) {
			$("picturePaletteInspirationImg").src = ("/srcImg/" + _url.base64_encode());
			$("picturePaletteInspirationInnerDiv").innerHTML = "<div style=\"width: 92px; height: 32px; margin: 50px auto;\"><img src=\"/images/loading.gif\" style=\"width: 92px; height: 32px;\" alt=\"Loading ...\" /></div>";
			$("picturePaletteInspirationTable").style.display = "block";
			buildRequest("picturePaletteInspiration",[_url]);
		} else {
			alert("Please enter a valid URL!\n\nFor Example: http://www.colourlovers.com/images/logo.png");
			$("picturePaletteInspiration").focus();
		}
	}

	rmLoveNoteConf = function(_amt) {
		var _go = false;
		if (_amt == 1) {
			_go = confirm("Are you sure you want to Delete this Love Note?");
		} else {
			_go = confirm("Are you sure you want to Delete these Love Notes?");
		}
		if (_go) {
			$("remLoveNotesForm").submit();
		}
	}

	toggleAll = function(_checked) {
		if (_isLoaded) {
			for (_i=0;_i<_numCheckboxes;_i++) {
				$("cb" + _i).checked = _checked;
			}
		}
	}

	setCaret = function(_elementID,_position) {
		if ($(_elementID).createTextRange) {
			var _range = $(_elementID).createTextRange();
			_range.move("character",_position);
			_range.select();
		} else if ($(_elementID).selectionStart) {
			$(_elementID).setSelectionRange(_position,_position);
		}
	}

	clearRadios = function(_groupName) {
		var _radios = document.getElementsByName(_groupName);
		for (_i=0;_i<_radios.length;_i++) {
			_radios[_i].checked = false;
		}
	}

	// Build search request //
	submitComment = function (_commentsID,_title,_contextType,_contextID) {
		// Get comments //
		_comments = $("ajaxComments").value.replace(/\n/g,"__CL_NEWLINE_CHAR_0192837465__");
		if (_comments != "") {
			// Hide form //
			toggleDisplay("commentsDiv");
			// Clear comments //
			$("ajaxComments").value = "";
			// Send request //
			(new httpPost()).sendRequest("addComment",[_commentsID,_title,_contextType,_contextID,_comments],true);
		}
		return false;
	}

	// Show reply form //
	loveNoteReply = function() {
		toggleDisplay("replyDiv","block");
		$("loveNoteReply").focus();
		setCaret("loveNoteReply",0);
		toggleDisplay("loveNoteReplyBtn","none");
		toggleDisplay("loveNoteSendBtn","inline");
	}

	// Rating object //
	rateObject = function(_rateName,_contextType,_contextID) {
		this._rateName = _rateName;
		this._heartTimer = null;
		this._numHearts = 0;
		this._canAni = true;
		this._contextType = _contextType;
		this._contextID = _contextID;

		// pre-fetch image
		(new Image()).src = "/images/hearts/halfOnWhite.png";
		(new Image()).src = "/images/hearts/fullOnWhite.png";
		(new Image()).src = "/images/hearts/emptyOnWhite.png";

		this.showHearts = function(_heartNum) {
			this.clearHeartTimer();
			this.greyHearts();
			this.colorHearts(_heartNum);
		}

		this.colorHearts = function(_heartNum) {
			var _hURL = "";
			if (this._canAni) {
				for (_i=0;_i<_heartNum;_i++) {
					if ((_heartNum + 1) > _i) {
						_hURL = (_heartNum == (_i + 0.5)) ? "halfOnWhite.png" : "fullOnWhite.png";
					} else {
						_hURL = "emptyOnWhite.png";
					}

					$("heart" + (_i + 1)).src = ("/images/hearts/" + _hURL);
				}
			}
		}

		this.greyHearts = function() {
			if (this._canAni) {
				for (_i=0;_i<5;_i++) {
					$("heart" + (_i + 1)).src = "/images/hearts/emptyOnWhite.png";
				}
			}
		}

		this.setHearts = function(_heartNum) {
			this._numHearts = _heartNum;
			this.drawHearts(_heartNum);
			this._canAni = false;
			this.setHearts = function(){};
			buildRequest("rate",[this._contextType,this._contextID,((_heartNum * 2) - 1)])
		}

		this.drawHearts = function(_heartNum) {
			this._numHearts = _heartNum;
			this.showHearts(_heartNum);
		}

		this.clearHearts = function() {
			this._heartTimer = setTimeout(this._rateName + ".resetHearts()",200);
		}

		this.resetHearts = function() {
			this.clearHeartTimer();

			if (this._numHearts) {
				this.drawHearts(this._numHearts);
			} else {
				this.greyHearts();
			}
		}

		this.clearHeartTimer = function() {
			if (this._heartTimer) {
				clearTimeout(this._heartTimer);
				this._heartTimer = null;
			}
		}
	}

	updateIBC = function(_interviewee,_intervieweeUrl,_id,_page) {
		_interviewee = _interviewee.replace("+"," ");
		var _html = "&nbsp;<a href=\"/interviews\">Interviews</a>&nbsp;&nbsp;&gt;&nbsp;&nbsp;<a href=\"/interview/" + _id + "/1/" + _intervieweeUrl + "\">" + _interviewee + "</a>"
		if (_page > 1) {
			_html += "&nbsp;&nbsp;&gt;&nbsp;&nbsp;Page&nbsp;" + _page;
		}
		$("interviewsBreadcrumbs").innerHTML = _html;
	}

	// Build search request //
	buildSearchRequest = function () {
		var _args = [], _hsb = _PFSResponseType = _type = "", _attributes = ["red","orange","yellow","green","aqua","blue","violet","fuchsia","black","white","gray","warm","cool","dark","light","bright","neutral"];
		if ($("page").value == "c") {
			_PFSResponseType = "searchColours";
			for (_i=0;_i<_attributes.length;_i++) {
				if ($(_attributes[_i]).checked) {
					_hsb += (_attributes[_i] + "|");
				}
			}
			_hsb = _hsb.substr(0,(_hsb.length - 1));
			_type = "colours";
		} else if ($("page").value == "l") {
			_PFSResponseType = "searchLovers";
			_type = "lovers";
		} else {
			_PFSResponseType = "searchPalettes";
			_type = "palettes";
		}
		var _sortType = $("sortType").value;
		var _sortBy = $("sortBy").value;
		var _query = $("query").value;
		var _lover = $("lover").value;
		var _hex = $("hex").value;
		_args = [_sortType,_sortBy,_query,_hsb,_lover,_hex,1];

		(new httpRequest()).sendRequest(_PFSResponseType,_args,true);
		updateSearchLink(_sortType,_sortBy,_query,_hsb,_lover,_hex,1,_type);
		return false;
	}

	// Build search request //
	buildTrendRequest = function () {
		var _args = [], _hsb = "", _attributes = ["red","orange","yellow","green","aqua","blue","violet","fuchsia","black","white","gray"];
		for (_i=0;_i<_attributes.length;_i++) {
			if ($(_attributes[_i]).checked) {
				_hsb += (_attributes[_i] + "|");
			}
		}
		_hsb = _hsb.substr(0,(_hsb.length - 1));
		_month = $("month").value;
		_year = $("year").value;
		_query = $("query").value;
		_trendType = $("trendType").value;
		_args = [_year,_month,_query,_hsb,_trendType,1];

		(new httpRequest()).sendRequest("trendsTrends",_args,true);
		updateTrendsLink(_year,_month,_query,_hsb,_trendType,1);
		return false;
	}

	// Update Search Link //
	updateSearchLink = function(_sortType,_sortBy,_query,_hsb,_lover,_hex,_page,_type) {
		_searchLink = "<a href=\"/" + _type + "/search?";
		_searchLink += (_sortType) ? "sortType=" + _sortType + "&" : "";
		_searchLink += (_sortBy) ? "sortBy=" + _sortBy + "&" : "";
		_searchLink += (_query) ? "query=" + _query + "&" : "";
		_searchLink += (_hsb) ? "hsb=" + _hsb + "&" : "";
		_searchLink += (_lover) ? "lover=" + _lover + "&" : "";
		_searchLink += (_hex) ? "hex=" + _hex + "&" : "";
		_searchLink += (_page) ? "page=" + _page + "&" : "";
		$("searchLink").innerHTML = _searchLink.substr(0,(_searchLink.length - 1)) + "\" class=\"h2\" style=\"text-decoration: none;\">Link to this page</a>";
	}

	// Update Search Link //
	updateTrendsLink = function(_month,_year,_query,_hsb,_trendType,_page) {
		_searchLink = "<a href=\"/trends/" + _trendType + "?";
		_searchLink += (_year) ? "year=" + _year + "&" : "";
		_searchLink += (_month) ? "month=" + _month + "&" : "";
		_searchLink += (_query) ? "query=" + _query + "&" : "";
		_searchLink += (_hsb) ? "hsb=" + _hsb + "&" : "";
		_searchLink += (_trendType) ? "trendType=" + _trendType + "&" : "";
		_searchLink += (_page) ? "page=" + _page + "&" : "";

		$("searchLink").innerHTML = _searchLink.substr(0,(_searchLink.length - 1)) + "\" class=\"h2\" style=\"text-decoration: none;\">Link to this page</a>";
	}

	confRemAvatar = function() {
		if (confirm("Are you sure you want to remove your Avatar?")) {
			window.location.href = "/op/remAvatar";
		}
	}

	confRemPicture = function() {
		if (confirm("Are you sure you want to remove your Picture?")) {
			window.location.href = "/op/remPicture";
		}
	}

	// Show subNav //
	showSubNav = function(_elementID) {
		_wait = 0;
		if (_canAni == "show") {
			if ($("subNavContainer").style.height != "22px") {
				_canAni = "";
				for (_i=0;_i<_incArrayMenu.length;_i++) {
					setTimeout("aniSubNav(" + _incArrayMenu[_i] + "," + _incArrayUL[_i] + ")",(_animateBy * _i));
				}
				$("subNavContainer").style.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++) {
			$("subNav" + _i).style.display = "none";
		}
		$("sub" + _elementID).style.display = "block";
	}

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

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

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

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

	// Grunt work of the menu animation, called from timeouts //
	aniSubNav = function(_howMuchMenu,_howMuchUL) {
		$("subNavContainer").style.height = _howMuchMenu + "px";
		$("navUL").style.paddingTop = _howMuchUL + "px";
	}

	// 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 //
			$("Nav" + _i).style.background = "url(images/navSep.png) right no-repeat";
			$("Nav" + _i).style.color = "#515151";
		}
		if (_elementID) {
			// See .nav li a:hover in ./global.css for values //
			$(_elementID).style.background = "#4e4e4e url(images/navSep.png) right no-repeat";
			$(_elementID).style.color = "#ffffff";
		}
	}

	// 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(_elementID,_flow) {
		$(_elementID).style.display = (_flow) ? _flow : "none";
	}

	// Echoes an eMail address //
	echoEmail = function(_user,_domain) {
		var _link = _user + "@" + _domain;
		document.write("<a href=\"mailto:" + _link + "\" style=\"text-decoration: underline;\">" + _link + "</a>");
	}

	// Verify object //
	objectVerify = function() {
		_elements = new Array;
		this._i = 0;

		this.addElement = function(_elementID,_vType,_errMsg) {
			_elements[this._i] = [_elementID,_vType,_errMsg];
			this._i++;
		}

		this.getElement = function(_elementID) {
			return _elements[_elementID];
		}
	}

	// Form verification //
	verifyByObject = function(_vO,_submitBtnText,_submitBtnID) {
		var _vO = eval(_vO), _submitForm = true, _submitBtn = "", _i, _vField, _vType, _msg = "";
		var _errMsg = "Please Fill out all required fields";
		_submitBtnID = (_submitBtnID) ? _submitBtnID : "submitBtn";

		for (_i=0;_i<_vO._i;_i++) {
			if (_vField = $(_vO.getElement(_i)[0])) {
				if (!_vField.disabled) {
					_vType = _vO.getElement(_i)[1];
					_vErrMsg = _vO.getElement(_i)[2];
					_vField.style.borderColor = "";

					// eMail verification //
					if (_vType == "eMail") {
						if (_vField.value.match(/[a-zA-Z0-9._%-]+@[a-zA-Z0-9._%-]+\.[a-zA-Z]{2,4}/) != _vField.value) {
							_submitForm = false;
							_vField.style.borderColor = "#ff0000";
							_msg = (_msg != _errMsg) ? "Value must be an eMail Address\nex: User@Domain.com" : _msg;
						}
					// Zip code verification //
					} else if (_vType == "zip") {
						if (_vField.value.match(/[0-9]{5}/) != _vField.value) {
							_submitForm = false;
							_vField.style.borderColor = "#ff0000";
							_msg = (_msg != _errMsg) ? "Value must be a Zip Code\nex: 97220" : _msg;
						}
					// "checked" verification //
					} else if (_vType == "checked") {
						if (!_vField.checked) {
							_submitForm = false;
							_msg = (_msg != _errMsg) ? _vErrMsg : _msg;
						}
					// Numerical verification //
					} else if (_vType == "numeric") {
						if (isNaN(_vField.value) || (_vField.value == "")) {
							_submitForm = false;
							_vField.style.borderColor = "#ff0000";
							_msg = (_msg != _errMsg) ? "Value must be a Number\nex: 1219" : _msg;
						}
					// Check multiple checkboxes for "checked", at least one must be checked //
					} else if (_vType == "multChecked") {
						var _j, _checkArray = _vErrMsg, _checkCount = 0;

						for (_j=1;_j<_checkArray.length;_j++) {
							if ($(_checkArray[0] + _checkArray[_j]).checked) {
								_checkCount++;
							}
						}

						if (_checkCount == 0) {
							_submitForm = false;
							_msg = (_msg != _errMsg) ? _oErrMsg : _msg;
						}
					// Check if given select's selected element's value is not "" //
					} else if (_vType == "select") {
						if (_vField.options[_vField.selectedIndex].value == "") {
							_submitForm = false;
							_vField.style.borderColor = "#ff0000";
							_msg = (_msg != _errMsg) ? _vErrMsg : _msg;
						}
					// Checks two password fields //
					} else if (_vType == "passwd") {
						var _checkArray = _vErrMsg, _badPasswd = false;
						_badPasswd = ($(_checkArray[2]).value != $(_checkArray[3]).value) ? true : _badPasswd;
						_badPasswd = ($(_checkArray[2]).value.length < _checkArray[1]) ? true : _badPasswd;
						_badPasswd = ($(_checkArray[3]).value.length < _checkArray[1]) ? true : _badPasswd;
						_badPasswd = ($(_checkArray[3]).value.search(/[0-9]/) == -1) ? true : _badPasswd;
						_badPasswd = ($(_checkArray[3]).value.search(/[a-zA-Z]/) == -1) ? true : _badPasswd;
						if (_badPasswd) {
							_submitForm = false;
							$(_checkArray[2]).style.borderColor = "#ff0000";
							$(_checkArray[3]).style.borderColor = "#ff0000";
							_msg = (_msg != _errMsg) ? _checkArray[0] : _msg;
						} else {
							$(_checkArray[2]).style.borderColor = "";
							$(_checkArray[3]).style.borderColor = "";
						}
					// Verify userName //
					} else if (_vType == "userName") {
						var _regEx = /[^\w!\*\-: ,@.()`^[\]{}~]/ig;
						if ((_vField.value.replace(_regEx,"") != _vField.value) || (_vField.value == "")) {
							_vField.style.borderColor = "#ff0000";
							_submitForm = false;
							_msg = (_msg != _errMsg) ? _vErrMsg : _msg;
						}
					// Radio verification //
					} else if (_vType == "radio") {
						var _j, _checkArray = _vErrMsg, _checkCount = 0;

						for (_j=0;_j<_checkArray.length;_j++) {
							if ($(_checkArray[_j]).checked) {
								_checkCount++;
							}
						}

						if (_checkCount == 0) {
							_submitForm = false;
							_msg = (_msg != _errMsg) ? _oErrMsg : _msg;
						}
					// Hex verification //
					} else if (_vType == "colorHex") {
						if (!isHex(_vField.value)) {
							_vField.style.borderColor = "#ff0000";
							_submitForm = false;
							_msg = (_msg != _errMsg) ? "Value must be a valid Hex\nex: FF33CC" : _msg;
						}						
					// Flickr ID verification //
					} else if (_vType == "flickrID") {
						if ((_vField.value.match(/[0-9A-Z@]+/) != _vField.value) && (_vField.value != "")) {
							_submitForm = false;
							_vField.style.borderColor = "#ff0000";
							_msg = (_msg != _errMsg) ? "Value must be a valid Flickr ID\nex: 41434087@N00" : _msg;
						}
					} else if (_vField.value == "") {
						_submitForm = false;
						_vField.style.borderColor = "#ff0000";
						_msg = _errMsg;
					}
				}

			} else {
				window.alert("'" + _vO.getElement(_i)[0] + "' does not exist.");
			}
		}

		if (_submitForm == true) {
			if (_submitBtn = $(_submitBtnID)) {
				_submitBtn.disabled = true;
				_submitBtn.value = _submitBtnText;
			}
			return true;
		} else {
			window.alert(_msg);
			return false;
		}
	}

	/*********************\
	|  base64 Functions  |
	\*********************/

	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;
	}

	// Custom //
	addEngine = function() {
		if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function")) {
			window.sidebar.addSearchEngine("http://www.COLOURlovers.com/firefox/COLOURlovers.src","http://www.COLOURlovers.com/firefox/COLOURlovers.png","COLOURlovers","COLOURlovers Palette Search");
		} else {
			alert("The Firefox browser is required to install this plugin.");
		}
	}

	addEngine2 = function() {
		if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function")) {
			window.sidebar.addSearchEngine("http://www.COLOURlovers.com/firefox/COLOURlovers_hex.src","http://www.COLOURlovers.com/firefox/COLOURlovers.png","COLOURlovers hex","COLOURlovers Palette HEX Search");
		} else {
			alert("The Firefox browser is required to install this plugin.");
		}
	}

	init();
