/***********************************************
* Fixed ToolTip script- ?© Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var tipwidth='150px'; //default tooltip width
var tipbgcolor='#FFF9DA';  //tooltip bgcolor
var disappeardelay=250;  //tooltip disappear speed onMouseout (in miliseconds)
var vertical_offset="-14px"; //horizontal offset of tooltip from anchor link
var horizontal_offset="25px"; //horizontal offset of tooltip from anchor link

/////No further editting needed

var ie4=document.all;
var ns6=document.getElementById&&!document.all;

if (ie4||ns6) {
	document.write('<div id="fixedtipdiv" style="position: absolute; top: -500px; width:'+tipwidth+';background-color:'+tipbgcolor+'" ></div>');
}

function getposOffset(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function autoCompleteOf(name) {
	if(obj = document.getElementById(name)) {
		obj.setAttribute('autocomplete','off');
	}
}

function date_format(val) {

	var objDate = new Date(val*1000);
	
	var date = parseInt(objDate.getDate(), 10);
	if(date < 10) {
		date = '0' + date;
	}

	var month = parseInt(objDate.getMonth() + 1, 10);
	if(month < 10) {
		month = '0' + month;
	}

	var year  = objDate.getFullYear();

	var hours = parseInt(objDate.getHours(), 10);
	if(hours < 10) {
		hours = '0' + hours;
	}

	var minutes = parseInt(objDate.getMinutes(), 10);
	if(minutes < 10) {
		minutes = '0' + minutes;
	}

	return (date + '.' + month + '.' + year + ' ' + hours + ':' + minutes);
}

function showhide(obj, e, visible, hidden, tipwidth) {
	if (ie4||ns6) {
		dropmenuobj.style.left=dropmenuobj.style.top=-500;
	}
	if (tipwidth!="") {
		dropmenuobj.widthobj=dropmenuobj.style;
		dropmenuobj.widthobj.width=tipwidth;
	}
	if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover") {
		obj.visibility=visible;
	}
	else if (e.type=="click") {
		obj.visibility=hidden;
	}
}

function iecompattest(){
 return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1;
if (whichedge=="rightedge"){
	var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15;
	dropmenuobj.contentmeasure=dropmenuobj.offsetWidth;
	if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure) {
		edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth;
	}
}
else{
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18;
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight;
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure) {
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight;
}
}
return edgeoffset;
}

function fixedtooltip(menucontents, obj, e, tipwidth, left_offset, top_offset){
if (window.event) { event.cancelBubble=true; }
else if (e.stopPropagation) { e.stopPropagation(); } 
clearhidetip();

dropmenuobj=document.getElementById? document.getElementById("fixedtipdiv") : fixedtipdiv;
dropmenuobj.innerHTML=menucontents;

if (ie4||ns6){
	showhide(dropmenuobj.style, e, "visible", "hidden", tipwidth);
	dropmenuobj.x=getposOffset(obj, "left");
	dropmenuobj.y=getposOffset(obj, "top");
if (left_offset) { dropmenuobj.style.left = dropmenuobj.x + left_offset + "px"; }
else { dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"; }
if (top_offset) { dropmenuobj.style.top = dropmenuobj.y + obj.offsetHeight + top_offset + "px"; }
else  {dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"; }
}
}

function hidetip(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6) {
dropmenuobj.style.visibility="hidden";
}
}
}

function delayhidetip(){
if (ie4||ns6) {
delayhide=setTimeout("hidetip()",disappeardelay); }
}

function clearhidetip(){
if (typeof delayhide!="undefined") {
clearTimeout(delayhide);
}
}

function addBookmarkForBrowser(obj) {
	if (document.all) {
		obj.style.behavior='url(#default#homepage)';
		obj.setHomePage('http://www.'+domain);
	}
}
function go(loc) {
	window.location.href = loc;
}
function limit(obj, limit, counterId) {
	if (counterId == 'undefined' || !counterId) {
		counterId = 'count';
	}
	if (obj.value.length > limit) {
	  obj.value = obj.value.substr(0,limit);
	}
	document.getElementById(counterId).innerHTML = limit - obj.value.length;
}
function destroy_ten_div(){
	if (user_id) {
		var bobj = document.getElementById("smsInfoBottom");
		var tobj = document.getElementById("smsInfo");
		if (bobj) bobj.innerHTML = "";
		if (tobj) tobj.innerHTML = "";
	} else {
		return true;
	}
}
function one_confirm(obj){
	destroy_ten_div(); 
	if (obj.pressed.value==0) {
		obj.pressed.value = 1; 
		obj.submit();
	}
}
function seven_confirm(obj){
	destroy_ten_div(); 
	if (obj.pressed.value==0) {
		obj.pressed.value = 1; 
		obj.submit();
	}
}

function thide(oar,objs){
	for (nr in oar) {
		var el = document.getElementById(objs[oar[nr]]);
		if(el) {
			el.style.display = "none";
		}
	}
}

function showHide(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != "none" ) {
		el.style.display = "none";
	}
	else {
		el.style.display = "block";
	}
	var objs = new Array("sevenPoints","sevenPointsBottom","smsInfo","smsInfoBottom","onePoints","onePointsBottom");
	switch(obj)
	{
	case objs[0]:
		thide(new Array(1,2,3,4,5), objs);
	  break;
	case objs[1]:
		thide(new Array(0,2,3,4,5),objs);
	  break;
	case objs[2]:
		thide(new Array(0,1,3,4,5),objs);
	  break;
	case objs[3]:
		thide(new Array(0,1,2,4,5),objs);
	  break;
	case objs[4]:
		thide(new Array(0,1,2,3,5),objs);
	  break;
	case objs[5]:
		thide(new Array(0,1,2,3,4),objs);
	  break;
	}
}
/***********************************************
* // Fixed ToolTip script
***********************************************/

