// JavaScript Document
	// 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,10,17,21,23], _incArrayUL = [57,47,40,36,34], _incArrayMenuH = [23,21,17,10,0], _incArrayULH = [34,36,40,47,57];
	var _currentPage = "", _timeout = {};

	showHoverInfo = function(){}
	hideHoverInfo = function(){}

	getS3URL = function(_url) {
		return "http://colourlovers.com.s3.amazonaws.com" + _url;
	}

	$S = function(_elementID) {
		return ($(_elementID)) ? $(_elementID).style : false;
	}

	// 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;
	}

	// 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;
		}

		try {
			initLightbox();
		} catch (_e) {}

		setNavEvents();

		_isLoaded = true;
	}

	setNavEvents = function() {
		$("nav").onmouseover = function() {menuOver();};
		$("nav").onmouseout = function() {menuOut();};
		$("Nav0").onmouseover = function() {highlightNav("Nav0"); hideSubNav();};
		$("Nav0").onmouseout = function() {highlightNav();};
		$("Nav1").onmouseover = function() {highlightNav("Nav1"); hideSubNav();};
		$("Nav1").onmouseout = function() {highlightNav();};
		$("Nav2").onmouseover = function() {showSubNav("Nav2");};
		$("Nav3").onmouseover = function() {highlightNav("Nav3"); hideSubNav();};
		$("Nav3").onmouseout = function() {highlightNav();};
		$("Nav4").onmouseover = function() {highlightNav("Nav4"); hideSubNav();};
		$("Nav4").onmouseout = function() {highlightNav();};
		$("Nav5").onmouseover = function() {highlightNav("Nav5"); hideSubNav();};
		$("Nav5").onmouseout = function() {highlightNav();};
		$("Nav6").onmouseover = function() {highlightNav("Nav6"); hideSubNav();};
		$("Nav6").onmouseout = function() {highlightNav();};
	}

	// 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";
		}
	}

	// Check teatarea length //
	checkTALen = function(_elementID,_length) {
		var _taLength = $(_elementID).value.length;
		if (_isIE6) {
			$(_elementID + "count").innerText = ((_length - _taLength) + " Characters Left");
		} else {
			$(_elementID + "count").innerHTML = ((_length - _taLength) + " Characters Left");
		}

		if (_taLength > _length) {
			$(_elementID).value = $(_elementID).value.substr(0,_length);
			if (_isIE6) {
				$(_elementID + "count").innerText = "0 Characters Left";
			} else {
				$(_elementID + "count").innerHTML = "0 Characters Left";
			}
		}
	}

	getSpace = function(_x,_y) {
		return "<img src=\"" + getS3URL("/images/spacer.png") + "\" style=\"width: " + _x + "px; height: " + _y + "px; border: 0px;\" alt=\" \" />";
	}

	absPos = function(_object) {
		var r = {
			x : _object.offsetLeft,
			y : _object.offsetTop
		};
		if (_object.offsetParent) {
			var v = absPos(_object.offsetParent);
			r.x += v.x;
			r.y += v.y;
		}
		return r;
	}

	patternImgDetail = function(_patternID) {
		var _pageSize = getPageSize();
		$S("clOverlayContent").background = "transparent url(" + getS3URL("/images/patterns/" + parseInt(_patternID / 1000) + "/" + _patternID + ".png?" + (new Date()).getTime().toString()) + ") center center";
		$S("clOverlayContent").width = (_pageSize[2] - 150) + "px";
		$S("clOverlayContent").height = (_pageSize[3] - 150) + "px";
		$("clOverlayContent").onclick = hideOverlay;
		showOverlay([(_pageSize[2] - 150),(_pageSize[3] - 150)]);
	}

	suggestTrend = function() {
		var _absPos = absPos($("suggestTrendBtn"));
		$S("suggestTrendDiv").top = ((_absPos.y + 21) + "px");
		$S("suggestTrendDiv").left = ((_absPos.x - 117) + "px");
		$S("suggestTrendDiv").display = "block";
	}