var ajaxml = false;
function hotAjax(user_id, mail, hash) {
	var outputDiv = document.getElementById('hot_ee_div');

	if (!ajaxml) {
		if (window.XMLHttpRequest) {
			ajaxml = new XMLHttpRequest();
		} else if (window.ActiveXObject) {
			ajaxml = new ActiveXObject('Microsoft.XMLHTTP');
		}
	} if (ajaxml) {
		var url = '/ajax.hot.ee.php?user_id=' + user_id + '&mail=' + mail + '&hash=' + hash;
		ajaxml.open('GET', url, true);
		ajaxml.onreadystatechange = function() {
			if (ajaxml.readyState == 4 && ajaxml.status == 200) {
				var content = ajaxml.responseText;
				outputDiv.innerHTML = content;
			}
		};
		ajaxml.send(null);
	}
}

/*

USAGE:

addEvent(window, 'load', function_name); // window.onload="function_name();"
addEvent(document, 'click', function_name); // document.onclick="function_name();"
addEvent(document, 'mousemove', function_name); // document.onmousemove="function_name();"

*/
function addEvent(obj, evType, fn){
	if (obj.addEventListener){
		obj.addEventListener(evType, fn, false);
		return true;
	} else if (obj.attachEvent){
		var r = obj.attachEvent("on"+evType, fn);
		return r;
	} else {
		return false;
	}
}



function include(filename) {
	var ext = /^.+\.([^.]+)$/.exec(filename);
	filetype = ext == null ? "" : ext[1];

	if (filetype=="js"){ //if filename is a external JavaScript file
		var fileref=document.createElement('script');
		fileref.setAttribute("type","text/javascript");
		fileref.setAttribute("src", filename);
	}
	else if (filetype=="css"){ //if filename is an external CSS file
		var fileref=document.createElement("link");
		fileref.setAttribute("rel", "stylesheet");
		fileref.setAttribute("type", "text/css");
		fileref.setAttribute("href", filename);
	}
	if (typeof fileref!="undefined") {
		document.getElementsByTagName("head")[0].appendChild(fileref);
	}
}

function run_js(name) {
	var the_div = document.getElementById(name);
	if(the_div != null) {
		var arr_scripts = the_div.getElementsByTagName('script');
		for(i in arr_scripts) {
			eval(arr_scripts[i].innerHTML);
		}
	}
}

function showHideHtmlElements(elemFirst, elemLast)
{
	var currentElement = '';
	var flag = 0;

	if (elemFirst != 'undefined' && elemFirst) {
		if (typeof elemFirst == 'object') {
			for (i in elemFirst) {
				currentElement = document.getElementById(elemFirst[i]);
				if (flag == 0 && currentElement.style.display == 'none') {
					flag = 1;
				} else if (flag == 0) {
					flag = 2;
				}

				if (flag == 1) {
					currentElement.style.display = 'block';
				} else {
					currentElement.style.display = 'none';
				}
			}
		} else {
			currentElement = document.getElementById(elemFirst);
			if (currentElement.style.display == 'none') {
				flag = 1;
				currentElement.style.display = 'block';
			} else {
				flag = 2;
				currentElement.style.display = 'none';
			}
		}

		if (elemLast != 'undefined' && elemLast) {
			if (typeof elemLast == 'object') {
				for (i in elemLast) {
					currentElement = document.getElementById(elemLast[i]);
					if (flag == 1) {
						currentElement.style.display = 'none';
					} else {
						currentElement.style.display = 'block';
					}
				}
			} else {
				currentElement = document.getElementById(elemLast);
				if (flag == 1) {
					currentElement.style.display = 'none';
				} else {
					currentElement.style.display = 'block';
				}
			}
		}
	}
}

function inserDataIntoUserBox(arrUserInfo)
{
	userInfoBox.style.display     = 'block';
	var linkPosition              = getSmartPos(focusOnUser, userInfoBox);
	userInfoBox.style.top         = linkPosition['top'] + 'px';
	userInfoBox.style.left        = linkPosition['left'] + 'px';
	if (!arrUserInfo['greeting']) {
		userInfoBoxShoutDiv.style.display = 'none';
	} else {
		userInfoBoxShoutDiv.style.display = 'block';
		userInfoBoxGreeting.innerHTML = arrUserInfo['greeting'];
	}
	userInfoBoxPhotos.src         = arrUserInfo['userPicSrc'];
	if (arrUserInfo['picCount'] > 0) {
		userInfoBoxPhotoLink.href     = 'http://www.' + path_domain + '/show.php?id=' + arrUserInfo['profilePicId'];
	} else {
		userInfoBoxPhotoLink.href     = 'http://www.' + path_domain + '/users/' + arrUserInfo['userName'];
	}
	userInfoBoxUsername.innerHTML = arrUserInfo['userNameAge'];
	userInfoBoxStatus.src         = arrUserInfo['onlineStatus'];
	userInfoBoxLocation.innerHTML = arrUserInfo['townName'];
	userInfoBoxPicCount.innerHTML = arrUserInfo['picCount'];
	userInfoBoxPicCount.href      = 'http://www.' + path_domain + '/users/' + arrUserInfo['userName'];
	userInfoBoxAlbumPic.innerHTML = arrUserInfo['albumPicCount'];
	userInfoBoxAlbumPic.href      = 'http://www.' + path_domain + '/albums/' + arrUserInfo['userName'];
	userInfoBoxFame.innerHTML     = arrUserInfo['userFame'];
	userInfoBoxFame.href          = 'http://www.' + path_domain + '/fame.php';
	userInfoBoxActivity.innerHTML = arrUserInfo['userActivity'];
	userInfoBoxActivity.href      = 'http://www.' + path_domain + '/activity.php?id=' + arrUserInfo['userId'];
	userInfoBoxVisit.innerHTML    = arrUserInfo['lastVisit'];
	userInfoBoxDropShadow(1, linkPosition['top'], linkPosition['left']);

	chachedUserData[arrUserInfo['userId']] = arrUserInfo;
}

function checkAndSendAjaxRequest(flagId)
{
	if (flagId == userInfoAjaxFlag) {
		var url = 'http://www.' + path_domain + '/ajax.user_infobox.php?id=' + flagId;
		univAjaxRequest(url, 2);
	}
}

function showUserInfoBox(link, userId)
{
	userInfoAjaxFlag = userId;
	focusOnUser = link;
	if (chachedUserData[userId]) {
		userInfoBoxLastFlag = 1;
		var strangeJsFix = function ()
		{
			inserDataIntoUserBox(chachedUserData[userId]);
		}
		
		setTimeout(strangeJsFix, 200);

	} else {
		setTimeout("checkAndSendAjaxRequest(" + userId + ");", 500);
	}
}

function reShowUserInfoBox()
{
	userInfoBoxLastFlag = 1;
}

function hideUserInfoBox()
{
	setTimeout("checkHideUserInfoBox(" + userInfoAjaxFlag + ");", 500);
	userInfoAjaxFlag = 0;
	userInfoBoxLastFlag = 0;
}

function checkHideUserInfoBox(userId)
{
	if (!userInfoBoxLastFlag) {
		userInfoBoxDropShadow(2);
		userInfoBox.style.display = 'none';
	}
}

function getSmartPos(posOf, element)
{
	var parentPos;

	var documentScroll = new Array();
		documentScroll['left'] = document.body.scrollLeft;
		documentScroll['top']  = document.body.scrollTop;

	var screenSize = new Array();
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		screenSize['width']  = document.body.offsetWidth;
		screenSize['height'] = document.body.offsetHeight;
	} else {
		screenSize['width']  = window.innerWidth;
		screenSize['height'] = window.innerHeight;
	}

	screenSize['width']  += documentScroll['left'];
	screenSize['height'] += documentScroll['top'];

	var elemSize = new Array();
		elemSize['width']  = element.offsetWidth;
		elemSize['height'] = element.offsetHeight;

	var absPos = new Array();
		absPos['left'] = posOf.offsetLeft;
		absPos['top']  = posOf.offsetTop;

	var sizeOfPosElem = new Array();
		sizeOfPosElem['width']  = posOf.offsetWidth;
		sizeOfPosElem['height'] = posOf.offsetHeight;

	parentPos = posOf.offsetParent;
	while (parentPos != null) {
		absPos['left'] += (parentPos.offsetLeft);
		parentPos       = parentPos.offsetParent;
	}

	parentPos = posOf.offsetParent;
	while (parentPos != null) {
		absPos['top'] += (parentPos.offsetTop);
		parentPos      = parentPos.offsetParent;
	}

	absPos['left'] += sizeOfPosElem['width'];
	absPos['top']  += sizeOfPosElem['height'];

	if ((absPos['left'] + elemSize['width'] + 20) > screenSize['width']) {
		absPos['left'] -= (elemSize['width'] + sizeOfPosElem['width']);
	}

	if ((absPos['top'] + elemSize['height'] + 20) > screenSize['height']) {
		absPos['top'] -= (elemSize['height'] + sizeOfPosElem['height']);
	}

	absPos['left'] = (absPos['left'] < 0 ? 0 : absPos['left']);
	absPos['top']  = (absPos['top'] < 0 ? 0 : absPos['top']);

	return absPos;
}

var xmlHttpRequest = false;
function univAjaxRequest(url, type)
{
	if (!xmlHttpRequest) {
		if (window.XMLHttpRequest) {
			xmlHttpRequest = new XMLHttpRequest();
		} else if (window.ActiveXObject) {
			xmlHttpRequest = new ActiveXObject('Microsoft.XMLHTTP');
		}
	}

	if (xmlHttpRequest) {
		xmlHttpRequest.open('GET', url, true);
		xmlHttpRequest.onreadystatechange = function()
		{
			if (xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200) {
				var returnedContent = xmlHttpRequest.responseText;
				if (type == 1) {
					return returnedContent;
				} else if (type == 2) {
					eval(returnedContent);
				}
			}
		};
		xmlHttpRequest.send(null);
	}
}