// Overlay //
	showOverlay = function(_overlayContentDimensions) {
		var _pageSize = getPageSize();
		_lastOverlayDimensions = _overlayContentDimensions;
		$S("clOverlay").height = (_pageSize[1] + "px");
		$S("clOverlay").display = "block";

		var _overlayContentTop = (getPageScroll()[1] + ((_pageSize[3] - _overlayContentDimensions[1] - 20) / 2)); // -20 for border
		var _overlayContentLeft = ((_pageSize[0] - _overlayContentDimensions[0] - 20) / 2); // -20 for border

		$S("clOverlayContent").top = (_overlayContentTop < 0) ? "0px" : _overlayContentTop + "px";
		$S("clOverlayContent").left = (_overlayContentLeft < 0) ? "0px" : _overlayContentLeft + "px";
		$S("clOverlayContent").display = "block";
		$S("clOverlay").height = (getPageSize()[1] + "px");
	}

	hideOverlay = function() {
		$S("clOverlay").display = "none";
		$S("clOverlayContent").display = "none";
	}


	modComment = function(_commentType,_commentID,_commentI) {
		if (_isLoaded) {
			var _modDiv = $(_commentType + "_cm_" + _commentID);
			var _comment = _modDiv.innerHTML.replace(/__CL_LESSTHAN__/g,"<").replace(/__CL_GREATERTHAN__/g,">");
			var _textareaID = ("comments" + _commentType + _commentID + _commentI);
			_modDiv.innerHTML = "";

			var _modCommentForm = document.createElement("form");
			_modCommentForm.setAttribute("action","/op/modComment");
			_modCommentForm.setAttribute("method","post");
			_modDiv.insertBefore(_modCommentForm,_modDiv.firstChild);

			var _submitBtn = document.createElement("input");
			_submitBtn.setAttribute("type","image");
			_submitBtn.setAttribute("class","outline");
			_submitBtn.setAttribute("src",getS3URL("/images/v3/btn/submit.png"));
			_modCommentForm.insertBefore(_submitBtn,_modCommentForm.firstChild);

			var _commentTextarea = document.createElement("textarea");
			_commentTextarea.setAttribute("name","comments");
			_commentTextarea.setAttribute("id",_textareaID);
			_commentTextarea.onselect = new Function("storeCaret($('" + _textareaID + "'));");
			_commentTextarea.onclick = new Function("storeCaret($('" + _textareaID + "'));");
			_commentTextarea.onkeyup = new Function("storeCaret($('" + _textareaID + "'));");
			_commentTextarea.onchange = new Function("storeCaret($('" + _textareaID + "'));");
			_commentTextarea.className = "formElement";
			if (_commentType == "for") {
				_commentTextarea.style.width = "399px";
			} else if (_commentType == "gro") {
				_commentTextarea.style.width = "405px";
			} else if ((_commentType == "tc") || (_commentType == "wtc") || (_commentType == "ccc")) {
				_commentTextarea.style.width = "404px";
			} else if ((_commentType == "cfc") || (_commentType == "pfc") || (_commentType == "lfc") || (_commentType == "nfc")) {
				_commentTextarea.style.width = "305px";
			}
			_commentTextarea.style.height = "120px";
			_commentTextarea.style.marginBottom = "10px";
			_modCommentForm.insertBefore(_commentTextarea,_modCommentForm.firstChild);
			_commentTextarea.value = _comment;

			var _bbDiv = document.createElement("div");
			_bbDiv.style.marginBottom = "5px";
			_bbDiv.className = "htmlBar";
			_bbDiv.innerHTML = "<a onclick=\"fmtTxt('" + _textareaID + "','<strong>','</strong>');\"><img src=\"" + getS3URL("/images/v3/btn/html/bold.png") + "\" alt=\"Bold\" title=\"Bold\" /></a>";
			_bbDiv.innerHTML += "<a onclick=\"fmtTxt('" + _textareaID + "','<em>','</em>');\"><img src=\"" + getS3URL("/images/v3/btn/html/italic.png") + "\" alt=\"Italic\" title=\"Italic\" /></a>";
			_bbDiv.innerHTML += "<a onclick=\"fmtTxtUnderline('" + _textareaID + "');\"><img src=\"" + getS3URL("/images/v3/btn/html/underline.png") + "\" alt=\"Underline\" title=\"Underline\" /></a>";
			_bbDiv.innerHTML += "<a onclick=\"fmtTxtImage('" + _textareaID + "');\"><img src=\"" + getS3URL("/images/v3/btn/html/image.png") + "\" alt=\"Insert Image\" title=\"Insert Image\" /></a>";
			_bbDiv.innerHTML += "<a onclick=\"fmtTxtURL('" + _textareaID + "');\"><img src=\"" + getS3URL("/images/v3/btn/html/url.png") + "\" alt=\"Insert Link\" title=\"Insert Link\" /></a>";
			_bbDiv.innerHTML += "<a onclick=\"fmtTxt('" + _textareaID + "','<blockquote>','</blockquote>');\"><img src=\"" + getS3URL("/images/v3/btn/html/blockquote.png") + "\" alt=\"Quote\" title=\"Quote\" /></a>";
			_bbDiv.innerHTML += "<div style=\"display: inline; margin-left: 10px; vertical-align: 50%; color: #aaaaaa;\">Some HTML OK</div>\n";
			_modCommentForm.insertBefore(_bbDiv,_modCommentForm.firstChild);

			var _commentIDInput = document.createElement("input");
			_commentIDInput.setAttribute("type","hidden");
			_commentIDInput.setAttribute("name","commentID");
			_commentIDInput.setAttribute("value",_commentID);
			_modCommentForm.insertBefore(_commentIDInput,_modCommentForm.firstChild);

			var _commentTypeInput = document.createElement("input");
			_commentTypeInput.setAttribute("type","hidden");
			_commentTypeInput.setAttribute("name","commentType");
			_commentTypeInput.setAttribute("value",_commentType);
			_modCommentForm.insertBefore(_commentTypeInput,_modCommentForm.firstChild);

			$(_commentType + "_mc_" + _commentID).style.display = "none";
			$(_commentI).style.display = "none";
			_modDiv.style.display = "block";
			_commentTextarea.focus();
			goToAnchor(_commentI);
		}
	}

	getLoadingFlash = function() {
		var _str = "<div style=\"text-align: center;\">";
			_str += "<!--[if !IE]> -->";
				_str += "<object type=\"application/x-shockwave-flash\" data=\"" + getS3URL("/images/v3/loading.swf") + "\" width=\"50\" height=\"50\">";
			_str += "<!-- <![endif]-->";

			_str += "<!--[if IE]>";
				_str += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"50\" height=\"50\">";
				_str += "<param name=\"movie\" value=\"" + getS3URL("/images/v3/loading.swf") + "\" />";
				_str += "<!--><!--dgx-->";
			_str += "<param name=\"loop\" value=\"true\" />";
			_str += "<param name=\"wmode\" value=\"transparent\" />";
			_str += "<param name=\"menu\" value=\"false\" />";
			_str += "</object>";
			_str += "<!-- <![endif]-->";
		return _str += "</div>\n";
	}

	httpPost = function() {
		var _httpPostSocket;
		// Send request //
		this.sendRequest = function(_contentElement,_args) {
			var _url = ("/ajax/" + _contentElement), _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, contextType, contextID, comments
				var _comments = _args[3];
				_postArgs += "commentsID=" + _args[0] + "&contextType=" + _args[1] + "&contextID=" + _args[2] + "&comments=" + _args[3];
			} else if (_contentElement == "saveCopaso") {
				// copasoMeta, paletteMeta, copasoPaletteID, paletteID
				_url += "?copasoMeta=" + _args[0] + "&paletteMeta=" + _args[1] + "&copasoPaletteID=" + _args[2] + "&paletteID=" + _args[3];
			} else if (_contentElement == "publishCopaso") {
				// copasoMeta, paletteMeta, copasoPaletteID, _paletteID, _nonExistentColorNamesList, _nonExistentColorHexsList
				_url += "?copasoMeta=" + _args[0] + "&paletteMeta=" + _args[1] + "&copasoPaletteID=" + _args[2] + "&paletteID=" + _args[3] + "&nonExistentColorNamesList=" + _args[4] + "&nonExistentColorHexsList=" + _args[5];
			}

			// Tell Google that we have another page view //
			try {
				urchinTracker(_url);
			} catch (_e) {}
			if (window.XMLHttpRequest) {
				_httpPostSocket.onreadystatechange = this.xmlhttpChange;
				_httpPostSocket.open("POST",_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("POST",_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);
					}
				} else if (_PFSResponseType == "saveCopaso") {
					saveCopasoResponse(_responseText);
				} else if (_PFSResponseType == "publishCopaso") {
					publishCopasoResponse(_responseText);
				}
			}
		}
	}

	// 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";
			} else if ((_contentElement == "loversFeaturedPCN1") || (_contentElement == "loversFeaturedPCN2") || (_contentElement == "loversFeaturedPCN3")) {
				_url = "/ajax/loversFeaturedPCN";
			} else {
				_url = ("/ajax/" + _contentElement);
			}

			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") {
				// userID, page
				_url += "?id=" + _args[0] + "&page=" + _args[1];
			} else if (_contentElement == "loversFlickr") {
				// flickrID, howMany
				_url += "?flickrID=" + _args[0] + "&howMany=" + _args[1];
			} else if (_contentElement == "loversWhoLoves") {
				// id [user], page
				_url += "?id=" + _args[0] + "&page=" + _args[1];
			} 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], groupID
				_url += "?howMany=" + _args[0] + "&hue=" + _args[1] + "&lover=" + _args[2] + "&groupID=" + _args[3];
			} else if (_contentElement == "similarColours") {
				// howMany, hue
				_url += "?howMany=" + _args[0] + "&hue=" + _args[1];
			} else if (_contentElement == "indexRandPalettes") {
				// howMany, lover [id], groupID
				_url += "?howMany=" + _args[0] + "&lover=" + _args[1] + "&groupID=" + _args[2];
			} else if (_contentElement == "indexRandPatterns") {
				// howMany, lover [id], groupID
				_url += "?howMany=" + _args[0] + "&lover=" + _args[1] + "&groupID=" + _args[2];
			} else if (_contentElement == "loversGroups") {
				// userID, page
				_url += "?userID=" + _args[0] + "&page=" + _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") {
				// id [colour], page
				_url += "?id=" + _args[0] + "&page=" + _args[1];
			} else if (_contentElement == "myComments") {
				// id [user], page
				_url += "?id=" + _args[0] + "&page=" + _args[1];
			} else if (_contentElement == "coloursWhoLoves") {
				// id [colour], page
				_url += "?id=" + _args[0] + "&page=" + _args[1];
			} else if (_contentElement == "groupMembers") {
				// groupID, page
				_url += "?groupID=" + _args[0] + "&page=" + _args[1];
			} else if (_contentElement == "palettesInColours") {
				// id [palette], howMany
				_url += "?id=" + _args[0] + "&howMany=" + _args[1];
			} else if (_contentElement == "palettesWhoLoves") {
				// id [palette], page
				_url += "?id=" + _args[0] + "&page=" + _args[1];
			} else if (_contentElement == "patternsInColours") {
				// patternID, howMany
				_url += "?patternID=" + _args[0] + "&howMany=" + _args[1];
			} else if (_contentElement == "patternsWhoLoves") {
				// patternID, page
				_url += "?patternID=" + _args[0] + "&page=" + _args[1];
			} else if (_contentElement == "patternComments") {
				// patternID, page
				_url += "?patternID=" + _args[0] + "&page=" + _args[1];
			} else if (_contentElement == "patternCategorySearchResponse") {
				// patternCategoryID, patternCategoryOrderBy, page
				_url += "?patternCategoryID=" + _args[0] + "&patternCategoryOrderBy=" + _args[1] + "&page=" + _args[2];
			} else if (_contentElement == "searchPatterns") {
				// sortType, sortBy, query, hsb, lover, hex, hueOption0, hueOption1, hueOption2, f, patternDefinitionID, page
				_url += "?sortType=" + _args[0] + "&sortBy=" + _args[1] + "&query=" + _args[2] + "&hsb=" + _args[3] + "&lover=" + _args[4] + "&hex=" + _args[5] + "&hueOption0=" + _args[6] + "&hueOption1=" + _args[7] + "&hueOption2=" + _args[8] + "&f=" + _args[9] + "&patternDefinitionID=" + _args[10] + "&page=" + _args[11];
			} else if (_contentElement == "palettesFriendsComments") {
				// id [palette], page
				_url += "?id=" + _args[0] + "&page=" + _args[1];
			} 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 == "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 == "loversPatterns") {
				// 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, hsv, lover, hex, f, page
				_url += "?sortType=" + _args[0] + "&sortBy=" + _args[1] + "&query=" + _args[2] + "&hsv=" + _args[3] + "&lover=" + _args[4] + "&f=" + _args[6] + "&page=" + _args[7];
			} else if (_contentElement == "searchPalettes") {
				// sortType, sortBy, query, hsv, lover, hex, hueOption0, hueOption1, hueOption2, f, page
				_url += "?sortType=" + _args[0] + "&sortBy=" + _args[1] + "&query=" + _args[2] + "&hsv=" + _args[3] + "&lover=" + _args[4] + "&hex=" + _args[5] + "&hueOption0=" + _args[6] + "&hueOption1=" + _args[7] + "&hueOption2=" + _args[8] + "&f=" + _args[9] + "&page=" + _args[10];
			} else if (_contentElement == "searchLovers") {
				// sortType, sortBy, query, location, lover, page
				_url += "?sortType=" + _args[0] + "&sortBy=" + _args[1] + "&query=" + _args[2] + "&location=" + _args[3] + "&lover=" + _args[4] + "&page=" + _args[5];
			} 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 == "loversFeaturedPCN1") || (_contentElement == "loversFeaturedPCN2") || (_contentElement == "loversFeaturedPCN3")) {
				// section, userID, howMany
				_url += "?section=" + _args[0] + "&userID=" + _args[1] + "&howMany=" + _args[2] + "&contentElement=" + _contentElement;
			} else if (_contentElement == "checkIfColoursExist") {
				// paletteColours, pickerType, overwrite
				_url += "?paletteColours=" + _args[0] + "&pickerType=" + _args[1] + "&overwrite=" + _args[2];
			} else if (_contentElement == "trendsTrends") {
				// year, month, query, hsv, trendType, page
				_url += "?year=" + _args[0] + "&month=" + _args[1] + "&query=" + _args[2] + "&hsv=" + _args[3] + "&trendType=" + _args[4] + "&page=" + _args[5];
			} else if (_contentElement == "websiteTrendsTrends") {
				// year, month, query, hex, url, hueOption0, hueOption1, hueOption2
				_url += "?year=" + _args[0] + "&month=" + _args[1] + "&query=" + _args[2] + "&hex=" + _args[3] + "&url=" + _args[4] + "&hueOption0=" + _args[5] + "&hueOption1=" + _args[6] + "&hueOption2=" + _args[7] + "&page=" + _args[8];
			} else if (_contentElement == "prevCoverColours") {
				// howMany, id [trend]
				_url += "?howMany=" + _args[0] + "&id=" + _args[1];
			} else if (_contentElement == "websiteTrendsComments") {
				// websiteTrendID, page
				_url += "?websiteTrendID=" + _args[0] + "&page=" + _args[1];
			} else if (_contentElement == "trendsComments") {
				// id [trend], page
				_url += "?id=" + _args[0] + "&page=" + _args[1];
			} 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];
			} else if (_contentElement == "copasoPixelatedImageOnClick") {
				// url, x, y
				_url += "?url=" + _args[0] + "&x=" + _args[1] + "&y=" + _args[2];
			} else if (_contentElement == "copasoPixelatedImgPreview") {
				// url, x, y
				_url += "?url=" + _args[0] + "&x=" + _args[1] + "&y=" + _args[2];
			} else if ((_contentElement == "copasoSearchColors") || (_contentElement == "copasoSearchPalettes")) {
				// SO - Search Options
				_url += "?SO=" + _args[0];
			} else if (_contentElement == "copasoInfoTooltip") {
				// elementID, hexOrPaletteID
				_url += "?elementID=" + _args[0] + "&hexOrPaletteID=" + _args[1];
			} else if (_contentElement == "remComment") {
				// contextType, commentID, reffererArgs
				_url += "?contextType=" + _args[0] + "&commentID=" + _args[1] + "&reffererArgs=" + _args[2];
			} else if (_contentElement == "loversModTopUsers") {
				// excludedUserIDs, recordCount, page
				_url += "?excludedUserIDs=" + _args[0] + "&recordCount=" + _args[1] + "&page=" + _args[2];
			} else if (_contentElement == "loversModTopUsersPaging") {
				// recordCount, page
				_url += "?recordCount=" + _args[0] + "&page=" + _args[1];
			} else if (_contentElement == "echo") {
				// N/A
			} else if (_contentElement == "recentlyActiveSponsors") {
				// N/A
			} else if (_contentElement == "colorCodeComments") {
				// colorCodeID, page
				_url += "?colorCodeID=" + _args[0] + "&page=" + _args[1];
			}

			if (!["rate","checkIfColoursExist","loverUnsubscribeAll","loverSubscribeAll","picturePaletteInspiration","copasoPixelatedImageOnClick","copasoPixelatedImgPreview","copasoSearchPalettes","copasoSearchColors","copasoInfoTooltip","remComment","echo"].in_array(_contentElement)) {
				$(_contentElement).innerHTML = getLoadingFlash();
			}

			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("GET",_url,true);
				_httpSocket.setRequestHeader("Content-Type","text/plain; charset=UTF-8");
				_httpSocket.send(null);
			} else if (window.ActiveXObject) {
				if (_httpSocket) {
					_httpSocket.onreadystatechange = this.xmlhttpChange;
					_httpSocket.open("GET",_url,true);
					_httpSocket.setRequestHeader("Content-Type","text/plain; charset=UTF-8");
					_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 == "checkIfColoursExistN") {
					_patternObject.checkIfColorsExistRequestResponse(_responseText);
				} 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 if (_PFSResponseType == "copasoPixelatedImageOnClick") {
					copasoPixelatedImageHex(_responseText);
				} else if (_PFSResponseType == "copasoPixelatedImgPreview") {
					copasoPixelatedImgPreview(_responseText);
				} else if (_PFSResponseType == "copasoSearchPalettes") {
					searchPaletteResults(_responseText);
				} else if (_PFSResponseType == "copasoSearchColors") {
					searchColorResults(_responseText);
				} else if (_PFSResponseType == "checkIfColoursExistCopaso") {
					checkIfCopasoColorsExistResponse(_responseText);
				} else if (_PFSResponseType == "copasoInfoTooltip") {
					showInfoTooltipResponse(_responseText);
				} else if (_PFSResponseType == "remComment") {
					_responseTextArray = _responseText.split("|");
					if (_responseTextArray[0] == "redirect") {
						window.location.href = _responseTextArray[1];
					} else {
						buildRequest(_responseTextArray[0],[_responseTextArray[1],_responseTextArray[2]]);
					}
				} else if (_PFSResponseType == "loversModTopUsers") {
					var _responseObject = _responseText.evalJSON(true);
					var _recordCount = parseInt(_responseObject["recordCount"]);
					var _numRows = parseInt(_responseObject["rows"]);
					var _responsePage = parseInt(_responseObject["page"]);
					var _innerHTML = "<ul id=\"topFriends\" class=\"topFriendsUL whoLoves\" style=\"height: 330px;\">\n";
					var _i = 0;

					for (_i=0;_i<_numRows;_i++) {
						_innerHTML += "<li class=\"d dragCursor\" id=\"topFriends_" + _responseObject[_i]["userID"].toString() + "\">";
							_innerHTML += (_responseObject[_i]["showSponsoredBadge"]) ? "<div class=\"s\" style=\"margin: -5px 0 -13px -5px;\" title=\"Sponsor\"></div>" : "";
							_innerHTML += "<img src=\"/images/" + _responseObject[_i]["thumbpath"] + "\" class=\"i\" style=\"width: 63px; height: 50px;\" alt=\"" + _responseObject[_i]["loverUserNameLong"].toString() + "\" />" + _responseObject[_i]["loverUserName"].toString() + "\n";
						_innerHTML += "</li>\n";
					}
					$("loversModTopUsers").innerHTML = (_innerHTML + "</ul>\n\n");

					if (_isSponsored) {
						loversModTopUsers_updateSequence = function() {
							var _i = 0;
							Sortable.sequence("topFriends").each(function(_userID) {
								$("topFriends_" + _userID).style.marginBottom = (_i++ < 5) ? "14px;" : "4px;"
							});
						}

						Sortable.destroy("topFriends");
						Sortable.create("topFriends",{
							overlap: "horizontal",
							constraint: true,
							onChange: loversModTopUsers_updateSequence
						});
						loversModTopUsers_updateSequence();
						// Account for the 5 record accumulative offset on each page:
						_recordCount += (Math.ceil(((_recordCount - 5) * 5) / 15) - 5);

						if (_recordCount > _numRows) {
							buildRequest("loversModTopUsersPaging",[_recordCount,_responsePage]);
						}
					}
				} else if (_PFSResponseType == "echo") {
					// Do Nothing
				} else {
					$(_PFSResponseType).innerHTML = _responseText;
				}
			}
		}
	}

	buildPost = function(_contentElement,_args) {
		(new httpPost()).sendRequest(_contentElement,_args,true);
	}

	buildRequest = function(_contentElement,_args) {
		(new httpRequest()).sendRequest(_contentElement,_args,true);
	}

	goToAnchor = function(_anchor) {
		if (_anchor) {
			window.location.href = ((/^([^#]+)#?(.*)?$/.exec(window.location.href))[1] + "#" + _anchor);
		}
	}

	rotatePalette = function(_args,_cPW) {
		_paletteAngle++;
		if (_paletteAngle == 4) {
			_paletteAngle = 0;
		}
		$("paletteImg").src = ("/paletteImg/" + _args + "?angle=" + _paletteAngle + "&cPW=" + _cPW);
	}

	indexStatsOnClick = function(_thisID,_subElementID) {
		["indexStatsTM","indexStatsTW","indexStatsT"].each(function(_elementID) {
			$(_elementID).className = "";
			$S(_elementID + "Div").display = "none";
		});
		$(_thisID).className = "on";
		$S(_thisID + "Div").display = "block";

		["c","p","n","u"].each(function(_tmpID) {
			$(_thisID + "Div" + _tmpID).className = "";
			$S(_thisID + "Div" + _tmpID + "Div").display = "none";
		});

		if (_subElementID) {
			$S(_thisID + "Div" + _subElementID + "Div").display = "block";
			$(_thisID + "Div" + _subElementID).className = "on";
		} else {
			$S(_thisID + "DivcDiv").display = "block";
			$(_thisID + "Divc").className = "on";
		}
	}

	getPicturePaletteInspirationColors = function() {
		var _url = $("picturePaletteInspiration").value;
		if (_url == "http://") {
			return false;
		}
		if ((_url.indexOf("http://") != -1) || (_url.indexOf("https://") != -1)) {
			$("picturePaletteInspirationImg").src = ("/srcImg/" + _url.base64_encode());
			$("picturePaletteInspirationInnerDiv").innerHTML = getLoadingFlash();
			$("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,_contextType,_contextID) {
		// Get comments //
		var _comments = $("ajaxComments").value.replace(/\n/g,"__CL_NEWLINE_CHAR_0192837465__");
		_comments = _comments.replace(/&/g,"__CL_AMPERASAND_CHAR_0192837465__");
		_comments = _comments.replace(/#/g,"__CL_POUND_SIGN_CHAR_0192837465__");
		_comments = _comments.replace(/\+/g,"__CL_PLUSSIGN_CHAR_0192837465__");

		if (_comments != "") {
			// Clear comments //
			$("ajaxComments").value = "";
			// Send request //
			(new httpPost()).sendRequest("addComment",[_commentsID,_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;
		this._heartPath = "";

		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)) ? "half.png" : "full.png";
					} else {
						_hURL = "empty.png";
					}

					$("heart" + (_i + 1)).src = getS3URL("/images/v3/hearts/" + this._heartPath + _hURL);
				}
			}
		}

		this.greyHearts = function() {
			if (this._canAni) {
				for (_i=0;_i<5;_i++) {
					$("heart" + (_i + 1)).src = getS3URL("/images/v3/hearts/" + this._heartPath + "empty.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;
			}
		}
	}

	getHearts = function(_score) {
		return (_score == 0) ? 0 : ((Math.floor(_score) / 2) + 0.5);
	}

	hsvSearchOnSubmit = function() {
		if ($("hsv")) {
			$("hsv").value = (_hSliders.values.toString() + "|" + _bSliders.values.toString());
		}
	}

	hSliderOnSlide = function(_val,_leftSliderID,_rightSliderID) {
		_leftSliderID = (_leftSliderID == undefined) ? "hue1O" : _leftSliderID;
		_rightSliderID = (_rightSliderID == undefined) ? "hue2O" : _rightSliderID;

		$S(_leftSliderID).width = (parseInt((_val[0] * 390) / 360) + 1) + "px";
		$S(_rightSliderID).width = ((390 - parseInt((_val[1] * 390) / 360)) - 1) + "px";
	}

	bSliderOnSlide = function(_val,_leftSliderID,_rightSliderID) {
		_leftSliderID = (_leftSliderID == undefined) ? "bri1O" : _leftSliderID;
		_rightSliderID = (_rightSliderID == undefined) ? "bri2O" : _rightSliderID;

		$S(_leftSliderID).width = (parseInt((_val[0] * 390) / 100) + 1) + "px";
		$S(_rightSliderID).width = ((390 - parseInt((_val[1] * 390) / 100)) - 1) + "px";
	}

	replyTo = function(_divID,_inputID,_userName) {
		var _regEx = /<br( \/)?>/g;
		if ($(_inputID).value == "") {
			$(_inputID).value = (_userName.base64_decode() + " wrote:\n<blockquote>" + $(_divID).innerHTML.replace(_regEx,"") + "</blockquote>");
		} else {
			$(_inputID).value += (_userName.base64_decode() + " wrote:\n<blockquote>" + $(_divID).innerHTML.replace(_regEx,"") + "</blockquote>");
		}
		$(_inputID).focus();
	}

	confRemAvatar = function() {
		if (confirm("Are you sure you want to Delete your Avatar?")) {
			window.location.href = "/op/remAvatar";
		}
	}

	confRemPicture = function() {
		if (confirm("Are you sure you want to Delete your Picture?")) {
			window.location.href = "/op/remPicture";
		}
	}

	// 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 + 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;
	}

	// 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 = "#515151";
		}
		if (_elementID) {
			// See .nav li a:hover in ./global.css for values //
			$S(_elementID).background = "transparent url(./kepek/bgover.jpg) top right no-repeat";
			$S(_elementID).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(_elementIDs,_flow) {
		if (_elementIDs.constructor != Array) {
			_elementIDs = [_elementIDs];
		}
		for (_i=0;_i<_elementIDs.length;_i++) {
			$(_elementIDs[_i]).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>");
	}

	colorCodeMessageEvent = function(_elementID,_colorCodeObject) {
		$(_elementID).value = $(_elementID).value.replace(/[^a-zA-Z0-9!"#$%&'()*,\-.:;<>\?_ ]/,"");
		var _length = $(_elementID).value.length;

		if (_isIE6) {
			$(_elementID + "Count").innerText = ((84 - _length) + " Characters Left");
		} else {
			$(_elementID + "Count").innerHTML = ((84 - _length) + " Characters Left");
		}

		if (_length > 84) {
			$(_elementID).value = $(_elementID).value.substr(0,84);
			if (_isIE6) {
				$(_elementID + "Count").innerText = ("0 Characters Left");
			} else {
				$(_elementID + "Count").innerHTML = ("0 Characters Left");
			}
		}
		colorCodeMessageEventTimeout = function() {
			_colorCodeObject.draw();
		}
		clearTimeout(_timeout.colorCodeMessageEvent);
		_timeout.colorCodeMessageEvent = setTimeout("colorCodeMessageEventTimeout()",200);
	}

	colorCode = function() {
		return {
			_elementID: "",
			_textareaElementID: "",
			_msg: "",
			_mode: "",

			init: function(_args) {
				this._elementID = _args.elementID;
				this._textareaElementID = _args.textareaElementID;
				this._msg = _args.msg;
				this._mode = _args.mode;
				this.draw();
			},
			draw: function() {
				var _i = 0, _buffer = "", _charCode = 0;

				if (this._mode == "add") {
					this._msg = $(this._textareaElementID).value.toUpperCase();
				} else if (this._mode == "display") {
					this._msg = this._msg.base64_decode();
				}
				for (_i=0;_i<84;_i++) {
					_charCode = (isNaN(this._msg.charCodeAt(_i))) ? 0 : this._msg.charCodeAt(_i);
					_buffer += "<div id=\"colorCodeNode_" + _i + "\" style=\"background: url(" + getS3URL("/images/v3/colorCodes/" + _charCode + ".png") + ");\" onmouseover=\"this.style.backgroundPosition = '0 -43px';\" onmouseout=\"this.style.backgroundPosition = '0 0';\"></div>";
				}
				$(this._elementID).innerHTML = _buffer;
			}
		};
	};

	// 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,6}/) != _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; // Are they the same?
						_badPasswd = ($(_checkArray[2]).value.length < _checkArray[1]) ? true : _badPasswd; // Length?
						_badPasswd = ($(_checkArray[3]).value.length < _checkArray[1]) ? true : _badPasswd; // Length?
						//_badPasswd = ($(_checkArray[3]).value.search(/[0-9]/) == -1) ? true : _badPasswd; // Force numeric
						//_badPasswd = ($(_checkArray[3]).value.search(/[a-zA-Z]/) == -1) ? true : _badPasswd; // Force alpha
						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 = /["'#$%&,\/?:<>=+|]/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 value\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 {
				alert("'" + _vO.getElement(_i)[0] + "' does not exist.");
			}
		}

		if (_submitForm == true) {
			if (_submitBtn = $(_submitBtnID)) {
				_submitBtn.disabled = true;
				_submitBtn.value = _submitBtnText;
			}
			return true;
		} else {
			alert(_msg);
			return false;
		}
	}

	// 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() {
		var _buffer = "", _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
		var _char1, _char2, _char3, _enc1, _enc2, _enc3, _enc4, _i = 0;
		var _this = this.utf8_encode();

		while (_i < _this.length) {
			_char1 = _this.charCodeAt(_i++);
			_char2 = _this.charCodeAt(_i++);
			_char3 = _this.charCodeAt(_i++);
			_enc1 = (_char1 >> 2);
			_enc2 = ((_char1 & 3) << 4) | (_char2 >> 4);
			_enc3 = ((_char2 & 15) << 2) | (_char3 >> 6);
			_enc4 = (_char3 & 63);

			if (isNaN(_char2)) {
				_enc3 = _enc4 = 64;
			} else if (isNaN(_char3)) {
				_enc4 = 64;
			}
			_buffer += _keyStr.charAt(_enc1) + _keyStr.charAt(_enc2) + _keyStr.charAt(_enc3) + _keyStr.charAt(_enc4);
		}
		return _buffer;
	}

	String.prototype.base64_decode = function() {
		var _buffer = "", _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
		var _char1, _char2, _char3, _enc1, _enc2, _enc3, _enc4, _i = 0;
		var _this = this.replace(/[^A-Za-z0-9\+\/\=]/g,"");

		while (_i < _this.length) {
			_enc1 = _keyStr.indexOf(_this.charAt(_i++));
			_enc2 = _keyStr.indexOf(_this.charAt(_i++));
			_enc3 = _keyStr.indexOf(_this.charAt(_i++));
			_enc4 = _keyStr.indexOf(_this.charAt(_i++));
			_char1 = ((_enc1 << 2) | (_enc2 >> 4));
			_char2 = (((_enc2 & 15) << 4) | (_enc3 >> 2));
			_char3 = (((_enc3 & 3) << 6) | _enc4);
			_buffer += String.fromCharCode(_char1);

			if (_enc3 != 64) {
				_buffer += String.fromCharCode(_char2);
			}
			if (_enc4 != 64) {
				_buffer += String.fromCharCode(_char3);
			}
		}
		return _buffer.utf8_decode();
	}

	String.prototype.utf8_encode = function() {
		var _this = this;//.replace(/\r\n/g,"\n");
		var _buffer = "", _i = 0, _char = "";

		for (_i=0;_i<_this.length;_i++) {
			var _char = _this.charCodeAt(_i);

			if (_char < 128) {
				_buffer += String.fromCharCode(_char);
			} else if ((_char > 127) && (_char < 2048)) {
				_buffer += String.fromCharCode((_char >> 6) | 192);
				_buffer += String.fromCharCode((_char & 63) | 128);
			} else {
				_buffer += String.fromCharCode((_char >> 12) | 224);
				_buffer += String.fromCharCode(((_char >> 6) & 63) | 128);
				_buffer += String.fromCharCode((_char & 63) | 128);
			}
		}
		return _buffer;
	}

	String.prototype.utf8_decode = function() {
		var _buffer = "", _i = 0, _char1 = _char2 = _char3 = 0, _this = this;

		while (_i < this.length) {
			_char1 = _this.charCodeAt(_i);

			if (_char1 < 128) {
				_buffer += String.fromCharCode(_char1);
				_i++;
			} else if ((_char1 > 191) && (_char1 < 224)) {
				_char2 = _this.charCodeAt(_i + 1);
				_buffer += String.fromCharCode(((_char1 & 31) << 6) | (_char2 & 63));
				_i += 2;
			} else {
				_char2 = _this.charCodeAt(_i + 1);
				_char3 = _this.charCodeAt(_i + 2);
				_buffer += String.fromCharCode(((_char1 & 15) << 12) | ((_char2 & 63) << 6) | (_char3 & 63));
				_i += 3;
			}
		}
		return _buffer;
	}

	// Custom //
	addEngine = function() {
		if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function")) {
			window.sidebar.addSearchEngine("http://www.COLOURlovers.com/firefox/COLOURlovers.src",getS3URL("/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",getS3URL("/firefox/COLOURlovers.png"),"COLOURlovers hex","COLOURlovers Palette HEX Search");
		} else {
			alert("The Firefox browser is required to install this plugin.");
		}
	}

	init();