function printr(obj) {
	if (typeof obj == 'object') {
		var text = new String;
		var j    = 0;
		for (var i in obj) {
			j++;
			text += '[' + i + '] => \'' + obj[i] + "\',\n"
			if (j >= 25) {
				alert(text);
				text = '';
				j = 0;
			}
		}
		if (j > 0) {
			alert(text);
		}
	}
}

function userInfoBoxDropShadow(type, top, left)
{
	if (type == 1) {
		userInfoBoxShadow.style.display = 'block';
		userInfoBoxShadow.style.top    = (top + 4) + 'px';
		userInfoBoxShadow.style.left   = (left + 4) + 'px';
		userInfoBoxShadow.style.width  = (userInfoBox.offsetWidth) + 'px';
		userInfoBoxShadow.style.height = (userInfoBox.offsetHeight) + 'px';
	} else {
		userInfoBoxShadow.style.display = 'none';
	}
}

var chachedUserData = new Array();

function servicesSelectUserName(userList)
{
	var inputField = document.getElementById(searchResultsField);
	if (userList.length > 0) {
		inputField.value = userList[0];
		hide_friends_div(0);
	}
}

function swap_display(main_div_id, second_div_id) {
	var main_div = document.getElementById(main_div_id);
	if (second_div_id) var second_div = document.getElementById(second_div_id);
	if (main_div) {
		main_div.style.display = (main_div.style.display=="none") ? "block" : "none";
		if (second_div) second_div.style.display = (main_div.style.display=="none") ? "block" : "none";
	}
}

/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

function ajaxObject() {
	// will return an XMLHttprequest object
	if (window.XMLHttpRequest) {
		obj = new XMLHttpRequest(); // Mozilla, Safari, IE7...
	} else if (window.ActiveXObject) { // IE
		Try.these(
			function(){ obj = new ActiveXObject("Msxml2.XMLHTTP"); },
			function(){ obj = new ActiveXObject("Microsoft.XMLHTTP"); }
		);
	}
	return obj;
}

function is_ie_smile() {
	return (navigator.appName.indexOf("Explorer")!=-1);
}
var realCaretPos = '';
var cursor_pos;

function recalc_cur_pos() {
	realCaretPos = 0;
}

var tt = 0;

function getCaretPos_smile(obj,count_n, textarea_name_smile)
{
	if(obj.selectionStart) {
	obj.focus();
	return obj.selectionStart;//Gecko
}
else if (document.selection)//IE
{
	obj.focus();

	if (realCaretPos>0) {
		pos = realCaretPos
	} else {

		var sel = document.selection.createRange();
		var clone = sel.duplicate();

		sel.collapse(true);
		try{
			if (obj) clone.moveToElementText(obj);
		}catch(e){

			var sel = document.selection.createRange();
			var clone = sel.duplicate();
			sel.collapse(true);

			var obj = document.getElementById(textarea_name_smile);
		}

		if (sel) clone.setEndPoint("EndToEnd", sel);
		var pos = clone.text.length;
	}
	//check position
	var text = obj.value;

	if (count_n) {
		for(var i=0; i<pos; i++) {
			if (text.charCodeAt(i)==13) {

				pos++;
			}
		}
	}
	return pos;
}
return 0;
}

function setCaretPos_smile(pos, textarea_name_smile) {

	var obj = document.getElementById(textarea_name_smile);
	obj.focus();
	if (typeof(obj.selectionStart)=="number") {
		obj.selectionStart = pos;
		obj.selectionEnd = pos;
		realCaretPos = pos;
	} else if (document.selection) {
		var val = obj.value;
		var or_pos = pos;
		for(var i=0;i<pos;i++) {
			if (val.charCodeAt(i)==13) {
				pos--;
			}
		}

		var range = obj.createTextRange();
		range.move("character", pos);
		range.select();
		realCaretPos = or_pos;

		return true;
	}
}

function repairCaretPos_smile(e) {
	return 0;
	if (!e) var e = window.event
	if (e.target) {
		targ = e.target
	} else if (e.srcElement) {
		targ = e.srcElement;
	}

	var tname = targ.tagName;
	if (tname != "INPUT") {
		//alert(tname);
	}
	if (tname == "TD") {
		var obj = document.getElementById(textarea_name_smile);
		realCaretPos = getCaretPos_smile(obj,0);
	}
}

function insert_to_caret_pos_smile(str,textarea_name_smile)
{
	//if (textarea_name_smile ="all_smiles_ten_up_kb_ta")textarea_name_smile ="ten_up_kb_ta";
	var obj = document.getElementById(textarea_name_smile);

	var cp = getCaretPos_smile(obj,0,textarea_name_smile);

	var full_str = obj.value;

	var str1 = full_str.substring(0,cp,textarea_name_smile);

	var str2 = full_str.substr(cp);
	obj.value = str1 + str + str2;
	var smile_code_text = str.length;

	if (is_ie_smile() && str=="\n") {
	
		setCaretPos_smile(cp+smile_code_text,textarea_name_smile);
	} else {
		setCaretPos_smile(cp+smile_code_text,textarea_name_smile);
	}

	return 0;
}

function text_focus(textarea_name_smile) {
	var obj = document.getElementById(textarea_name_smile);
	obj.focus();
}

function add_smile(SmileCode, textarea_name_smile)
{

	if (SmileCode==" :#cry#-( "){
		SmileCode = ":\'-(";
	}
	var SmileCode;
	var obj = document.getElementById(textarea_name_smile);
	obj.onclick = function() { realCaretPos = 0; };
	insert_to_caret_pos_smile(SmileCode,textarea_name_smile);
	return;
}

function swap_display_v2()
{
	for( var i = 0; i < arguments.length; i++ ) {
		obj = document.getElementById(arguments[i]);
		obj.style.display = (obj.style.display == "none") ? "block" : "none";
	}
}

function swap_smiles_hide(div_id)
{
	var div1 = document.getElementById(div_id);
	div1.style.display = (div1.style.display=="none") ? "block" : "none";
}

function load_images() {
   var images = document.body.getElementsByTagName("IMG");
   for(i in images) {
	   var img = images[i];
	   if (img && img.getAttribute && img.id && (img.id.lastIndexOf("userpic_")==0) ) {
		   var path = img.getAttribute("normal_path", 2);
		   if (path) img.src = path;
	   }
   }
}

function load_javascript(link) {
	var script = document.createElement('script');
	script.type = 'text/javascript';
	script.src = link;
	document.getElementsByTagName('head')[0].appendChild(script);
}

function hide_comment_window(obj) {
	var el = document.getElementById('comment_f_window'+obj);
	el.style.display = 'none';
}

function set_comment(obj,link,error_msg) {
	var ctext = document.getElementById('comment_text_'+obj);
	var text = ctext.value;
	text  = text.replace(/^\s+/, '');
	text  = text.replace(/\s+$/, '');
	if (error_msg && text.length < 3) {
		alert(error_msg);
		ctext.focus();
		return false;
	}
	hide_comment_window(obj);
	document.location.href = link + '&text=' + text;
}
function show_comment_window(e, obj) {
	var el = document.getElementById('comment_f_window'+obj);
	if (el && el.style.display=='none') {
		var create_form = '';

		var el = document.getElementById('comment_f_window'+obj);

		el.style.display = 'block';
		document.getElementById('comment_text_'+obj).focus();
		document.getElementById('comment_text_'+obj).select();
	} else hide_comment_window(obj);
}

function sw_cl(f_id, s_id, cl_name) {
	if (f_id) {
		var elem = document.getElementById(f_id);
		if (elem) elem.className = cl_name;
		if (s_id) {
			var elem2 = document.getElementById(s_id);
			if (elem2) elem2.className = cl_name;
		}
	}
}

function showForm(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != "none" ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = 'block';
	}
}

function mark_as_read(user_id, alert_id) {
	var t_alert_btn = document.getElementById("alert_mark_read_btn_"+alert_id);
	t_alert_btn.disabled = true;
	if (window.XMLHttpRequest) {
		var request = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		var request = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (request) {
		var d = new Date();
		var sub_domain = "www";
		var url = "http://" + sub_domain + "." + path_domain + "/ajax.alerts.php?id=" + user_id + "&auth_string=" + auth_string + "&alert_id=" + alert_id + "&param=" + d.getTime();
		request.open("GET", url, true);
		request.onreadystatechange = function() {
			if (request.readyState == 4 && request.status == 200) {
				var response = request.responseText;
				if (response && response.length>5 && response.lastIndexOf("var obj =")!=-1) {
					var t_alert_msg = document.getElementById("alert_message_"+alert_id);
					var t_alert_css = document.getElementById("alert_content_"+alert_id);
					try {
						if (t_alert_msg) {
							t_alert_msg.className = "markus table-brd-pink";
							t_alert_css.className = "table-brd-pink";
							if (t_alert_btn) t_alert_btn.parentNode.removeChild(t_alert_btn);
						}
					} catch (e) {
					}
				}
			}
		};
		request.send(null);
	}
}
function groups_show_option() {
	var dt = new Date();
	var st0 = (display[0] == "none") ? 1 : 0;
	var st1 = (display[1] == "none") ? 1 : 0;
	dt.setDate(dt.getDate()+7);
	document.cookie = "alert_group_close_"+user_id+"="+st0+","+st1+"; expires="+dt.toGMTString()+"; path=/;domain=."+path_domain;
}

function showHideComplain(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != "none" ) {
		el.style.display = "none";
	}
	else {
		el.style.display = "block";
	}
}

function fs1(){
	var f1 =	document.getElementById("f1");
	f1.submit();
}

function hide_comment_window(obj) {
	var el = document.getElementById('comment_f_window'+obj);
	el.style.display = 'none';
}

function getPosition(obj) {
	var x=0, y=0;
	while(obj) {
		x+=obj.offsetLeft;
		y+=obj.offsetTop;
		obj=obj.offsetParent;
	}
	return {x:x, y:y};
}
function join_club(obj) {
	hide_comment_window(obj);
	var ctext = document.getElementById('comment_text_'+obj).value;
	document.getElementById('comment_el').value = ctext;
	document.getElementById('join_form').submit();
}

function show_hide(obj,val){
	//obj = document.getElementById(obj);
	if (val) {
		show_comment_window(this, obj,"");
	} else {
		hide_comment_window(obj);
		block_array[obj] = false;
		document.getElementById("del_comment_"+obj).innerHTML = "";
		if (obj) comment_array[obj] = false;
	}
}

function showPending(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != "none" ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = 'block';
	}
}
function selectLink(name) {
	document.getElementById(name).select()
}

function testcheckpage() {
	try
	{
		checkPage();
	}
	catch (err)
	{
		setTimeout("testcheckpage", 200);
	}
}

function setCookie(name,value,expire)
{
	var expiry=(expire==undefined)?"":("; expires="+expire.toGMTString());document.cookie=name+"="+value+expiry;
}
function getCookie(name)
{
	if(document.cookie==undefined||document.cookie.length===0)
		return undefined;
	var search=name+"=";
	var index=document.cookie.indexOf(search);
	if(index!=-1)
	{
		index+=search.length;
		var end=document.cookie.indexOf(";",index);
		if(end==-1)
			end=document.cookie.length;
		return unescape(document.cookie.substring(index,end));
	}
}

	
function add_status_comment(id, index, paging) {
	
	comment = $('#status_ta_' + id).val();
	$('#status_ta_' + id).val('');
	if(comment)
	{
		$.ajax({
			type: "POST",
			url: "/ajax.greeting.php",
			data: { 'activity_id': id, 'comment': comment },
			success: function(data){
				if (data.status == 'OK') {
					if(!index)
					{
						$('#write_comment_2_' + id).hide();
						$('#write_comment_1_' + id).show();
					}
					$('#all_status_smiles_' + id).hide();
					get_status_comments(id, 1,'#comments_'+id, paging);
				}
			},
			error: function(obj, msg) {
				alert(msg);
			},
			dataType: "json"
		});
	}
}
var confirm_text = "delete?"; 
function delete_status_comment(id, comment_id,confirmmsgg, paging) {
	if(confirm (confirm_text))
	{

		$.ajax({
			type: "POST",
			url: "/ajax.greeting.php",
			data: { 'activity_id': id, 'delete': comment_id },
			success: function(data){
				if (data.status == 'OK') {
					get_status_comments(id, 1,'#comments_'+id, paging);
				}
			},
			error: function(obj, msg) {
				alert(msg);
			},
			dataType: "json"
		});
	}
}
var status_delete_text ="delete";
function get_status_comments(id, page, content, paging) {
	//alert(page);
	if(paging)
	{
		duration =5;
	}
	else
	{
		duration =2;
	}	
	
	$.ajax({
		type: "POST",
		url: "/ajax.greeting.php",
		data: { 'activity_id': id, 'page': page, 'duration': duration },
		success: function(data){
		$(content).empty();
		html ='';
		$.each(data.comments, function(i, comment)
		{
			if(comment.gender == 'M')
			{
				gender=3;
			}
			else
			{
				gender=4;
			}
			html += '<div class="user_comment_row"><dl class="user_comment"><dt><img src="'+comment.pic_path+'" alt="" width="40" height="40"></dt><dd><div class="pb5"><a href="/users/'+comment.username+'" class="right'+gender+'">'+comment.username+'</a></div>'+comment.text+'<div class="date">'+date_format(comment.date);
			if(comment.can_delete)
			{
				html +='- <a class="a2" href="#" onClick="delete_status_comment('+id+','+i+' ); return false;">'+status_delete_text+'</a>';
			}
			html +='</div></dd></dl><div class="c"><!-- --></div></div>';
			
			
		});
		$('#comments_count_top_'+id).text(data.total);
		$('#comments_count_btm_'+id).text(data.total);
		
		
		$(content).append(html);
		if(paging)
		{
			items_per_page =5;
			pages = Math.floor(data.total/items_per_page);
			if (data.total %items_per_page != 0) pages++;
			if(pages > 1)
			{
				
				
				page = Math.floor(page);
				$(content).append('<table cellspacing="1" cellpadding="2" border="0" align="center">'+
					'<tr>'+
						'<td>');
					
				if (pages > items_per_page)
				{
					if(page > 4)
						 $(content).append('<a href="#" '+
								'onClick="get_status_comments('+id+', '+
								(page-4)+', \''+content+'\',1); return false;">'+
								'<B class="clr6">[<SPAN class="hardcore">'+
								'&laquo;</SPAN>]</B></a>');
				
						for (i = page-3 ; i<= pages && i<page+3; i++)
						{
							if (i > 0) 
							{
								if(page == i)
								{
									$(content).append('<b class="hardcore">'+i+' </b>');
								}
								else
								{
									$(content).append(' <a class="lehed" href="#" '+
									'onClick="get_status_comments('+id+', '+
									i+', \''+content+'\',1); return false;">'+
									'<b class="clr6"><b class="clr6">'+i+'</b></a> ');
								}
							}
						}
						if(page+2 < pages)
						{
							$(content).append('<a href="#" '+
								'onClick="get_status_comments('+id+', '+
								(page+3)+', \''+content+'\',1); return false;">'+
								'<B class="clr6">[<SPAN class="hardcore">'+
								'&raquo;</SPAN>]</B></a>');
						}
					
				}
				else
				{
					for(i = 1; i< pages+1; i++)
					{
						if(page == i)
						{
							$(content).append('<b class="hardcore">'+i+' </b>');
						}
						else
						{
						$(content).append('<a class="lehed" '+
							'href="#" onClick="get_status_comments('+id+', '+
							i+', \''+content+'\',1); return false;">'+
							'<b class="clr6">'+i+'</b></a> ');
						}
					}
				}
				
				
						
				$(content).append('</td></tr></table>');
			}
		}
		//	alert(data.comments);
		//	alert(data.total);
		},
		error: function(obj, msg) {
			alert(msg);
		},
		dataType: "json"
	});
	
}
function show_comment_form(id)
{
	$('#write_comment_1_'+id).hide('fast');
	$('#write_comment_2_'+id).show('fast', 
	function(){$('#status_ta_'+id).focus();}
	);
}
function show_comments_index(id)
{
	//$('#comments_count_top_47').html(100);
	$('#comments_'+id).toggle('fast');
	$('#write_comment_2_'+id).toggle('fast', 
		function(){$('#status_ta_'+id).focus();});
	$('#write_comment_1_'+id).toggle('fast');
	get_status_comments(id, 1, '#comments_'+id, 0);
	$('#status_seeall_div_'+id).toggle();
	return false;
}

/*
 * NOTIFICATION WINDOW
 */
(function($) {
	$.notification_window = function(options) {

		if(typeof options == 'object') {
			$.each(options, function(name, val) {
				if(typeof val == 'object') {
					options[name] = $.extend({}, $.notification_window.defaults[name], options[name]);
				}
			});
		}

		var opts = $.extend({}, $.notification_window.defaults, options);

		$('.notification_window').remove();
		var notification_window = $('<div></div>').addClass('notification_window').css({
			display: 'none',
			position: 'absolute',
			zIndex: 1,
			top: (document.body.scrollTop + ($(window).height()*35/100)) + 'px',
			left: '25%'
		});

		$('body').append(notification_window);


		/**
		 * CLOSE BTN
		 */
		var close_btn = $('<span><!-- close --></span>');
		close_btn.css({
			backgroundImage:    'url(http://pics.'+ opts.path_domain +'/pics/neo/icons_sets/icons_sets_16.png)',
			backgroundPosition: '-1776px 0px',
			width:              '16px',
			height:             '16px',
			display:            'block',
			cursor:             'pointer'
		}).click(function() {
			notification_window.hide(500);
		});


		/**
		 * HEADER
		 */
		var header = 
		$('<table cellspacing="0" cellpadding="0" border="0" width="100%"></table>')
		.append(
			$('<tr></tr>')
			.append('<td valign="top" class="p10 bgPinkBright" style="cursor: move;"><h1 style="margin: 0px;" class="txt16">'+ opts.msg[0] +'</h1></td>')
			.append(
				$('<td class="p10 bgPinkBright txt11" align="right" valign="bottom"></td>')
				.append(close_btn)
			)
		);


		/**
		 * OK BUTTON
		 */
		var ok_button = 
		$('<input type="button" value="'+ opts.msg[2] +'" class="btn2" />').click(function() {
			notification_window.hide(500);
			
			if(typeof opts.callback == 'function') {
				return opts.callback(true);
			}
		});

		/**
		 * CANCEL BUTTON
		 */
		var cancel_button = '';
		if(opts.type == 'confirm') {
			cancel_button = $('<input type="button" value="'+ opts.msg[3] +'" class="btn2 ml10" />').click(function() {
				notification_window.hide(500);
				
				if(typeof opts.callback == 'function') {
					return opts.callback(false);
				}
			});
		}

		/**
		 * TABLE
		 */
		var table = 
		$('<table cellpadding="12" cellspacing="0"></table>')
		.append(
			$('<tr></tr>')
			.append(
				$('<td style="background:url(http://pics.'+ opts.path_domain +'/pics/neo/bg_black60.png);" class="notification_popup"></td>')
				.append(
					$('<table cellspacing="0" cellpadding="0" border="0" align="center" width="530" class="bgWhite" style="border:1px solid #866161;"></table>')
					.append(
						$('<tr></tr>')
						.append(
							$('<td valign="top" style="border-bottom:0px solid #eab0b0;"></td>')
							.append(header)
						)
					)
					.append(
						$('<tr></tr>')
						.append(
							$('<td valign="top" colspan="2" class="notification_popup_content"></td>')
							.append(opts.msg[1])
						)
					)
					.append(
						$('<tr></tr>')
						.append(
							$('<td class="p10 bgGrayLight"></td>')
							.append(
								$('<table cellpadding="0" cellspacing="0" align="center"></table>')
								.append(
									$('<tr></tr>')
									.append(
										$('<td></td>')
										.append(ok_button)
										.append(cancel_button)
									)
								)
							)
						)
					)
				)
			)
		);

		notification_window.append(table).show(500);

		try {
			notification_window.draggable({ handle: header });
		}
		catch(e){}

		return this;
	}

	/**
	 * Default options
	 */
	$.notification_window.defaults = {
		path_domain: document.domain.replace('www.', ''),
		msg: {
			0: 'Title',
			1: 'Content',
			2: 'OK',
			3: 'Cancel'
		},
		type: 'alert',
		callback: null
	};
})(jQuery);

rAlert = function(message, title, callback, ok_button) {

	if(title == null) {
		title = 'Alert';
	}

	if(ok_button == null) {
		ok_button = 'OK';
	}

	$.notification_window({
		msg: {
			0: title,
			1: '<div class="alc" style="padding: 20px 0 20px 0;">' + message + '</div>',
			2: ok_button
		},
		type: 'alert',
		callback: function(r) {
			if(callback) {
				callback(r);
			}
		}
	});
}

rConfirm = function(message, title, callback, ok_button, cancel_button) {
	
	if(title == null) {
		title = 'Confirm';
	}

	if(ok_button == null) {
		ok_button = 'OK';
	}

	if(cancel_button == null) {
		cancel_button = 'Cancel';
	}

	$.notification_window({
		msg: {
			0: title,
			1: '<div class="alc" style="padding: 20px 0 20px 0;">' + message + '</div>',
			2: ok_button,
			3: cancel_button
		},
		type: 'confirm',
		callback: function(r) {
			if(callback) {
				callback(r);
			}
		}
	});
};

function profile_info(texts) {
	this.texts = new Array();
	this.i     = 0;

	this.start  = function() {
		if (this.texts.length) {
			this.change();
		}
	}
	this.add = function(str) {
		this.texts.push(str);
	}
	this.change = function() {
		var str = this.texts[this.i];

		$('#profile_info').hide('slow', function() {
			$('#profile_info').html(str);
		});
		
		$('#profile_info').show('slow');
		this.i++;
		if (this.i >= this.texts.length) this.i = 0;
		setTimeout("profile_info.change()", 5000);
	}
}

/*
 * jQuery Color Animations
 * Copyright 2007 John Resig
 * Released under the MIT and GPL licenses.
 */

(function(jQuery){

	// We override the animation for all of these color styles
	jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
		jQuery.fx.step[attr] = function(fx){
			if ( fx.state == 0 ) {
				fx.start = getColor( fx.elem, attr );
				fx.end = getRGB( fx.end );
			}

			fx.elem.style[attr] = "rgb(" + [
				Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
				Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
				Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
			].join(",") + ")";
		}
	});

	// Color Conversion functions from highlightFade
	// By Blair Mitchelmore
	// http://jquery.offput.ca/highlightFade/

	// Parse strings looking for color tuples [255,255,255]
	function getRGB(color) {
		var result;

		// Check if we're already dealing with an array of colors
		if ( color && color.constructor == Array && color.length == 3 )
			return color;

		// Look for rgb(num,num,num)
		if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
			return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];

		// Look for rgb(num%,num%,num%)
		if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
			return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];

		// Look for #a0b1c2
		if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
			return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];

		// Look for #fff
		if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
			return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];

		// Otherwise, we're most likely dealing with a named color
		return colors[jQuery.trim(color).toLowerCase()];
	}
	
	function getColor(elem, attr) {
		var color;

		do {
			color = jQuery.curCSS(elem, attr);

			// Keep going until we find an element that has color, or we hit the body
			if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
				break; 

			attr = "backgroundColor";
		} while ( elem = elem.parentNode );

		return getRGB(color);
	};
	
	// Some named colors to work with
	// From Interface by Stefan Petre
	// http://interface.eyecon.ro/

	var colors = {
		aqua:[0,255,255],
		azure:[240,255,255],
		beige:[245,245,220],
		black:[0,0,0],
		blue:[0,0,255],
		brown:[165,42,42],
		cyan:[0,255,255],
		darkblue:[0,0,139],
		darkcyan:[0,139,139],
		darkgrey:[169,169,169],
		darkgreen:[0,100,0],
		darkkhaki:[189,183,107],
		darkmagenta:[139,0,139],
		darkolivegreen:[85,107,47],
		darkorange:[255,140,0],
		darkorchid:[153,50,204],
		darkred:[139,0,0],
		darksalmon:[233,150,122],
		darkviolet:[148,0,211],
		fuchsia:[255,0,255],
		gold:[255,215,0],
		green:[0,128,0],
		indigo:[75,0,130],
		khaki:[240,230,140],
		lightblue:[173,216,230],
		lightcyan:[224,255,255],
		lightgreen:[144,238,144],
		lightgrey:[211,211,211],
		lightpink:[255,182,193],
		lightyellow:[255,255,224],
		lime:[0,255,0],
		magenta:[255,0,255],
		maroon:[128,0,0],
		navy:[0,0,128],
		olive:[128,128,0],
		orange:[255,165,0],
		pink:[255,192,203],
		purple:[128,0,128],
		violet:[128,0,128],
		red:[255,0,0],
		silver:[192,192,192],
		white:[255,255,255],
		yellow:[255,255,0]
	};
	
})(jQuery);
