if(typeof(jqcc) === 'undefined') {
	jqcc = jQuery;
}

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

//jqcc.cookie=function(a,b,c){if(typeof b!='undefined'){c=c||{};if(b===null){b='';c.expires=-1}var d='';if(c.expires&&(typeof c.expires=='number'||c.expires.toUTCString)){var e;if(typeof c.expires=='number'){e=new Date();e.setTime(e.getTime()+(c.expires*24*60*60*1000))}else{e=c.expires}d='; expires='+e.toUTCString()}var f=c.path?'; path='+(c.path):'';var g=c.domain?'; domain='+(c.domain):'';var h=c.secure?'; secure':'';document.cookie=[a,'=',encodeURIComponent(b),d,f,g,h].join('')}else{var j=null;if(document.cookie&&document.cookie!=''){var k=document.cookie.split(';');for(var i=0;i<k.length;i++){var l=jqcc.trim(k[i]);if(l.substring(0,a.length+1)==(a+'=')){j=decodeURIComponent(l.substring(a.length+1));break}}}return j}};


/**
 * 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;


/**
 * jqcc.ScrollTo
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 *
 * @projectDescription Easy element scrolling using jqcc.
 * http://flesler.blogspot.com/2007/10/jqccscrollto.html
 *
 * @author Ariel Flesler
 * @version 1.4.2
 *
 */

(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jqcc)>=1.3?0:1};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return $.browser.safari||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.speed||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&&function(){a.call(this,e,g)})}}).end()};h.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jqcc);(function ($) {$.gbar = function () { // new 19 old 14
	var social_friends_show = 3;
	var time_to_seperate_chat = 60;//60second
	var beep_fail = 0;
	var time_to_update_notification_time = 100;//10second
	var level_now = 0;
	var first_time_check_notification_time = 0;
	var total_new_notification = 0;
	var title_interval = 0;
	var title_original;
	var title_type = 0;
	var is_typing = false;
	var logged_in = false;
	var gbar_ajax_search = 4;
		var _0 = function()
				{
					return 'http://d0'+Math.ceil(Math.random()*9)+'.gameier.com/';
				};

		var _1 = "./";;
		var _2 = [];
		var _3 = [];
	_2[0] = 'Chat Options';
_2[1] = 'Type your message and hit the enter key!';
_2[2] = 'My Status';
_2[3] = 'Available';
_2[4] = 'Busy';
_2[5] = 'Invisible';
_2[6] = 'Add Friend';
_2[7] = '';
_2[8] = 'Please login to use chat';
_2[9] = 'Who\'s Online';
_2[10] = 'Me';
_2[11] = 'Go Offline';
_2[12] = 'Who\'s Online';
_2[13] = 'Disable sound notifications';
_2[14] = 'You have no friends in your friend list, please add a few friends to use chat';
_2[15] = '(New Messages...)';
_2[16] = '';
_2[17] = 'Notification';
_2[18] = 'Support';
_2[19] = 'Please login to use ';
_2[20] = 'Logout';
_3[0] = ['notification','Notification','/modules/chatrooms/index.php','_popup_normal','230px','auto','must_login'];
var _4 = ['filetransfer','divider','chathistory','clearconversation','chattime','send_sms'];
var _5 = 0;var _6 = 1;var _7 = 'dark';var _8 = 1000;var _9 = 90000;		var _a = "gb_";
		var _b = {};
		var _c = {};
		var _d = {};
		var _e = "";
		var _f = 0;
		var _10 = 0;
		var _11 = true;
		var _12 = 0;
		var ie6 = false;
		var _13;
		var _14;
		var _15 = 5000;
		var _16 = 1;
		var _17 = 0;
		var _18 = 0;
		var _19 = 0;
		var _1a = "";
		var _1b = document.title;
		var _1c = 0;
		var _1d = {};
		var _1e = {};
		var _1f = {};
		var _1mobile = {};
		var _20 = {};
		var _21 = {};
		var _22 = {};
		var _23 = {};
		var timing_for_get_id = {};
		var _25 = {};
		var _26 = new Date;
		var _27 = _26.getDate();
		var _28 = Math.floor(_26.getTime() / 1000);
		$("<div id=\"bottom_bar\"></div>").appendTo($("body"));
		$.ajaxSetup({scriptCharset: "utf-8", cache: "false"});
		if (_6 == 1)
		{
			$("<div id=\"gbarflashcontent\" style=\"width: 1px; height: 1px;\"></div>").appendTo($("#bottom_bar"));
			var _29 = {};
			var _2a = {};
			var _2b = {id: "cometchatbeep", name: "cometchatbeep"};
			var so;
			so = new SWFObject(_1 + "swf/sound.swf", "cometchatbeep", "1", "1", "8", "#ffffff");
			so.write("gbarflashcontent");
		}

		function _2c(_2d) {
			var _2e = navigator.appName.indexOf("Microsoft") != -1;
			return _2e ? window[_2d] : document[_2d];
		}


		function _2f()
		{

			try
			{
				_2c("cometchatbeep").cometchatbeep();
			}
			catch (error)
			{
				if(beep_fail < 5)
				{
					beep_fail++;
					setTimeout(function(){_2f();},500);
					return;
				}
				else
				{
					_6 = 0;
				}
			}
		}


		function _30(id, _31, _32) {
			if ($("#gbar_tooltip").length > 0) {
				$("#gbar_tooltip .gbar_tooltip_content").html(_31);
			} else {
				$("#bottom_bar"
				).append("<div id=\"gbar_tooltip\"><div class=\"gbar_tooltip_content\">" + _31 + "</div></div>");
			}
			var pos = $("#" + id).offset();
			var _33 = $("#" + id).width();
			var _34 = $("#gbar_tooltip").width();
			if (_32 == 1) {
				$("#gbar_tooltip").css("bottom", 29).css("left", pos.left + _33 - 16).css("display", "block").addClass("gbar_tooltip_left");
			} else {
				$("#gbar_tooltip").css("bottom", 29).css("left", pos.left + _33 - _34 + 12).css("display", "block").removeClass("gbar_tooltip_left");
			}
			if (ie6) {
				$("#gbar_tooltip").css("position", "absolute");
				$("#gbar_tooltip").css("top", parseInt($(window).height()) - parseInt($("#gbar_tooltip").css("bottom")) - parseInt($("#gbar_tooltip").height()) + $(window).scrollTop() + "px");
			}
		}

		//this is function when user shift+enter and send msg
		function _35(_36, _37, id) {
			if (_36.keyCode == 13 && _36.shiftKey == 0) {
				var _38 = $(_37).val();
				_38 = _38.replace(/^\s+|\s+$/g, "");
				$(_37).val("");
				$(_37).css("height", "18px");
				$("#gbar_user_" + id + "_popup .gbar_tabcontenttext").css("height", "200px");
				$(_37).css("overflow-y", "hidden");
				$(_37).focus();
				if (_38 != "") {
					if($("#gbar_userstab_icon").hasClass("gbar_user_away2"))
					{
						_45('available');
//						$("#gbar_userstab_icon").addClass("gbar_user_available2");
					}
					is_typing = false;
					random_id = Math.floor(Math.random()*100000);
					var message_timeout = setTimeout(function(){_aa(id, _38, "1", "1", "temp"+random_id , "1", Math.floor((new Date()).getTime() / 1000));}, 300);
					$.ajax({
						type: 'POST',
						url: _1 + "gbar_send.php",
						dataType: "json",
						data: {
								mode: 'send_message',
								to: id,
								message: _38,
								random_id: random_id
								},
						success: function(_39){
								if (_39.id)
								{
									clearInterval(message_timeout);
									$('#gbar_message_temp'+_39.random_id).remove();
									_aa(id, _38, "1", "1", _39.id, 1, Math.floor((new Date).getTime() / 1000));
									$("#gbar_user_" + id + "_popup .gbar_tabcontenttext")
									.scrollTop($("#gbar_user_" + id + "_popup .gbar_tabcontenttext")[0].scrollHeight);
								}
								_16 = 1;
								if (_15 > _8)
								{
									_15 = _8;
									clearTimeout(_13);
									_13 = setTimeout(function () {_3a();}, _8);
								}
						},
						error: function(){
								$('#gbar_message_temp'+random_id).html($('#gbar_message_temp'+random_id+' .gbar_chatboxmessagecontent').html() + ' has fail to deliver.');
						}
					});

				}
				return false;
			}
		}


		function _3b(_3c, _3d) {
			if (_3c.keyCode == 13 && _3c.shiftKey == 0) {
				var _3e = $(_3d).val();
				if (_3e != "") {
					$.post(_1 + "gbar_send.php", {mode: 'send_status_message', statusmessage: _3e}, function (_3f) {$(_3d).blur();});
				}
				return false;
			}
		}


		function _40(_41, _42, id) {
			var _43 = _42.clientHeight;
			var _44 = 94;
			if (_44 > _43) {
				_43 = Math.max(_42.scrollHeight, _43);
				if (_44) {
					_43 = Math.min(_44, _43);
				}
				if (_43 > _42.clientHeight) {
					$(_42).css("height", _43 + 4 + "px");
					$("#gbar_user_" + id + "_popup .gbar_tabcontenttext").css("height", 218 - (_43 + 4) + "px");
				}
			} else {
				$(_42).css("overflow-y", "auto");
			}
			$("#gbar_user_" + id + "_popup .gbar_tabcontenttext").scrollTop($("#gbar_user_" + id + "_popup .gbar_tabcontenttext")[0].scrollHeight);
		}


		function _45(status) {
			$("#gbar_top_change_status_option .busy").css("text-decoration", "none");
			$("#gbar_top_change_status_option .away").css("text-decoration", "none");
			$("#gbar_top_change_status_option .invisible").css("text-decoration", "none");
			$("#gbar_top_change_status_option .available").css("text-decoration", "none");
			$("#gbar_userstab_icon").removeClass("gbar_user_available2");
			$("#gbar_userstab_icon").removeClass("gbar_user_away2");
			$("#gbar_userstab_icon").removeClass("gbar_user_busy2");
			$("#gbar_userstab_icon").removeClass("gbar_user_invisible2");
			//change to
			//$('gbar_user_status_top').();
			$('#gbar_user_status_top').html('(' + status + ') <img src="./images/dropdown_triangle.gif" alt="" />');
			$("#gbar_userstab_icon").addClass("gbar_user_" + status + "2");
			$("#gbar_top_change_status_option ." + status).css("text-decoration", "underline");
		}


		function _46(_47) {
			$.post(_1 + "gbar_send.php", {mode: 'send_status', status: _47}, function (_48) {});
		}


		function _49(_4a) {
			_10 = 1;
			_45('invisible');
//			$("#gbar_userstab_icon").addClass("gbar_user_invisible2");
			if (_4a != 1) {
				_46("offline");
			}
			$("#gbar_userstab_popup").removeClass("gbar_tabopen");
			$("#gbar_userstab").removeClass("gbar_userstabclick").removeClass("gbar_tabclick");
			$("#gbar_optionsbutton_popup").removeClass("gbar_tabopen");
			$("#gbar_optionsbutton").removeClass("gbar_tabclick");
			_4b("buddylist", "0");
			$("#gbar_userstab_text").html(_2[17]);
		}


		function _4c() {
			$("<span/>").attr("id", "gbar_optionsbutton").addClass("gbar_tab").addClass("gbar_optionsimages").appendTo($("#gbar_base"));
			temp = '<div class="gbar_userstabtitle">' + _2[0] + '</div>';
			temp += '<div class="gbar_tabsubtitle">';
			temp += '<span class="gbar_opt_tab" style="cursor:pointer" onclick="$(this).siblings().removeClass(\'gbar_opt_tab\');$(this).addClass(\'gbar_opt_tab\');$(\'#gbar_options_addfriend\').show();$(\'#gbar_options_setting\').hide()">Add Friend</span>';
			temp += '<span style="cursor:pointer" onclick="$(this).siblings().removeClass(\'gbar_opt_tab\');$(this).addClass(\'gbar_opt_tab\');$(\'#gbar_options_addfriend\').hide();$(\'#gbar_options_setting\').show()">Setting</span>';
			temp += '</div>';
			temp += '<div class="gbar_tabcontent gbar_optionstyle" style="min-height:200px">';
			temp += '<div id="gbar_options_addfriend">';
			temp += '<p><b><img style="vertical-align:middle" src="images/social/icon/add_friend.png" /> Add a Friend</b></p><span>Find <input type="text" id="gbar_friend_search_input" /></span><br />';
			temp += '<span class="more_link">**E.g, joe@email.com / joe1990</span><br /><br />';
			temp += '<b>Users</b>';
			temp += '<div id="gbar_social_search_username">';
			temp += '</div>';
			temp += '<b>In-Game Character Name</b>';
			temp += '<div id="gbar_social_search_charactername">';
			temp += '</div>';
			temp += '</div>';
			temp += '<div id="gbar_options_setting" style="display:none">';
			temp += '<span><input type="checkbox" id="gbar_soundnotifications">' + _2[13] + '</span>';
			temp += '</div>';
			temp += '</div>';
			$("<div/>").attr("id", "gbar_optionsbutton_popup").addClass("gbar_tabpopup").css("display", "none").html(temp).appendTo($("#bottom_bar"));
			$("#gbar_soundnotifications").click(function (_4d) {$.cookie(_a + "sound", $("#gbar_soundnotifications").attr("checked"), {path: "/", expires: 365});});
			$("#gbar_optionsbutton_popup .gbar_statustextarea").keydown(function (_51) {return _3b(_51, this);});
			$("#gbar_optionsbutton").mouseover(function () {if (!$("#gbar_optionsbutton_popup").hasClass("gbar_tabopen")) {if (_f == 0) {_30("gbar_optionsbutton", _2[0]);} else {_30("gbar_optionsbutton", _2[8]);}}$(this).addClass("gbar_tabmouseover");});
			$("#gbar_optionsbutton").mouseout(function () {$(this).removeClass("gbar_tabmouseover");$("#gbar_tooltip").css("display", "none");});
			$("#gbar_optionsbutton").click(function ()
										{
											if (_1a != "")
											{
												$("#gbar_trayicon_" + _1a + "_popup").removeClass("gbar_tabopen");
												$("#gbar_trayicon_" + _1a).removeClass("gbar_trayclick");
												_1a = "";
											}
											if (_f == 0)
											{
												if (_10 == 1)
												{
													_10 = 0;
													$("#gbar_userstab_text").html(_2[9] + " (" + _19 + ")");
													_3a();
													$("#gbar_optionsbutton_popup .available").click();
												}
												$("#gbar_tooltip").css("display", "none");
												$("#gbar_optionsbutton_popup").css("left", $("#gbar_optionsbutton").position().left - 171).css("bottom", "24px");
												$(this).toggleClass("gbar_tabclick");
												$("#gbar_optionsbutton_popup").toggleClass("gbar_tabopen");
												$("#gbar_optionsbutton").toggleClass("gbar_optionsimages_click");
												$("#gbar_userstab_popup").removeClass("gbar_tabopen");
												$("#gbar_userstab").removeClass("gbar_userstabclick").removeClass("gbar_tabclick");
												_4b("buddylist", "0");
												if ($.cookie(_a + "sound"))
												{
													if ($.cookie(_a + "sound") == "true")
													{
														$("#gbar_soundnotifications").attr("checked", true);
													}
													else
													{
														$("#gbar_soundnotifications").attr("checked", false);
													}
												}
												$('#gbar_optionsbutton_popup .gbar_tabcontent').find('input:visible').select().focus();
											}
											else
											{
												if (_2[16] != "")
												{
													location.href = _2[16];
												}
											}
										});
			$("#gbar_optionsbutton_popup .gbar_userstabtitle").click(function () {$("#gbar_optionsbutton").click();});
			$("#gbar_optionsbutton_popup .gbar_userstabtitle").mouseenter(function () {$(this).addClass("gbar_chatboxtabtitlemouseover2");});
			$("#gbar_optionsbutton_popup .gbar_userstabtitle").mouseleave(function () {$(this).removeClass("gbar_chatboxtabtitlemouseover2");});
			$('#gbar_friend_search_input').keypress(function (e) {
				gbar_ajax_search++;
				if(e.which == 13 && gbar_ajax_search > 5)
				{
					gbar_ajax_search = 0;
					if($(this).val().length < 3)
					{
						$(this).tipsy({show: true, fallback: 'Please type at least 3 character for better search result'});
					}
					else
					{
						$('#gbar_social_search_username').html('<img src="./images/loading.gif" alt="" />');
						$('#gbar_social_search_charactername').html('<img src="./images/loading.gif" alt="" />');
						$.getJSON("ajax_social.php?mode=social_search_name&q="+$(this).val(),
								function(data){
									if(data)
									{
										gbar_ajax_search = 4;
										var username_div = '';
										var charactername_div = '';
										$.each(data, function(i,val){
											if(i == 'username')
											{
												$.each(val, function(i2,val2){
													username_div += '<div>';// class="avatar">';
													username_div += '<a href="'+val2.u_personal_page+'">';
													username_div += '<img src="'+val2.user_avatar+'" alt="" style="max-height:10px" />';
													username_div += '</a>';
													username_div += '</div>';
													username_div += '<div>';// class="profile">';
													username_div += '<a href="'+val2.u_personal_page+'">'+highlight(val2.username,$('#gbar_friend_search_input').val())+'</a>';
													username_div += '<br />'+val2.user_game_v+'</div>';
													username_div += '<div>';// class="options">';
													switch(parseInt(val2.friend))
													{
														case 1:
																username_div += '<span onclick="social_add_friend(' + val2.user_id + ', \'' + val2.username + '\');" class="link">Add</span>';
														break;
														case 2:
																username_div += '<span>'+val2.username+' is waiting for your confirmation.</span>';
														break;
														case 3:
																username_div += '<span>Friend request to '+val2.username+' has been sent.</span>';
														break;
														case 4:
																username_div += '<span>'+val2.username+' is your friend.</span>';
														break;
													}
													username_div += '</div><br class="clear" />';
												});
											}
											if(i == 'charactername')
											{
												$.each(val, function(i2,val2){
													charactername_div += '<div>';// class="avatar">';
													username_div += '<a href="'+val2.u_personal_page+'">';
													username_div += '<img src="'+val2.user_avatar+'" alt="" style="max-height:10px"/>';
													username_div += '</a>';
													username_div += '</div>';
													username_div += '<div>';// class="profile">';
													username_div += '<a href="'+val2.u_personal_page+'">'+highlight(val2.charactername,$('#gbar_friend_search_input').val())+'</a>';
													username_div += '<br />'+val2.user_game_v+'</div>';
													username_div += '<div>';// class="options">';
													switch(parseInt(val2.friend))
													{
														case 1:
																charactername_div += '<span onclick="social_add_friend(' + val2.user_id + ', \'' + val2.username + '\');" class="link">Add</span>';
														break;
														case 2:
																charactername_div += '<span>'+val2.username+' is waiting for your confirmation.</span>';
														break;
														case 3:
																charactername_div += '<span>Friend request to '+val2.username+' has been sent.</span>';
														break;
														case 4:
																charactername_div += '<span>'+val2.username+' is your friend.</span>';
														break;
													}
													charactername_div += '</div><br class="clear" />';
												});
											}
										});
										setTimeout(function(){}, 500);
									}
									$('#social_search_no_result').hide();
									$('#gbar_social_search_username').css('display','none').html((username_div)?username_div:'No result').show('slow');
									$('#gbar_social_search_charactername').css('display','none').html((charactername_div)?charactername_div:'No result').show('slow');
									$('#social_search_got_result').show('slow');
									setTimeout(function(){check_options_height();}, 500);
						});
					}
				}
			});
		}


		function _52() {
			var _53 = "";
			var _54 = 0;
			for (chatbox in _22) {
				if (_22.hasOwnProperty(chatbox)) {
					if (_22[chatbox] != null) {
						_53 += chatbox + "|" + _22[chatbox] + ",";
						if (_22[chatbox] > 0) {
							_54 = 1;
						}
					}
				}
			}
			_1c = _54;
			_53 = _53.slice(0, -1);
			_4b("activeChatboxes", _53);
		}

		//create pop up chatbox
		function _55(id, _56, _57, _58, _59, _5a, _5b, _5c) {
			if (id == null || id == "") {
				return;
			}
			if (_1d[id] == null || _1d[id] == "") {
				if (timing_for_get_id[id] != 1) {
					timing_for_get_id[id] = 1;
					$.ajax({
								url: _1 + "gbar_getid.php",
								data: {userid: id},
								type: "post",
								cache: false,
								dataFilter: function (_5d)
											{
												if (typeof JSON !== "undefined" && typeof JSON.parse === "function")
												{
													return JSON.parse(_5d);
												}
												else
												{
													return eval("(" + _5d + ")");
												}
											},
								success: function (_5e)
											{
												if(_5e)
												{
													_56 = _1d[id] = _5e.n;
													_57 = _1f[id] = _5e.s;
													_58 = _1e[id] = _5e.m;
													_59 = _20[id] = _5e.a;
													_5a = _21[id] = _5e.l;
													mobile = _1mobile[id] = _5e.mobile;
													if(_23[id] != null)
													{
														$("#gbar_user_" + id + " .gbar_closebox_bottom_status")
														.removeClass("gbar_available")
														.removeClass("gbar_busy")
														.removeClass("gbar_offline")
														.addClass("gbar_" + _57);
														if ($("#gbar_user_" + id + "_popup").length > 0)
														{
															$("#gbar_user_" + id + "_popup .gbar_tabsubtitle .gbar_message").html(_58);
														}
													}
													timing_for_get_id[id] = 0;
													_5f(id, _56, _57, _58, _59, _5a, _5b, _5c, mobile);
												}
											}
							});
				} else {
					setTimeout(function () {_55(id, _1d[id], _1f[id], _1e[id], _20[id], _21[id], _5b, _5c);}, 500);
				}
			} else {
				_5f(id, _1d[id], _1f[id], _1e[id], _20[id], _21[id], _5b, _5c, _1mobile[id]);
			}
		}


		function _5f(id, _60, _61, _62, _63, _64, _65, _66, mobile) {
/*
try{console.log(id);} catch(e){}
try{console.log(_61);} catch(e){}
try{console.log(_62);} catch(e){}
try{console.log(_63);} catch(e){}
try{console.log(_64);} catch(e){}
try{console.log(_65);} catch(e){}
try{console.log(_66);} catch(e){}
try{console.log(mobile);} catch(e){}
try{console.log('aaaaaaaaaaaaaaa');} catch(e){}
*/
			if (_23[id] != null) {
				if (!$("#gbar_user_" + id).hasClass("gbar_tabclick") &&
					_65 != 1) {
					if (_e != "") {
						$("#gbar_user_" + _e + "_popup").removeClass("gbar_tabopen");
						$("#gbar_user_" + _e).removeClass("gbar_tabclick").removeClass("gbar_usertabclick");
						_e = "";
						_4b("openChatboxId", _e);
					}
					if ($("#gbar_user_" + id).offset().left < $("#gbar_chatboxes").offset().left + $("#gbar_chatboxes").width() &&
						$("#gbar_user_" + id).offset().left - $("#gbar_chatboxes").offset().left >= 0) {
						$("#gbar_user_" + id).click();
					} else {
						$(".gbar_tabalert").css("display", "none");
						var ms = 800;
						if (_67("initialize") == 1) {
							ms = 0;
						}
						$("#gbar_chatboxes").scrollTo("#gbar_user_" + id, ms, function () {$("#gbar_user_" + id).click();_6e();_83();});
					}
				}
				_6e();
				return;
			}
			$("#gbar_chatboxes_wide").width($("#gbar_chatboxes_wide").width() + 152);
			_88();
			if (_60.length > 12) {
				shortname = _60.substr(0, 12) + "...";
			} else {
				shortname = _60;
			}
			if (_60.length > 24) {
				longname = _60.substr(0, 24) + "...";
			} else {
				longname = _60;
			}
			$("<span/>").attr("id", "gbar_user_" + id).addClass("gbar_tab").html("<div style=\"float:left\">" + shortname + "</div>").appendTo($("#gbar_chatboxes_wide"));
			$("#gbar_user_" + id).append("<div class=\"gbar_closebox_bottom_status gbar_" + _61 + "\"></div>");
			$("#gbar_user_" + id).append("<div class=\"gbar_closebox_bottom\"></div>");
			$("#gbar_user_" + id + " .gbar_closebox_bottom").mouseenter(function () {$(this).addClass("gbar_closebox_bottomhover");});
			$("#gbar_user_" + id + " .gbar_closebox_bottom").mouseleave(function () {$(this).removeClass("gbar_closebox_bottomhover");});
			$("#gbar_user_" + id + " .gbar_closebox_bottom").click(function () {$("#gbar_user_" + id + "_popup").remove();$("#gbar_user_" + id).remove();if (_e == id) {_e = "";_4b("openChatboxId", _e);}$("#gbar_chatboxes_wide").width($("#gbar_chatboxes_wide").width() - 152);$("#gbar_chatboxes").scrollTo("-=152px");_88();_22[id] = null;_23[id] = null;_25[id] = 0;_52();});
			var _68 = "";
			var file_transfer = false;
			if (_4.length > 0) {
				_68 += "<div class=\"gbar_plugins\">";
				for (var i = 0; i < _4.length; i++) {
					if (_4[i] == "divider") {
						_68 += "<img src=\"" + _1 + "themes/" + _7 + "/images/divider.png\" class=\"gbar_pluginsicon_divider\">";
					}
					else if(_4[i] == "send_sms")
					{
						if(mobile)
						{
							_60 = "cc" + _4[i];
							_68 += "<img src=\"" + _1 + "plugins/" + _4[i] + "/icon.png\" id=" + _60 + id + " class=\"gbar_pluginsicon\" title=\"" + $[_60].getTitle() + "\" onmouseenter=\"this.style.cursor='pointer'\" onclick=\"javascript:jqcc." + _60 + ".init(" + id + ");\">";
						}
					}
					else
					{
						_60 = "cc" + _4[i];
						_68 += "<img src=\"" + _1 + "plugins/" + _4[i] + "/icon.png\" id=" + _60 + id + " class=\"gbar_pluginsicon\" title=\"" + $[_60].getTitle() + "\" onmouseenter=\"this.style.cursor='pointer'\" onclick=\"javascript:jqcc." + _60 + ".init(" + id + ");\">";
					}
					if (_4[i] == "filetransfer") {
					file_transfer = true;	
					}
				}
				if(file_transfer)
				{
					_68 += "<div class='text' style='display:none'>Uploading</div>";
				}
				_68 += "</div>";
			}
			var _69 = "";
			var _6a = "";
			if (_64 != "") {
				_69 = "<a href=\"" + _64 + "\">";
				_6a = "</a>";
			}
			var _6b = "";
			if (_63 != "") {
				_6b = "<div class=\"gbar_avatarbox\">" + _69 + "<img src=\"" + _63 + "\" class=\"gbar_avatar\" />" + _6a + "</div>";
			}
			$("<div/>").attr("id", "gbar_user_" + id + "_popup").addClass("gbar_tabpopup").css("display", "none").html("<div class=\"gbar_tabtitle\"><div class=\"gbar_name\">" + _69 + longname + _6a + "</div></div><div class=\"gbar_tabsubtitle\">" + _6b + "<div class=\"gbar_message\">" + _62 + "</div>" + _68 + "<div style=\"clear:both\"></div>" + "</div><div class=\"gbar_tabcontent\"><div class=\"gbar_tabcontenttext\" id=\"gbar_tabcontenttext_" + id + "\"></div><div class=\"gbar_tabcontentinput\"><textarea class=\"gbar_textarea\" ></textarea></div></div>").appendTo($("#bottom_bar"));
			if(file_transfer)
			{
				new AjaxUpload('#ccfiletransfer'+ id, {
				  // Location of the server-side upload script
				  // NOTE: You are not allowed to upload files to another domain
				  action: '/plugins/filetransfer/upload.php',
				  // File upload name
				  name: 'userfile',
				  // Additional data to send
				  data: {
						'to' : id
					},
				  // Submit file after selection
				  autoSubmit: true,
				  // The type of data that you're expecting back from the server.
				  // HTML (text) and XML are detected automatically.
				  // Useful when you are using JSON data as a response, set to "json" in that case.
				  // Also set server response type to text/html, otherwise it will not work in IE6
				  responseType: "json",
				  // Fired after the file is selected
				  // Useful when autoSubmit is disabled
				  // You can return false to cancel upload
				  // @param file basename of uploaded file
				  // @param extension of that file
				  onChange: function(file, extension){},
				  // Fired before the file is uploaded
				  // You can return false to cancel upload
				  // @param file basename of uploaded file
				  // @param extension of that file
				  onSubmit: function(file, ext) {
						$('#ccfiletransfer'+ id).siblings('.text').show();
						if (ext && /^(jpg|png|jpeg|gif)$/.test(ext))
						{
							/* Setting data */
							$('#ccfiletransfer'+ id).siblings('.text').text('Uploading ' + file);
							// Uploding -> Uploading. -> Uploading...
							interval = window.setInterval(function()
							{
								var text = $('#ccfiletransfer'+ id).siblings('.text').text();
								if (text.length < 13)
								{
									$('#ccfiletransfer'+ id).css('color','').siblings('.text').text(text + '.');
								}
								else
								{
									$('#ccfiletransfer'+ id).css('color','').siblings('.text').text('Uploading');
								}
							}, 200); 
						}
						else
						{
							// extension is not allowed
							$('#ccfiletransfer'+ id).siblings('.text').css('color','red').text('Error: only images are allowed');
							setTimeout(function(){$('#ccfiletransfer'+ id).siblings('.text').hide("slow");},5000);
							// cancel upload
							return false;
						} 
				  },
				  // Fired when file upload is completed
				  // WARNING! DO NOT USE "FALSE" STRING AS A RESPONSE!
				  // @param file basename of uploaded file
				  // @param response server response
				  onComplete: function(file, response) {
					window.clearInterval(interval); 
					this.enable();
					if(response.status == 0)
					{
						$('#ccfiletransfer'+ id).siblings('.text').css('color','red').text('Upload fail: '+response.error);
					}
					else
					{
						$('#ccfiletransfer'+ id).siblings('.text').css('color','green').text('Upload '+response.name+' Success');
					}
					setTimeout(function(){$('#ccfiletransfer'+ id).siblings('.text').hide("slow")},5000);
				  }
				});
			}
			$("#gbar_user_" + id + "_popup .gbar_textarea").keydown(function (_6c)
																{
																	return _35(_6c, this, id);
																});
			$("#gbar_user_" + id + "_popup .gbar_textarea").keyup(function (_6d)
															{
																if(!is_typing && $(this).val().length > 0)
																{
																	is_typing=true;
																	$.post(_1+"gbar_send.php",{mode:'typing', id:id});
																}
																else if(is_typing &&  $(this).val().length == 0)
																{
																	is_typing=false;
																	$.post(_1+"gbar_send.php",{mode:'not_typing', id:id});
																}
																return _40(_6d, this, id);
															});
//			$("#gbar_user_" + id + "_popup .gbar_textarea").focus(function () {if(!is_typing){is_typing=true;$.post(_1+"gbar_send.php",{mode:'typing', id:id});}return true;});
			$("#gbar_user_" + id + "_popup .gbar_textarea").blur(function ()
															{
																if(is_typing)
																{
																	is_typing = false;
																	$.post(_1+"gbar_send.php",{mode:'not_typing', id:id});
																}
																return true;
															});
			$("#gbar_user_" + id + "_popup .gbar_tabtitle").append("<div class=\"gbar_closebox\"></div><br clear=\"all\"/>");
			$("#gbar_user_" + id + "_popup .gbar_tabtitle .gbar_closebox").mouseenter(function () {$(this).addClass("gbar_chatboxmouseoverclose");$("#gbar_user_" + id + "_popup .gbar_tabtitle").removeClass("gbar_chatboxtabtitlemouseover");});
			$("#gbar_user_" + id + "_popup .gbar_tabtitle .gbar_closebox").mouseleave(function () {$(this).removeClass("gbar_chatboxmouseoverclose");$("#gbar_user_" + id + "_popup .gbar_tabtitle").addClass("gbar_chatboxtabtitlemouseover");});
			$("#gbar_user_" + id + "_popup .gbar_tabtitle .gbar_closebox").click(function () {$("#gbar_user_" + id + "_popup").remove();$("#gbar_user_" + id).remove();if (_e == id) {_e = "";_4b("openChatboxId", _e);}$("#gbar_chatboxes_wide").width($("#gbar_chatboxes_wide").width() - 152);$("#gbar_chatboxes").scrollTo("-=152px");_88();_23[id] = null;_22[id] = null;_25[id] = 0;_52();});
			$("#gbar_user_" + id + "_popup .gbar_tabtitle").click(function () {$("#gbar_user_" + id).click();});
			$("#gbar_user_" + id + "_popup .gbar_tabtitle").mouseenter(function () {$(this).addClass("gbar_chatboxtabtitlemouseover");});
			$("#gbar_user_" + id + "_popup .gbar_tabtitle").mouseleave(function () {$(this).removeClass("gbar_chatboxtabtitlemouseover");});
			$("#gbar_user_" + id).mouseenter(function () {$(this).addClass("gbar_tabmouseover");$("#gbar_user_" + id + " div").addClass("gbar_tabmouseovertext");});
			$("#gbar_user_" + id).mouseleave(function () {$(this).removeClass("gbar_tabmouseover");$("#gbar_user_" + id + " div").removeClass("gbar_tabmouseovertext");});
			$("#gbar_user_" + id).click(
				function ()
				{
					if (_1a != "")
					{
						$("#gbar_trayicon_" + _1a + "_popup").removeClass("gbar_tabopen");
						$("#gbar_trayicon_" + _1a).removeClass("gbar_trayclick");
						_1a = "";
					}
					if ($("#gbar_user_" + id + " .gbar_tabalert").length > 0)
					{
						$("#gbar_user_" + id + " .gbar_tabalert").remove();
						_23[id] = 0;
						_22[id] = 0;
						_52();
					}
					if ($(this).hasClass("gbar_tabclick"))
					{
						$(this).removeClass("gbar_tabclick").removeClass("gbar_usertabclick");
						$("#gbar_user_" + id + "_popup").removeClass("gbar_tabopen");
						$("#gbar_user_" + id + " .gbar_closebox_bottom").removeClass("gbar_closebox_bottom_click");
						_e = "";
						_4b("openChatboxId", _e);
					}
					else
					{
						if (_e != "")
						{
							$("#gbar_user_" + _e + "_popup").removeClass("gbar_tabopen");
							$("#gbar_user_" + _e).removeClass("gbar_tabclick").removeClass("gbar_usertabclick");
							$("#gbar_user_" + _e + " .gbar_closebox_bottom").removeClass("gbar_closebox_bottom_click");
							_e = "";
							_4b("openChatboxId", _e);
						}
						if (!($("#gbar_user_" + id).offset().left < $("#gbar_chatboxes").offset().left + $("#gbar_chatboxes").width() &&
							$("#gbar_user_" + id).offset().left - $("#gbar_chatboxes").offset().left >= 0))
						{
							$("#gbar_chatboxes").scrollTo("#gbar_user_" + id);
							_6e();
						}
						$("#gbar_user_" + id + "_popup").css("left", $("#gbar_user_" + id).position().left - 62).css("bottom", "24px");
						$(this).addClass("gbar_tabclick").addClass("gbar_usertabclick");
						$("#gbar_user_" + id + "_popup").addClass("gbar_tabopen");
						$("#gbar_user_" + id + " .gbar_closebox_bottom").addClass("gbar_closebox_bottom_click");
						_e = id;
						_4b("openChatboxId", _e);
						if (_25[id] != 1 && _67("initialize") != 1) {
							_6f(id);
							_25[id] = 1;
						}
						if (ie6) 
						{
							$("#gbar_user_" + _e + "_popup").css("position", "absolute");
							$("#gbar_user_" + _e + "_popup").css("top", parseInt($(window).height()) - parseInt($("#gbar_user_" + _e + "_popup").css("bottom")) - parseInt($("#gbar_user_" + _e + "_popup").height()) + $(window).scrollTop() + "px");
						}
					}
					$("#gbar_user_" + id + "_popup .gbar_tabcontenttext").scrollTop($("#gbar_user_" + id + "_popup .gbar_tabcontenttext")[0].scrollHeight);
					if (_70("updatingsession") != 1 && $('#gbar_user_'+id+'_popup').is(':visible')) {
						$("#gbar_user_" + id + "_popup .gbar_textarea").focus();
					}
				}
			);
//			$('.gbar_tabcontenttext').click(function(){
//				$(this).next().children('.gbar_textarea').select().focus();
//			});
			if (_65 != 1) {
				$("#gbar_user_" + id).click();
			}
			_22[id] = 0;
			_23[id] = 0;
			_52();
		}


		function _71(ts) {
			var ap = "am";
			var _72 = ts.getHours();
			var _73 = ts.getMinutes();
			var _74 = ts.getDate();
			var _75 = ts.getMonth();
			if (_72 > 11) {
				ap = "pm";
			}
			if (_72 > 12) {
				_72 = _72 - 12;
			}
			if (_72 == 0) {
				_72 = 12;
			}
			if (_72 < 10) {
				_72 = _72;
			}
			if (_73 < 10) {
				_73 = "0" + _73;
			}
			var _76 = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
			var _77 = "th";
			if (_74 == 1 || _74 == 21 || _74 == 31) {
				_77 = "st";
			} else {
				if (_74 == 2 || _74 == 22) {
					_77 = "nd";
				} else {
					if (_74 == 3 || _74 == 23) {
						_77 = "rd";
					}
				}
			}
			if (_74 != _27) {
				return "<span class=\"gbar_ts\">(" + _72 + ":" + _73 + ap + " " + _74 + _77 + " " + _76[_75] + ")</span>";
			} else {
				return "<span class=\"gbar_ts\">(" + _72 + ":" + _73 + ap + ")</span>";
			}
		}


		function _6f(id) {
			$('#gbar_tabcontenttext_'+id).prepend('<div align="center"><img src="./images/loading2.gif" alt="" /></div>');
			$.ajax({
					cache: false,
					url: "gbar_receive.php",
					data: {chatbox: id},
					dataType: "json",
					type: "GET",
					dataFilter: function (_78)
								{
									if (typeof JSON !== "undefined" && typeof JSON.parse === "function")
									{
										return JSON.parse(_78);
									}
									else
									{
										return eval("(" + _78 + ")");
									}
								},
					success: function (_79)
							{
								if (_79)
								{
									$("#gbar_user_" + id + "_popup .gbar_tabcontenttext").html("");
									var _7a = "";
									var _7b = _1d[id];
									$.each(_79, function (_7c, _7d) 
												{
													if (_7c == "messages") 
													{
														$.each(_7d, function (i, _7e) 
																	{
																		var _7f = "";
																		if (_7e.self == 1) 
																		{
																			fromname = _2[10];
																			_7f = " gbar_self";
																		}
																		else 
																		{
																			fromname = _7b;
																		}
																		var ts = new Date(_7e.sent * 1000);
																		if (fromname.indexOf(" ") != -1) 
																		{
																			fromname = fromname.slice(0, fromname.indexOf(" "));
																		}
																		_7a += "<div class=\"gbar_chatboxmessage\" id=\"gbar_message_" + _7e.id + "\"><span class=\"gbar_chatboxmessagefrom" + _7f + "\"><strong>" + fromname + "</strong>:&nbsp;&nbsp;</span><span class=\"gbar_chatboxmessagecontent" + _7f + "\">" + _7e.message + "</span>" + _71(ts) + "</div>";
																	});
													}
												});
									if ($("gbar_tabcontenttext_" + id).length > 0) 
									{
										_d3("gbar_tabcontenttext_" + id, "<div>" + _7a + "</div>" + document.getElementById("gbar_tabcontenttext_" + id).innerHTML);
									} 
									else 
									{
										document.getElementById("gbar_tabcontenttext_" + id).innerHTML = "<div>" + _7a + "</div>";
									}
									$("#gbar_tabcontenttext_" + id).scrollTop(50000);
								}
							}
				});
		}


		function _80(id, _81, add) {
			if (_1d[id] == null || _1d[id] == "") {
				setTimeout(function () {_80(id, _81, add);}, 500);
			} else {
				_82(id);
				if (add == 1) {
					if ($("#gbar_user_" + id + " .gbar_tabalert").length > 0) {
						_81 = parseInt($("#gbar_user_" + id + " .gbar_tabalert").html()) + parseInt(_81);
					}
				}
				if (_81 == 0) {
					$("#gbar_user_" + id + " .gbar_tabalert").remove();
				} else {
					if ($("#gbar_user_" + id + " .gbar_tabalert").length > 0) {
						$("#gbar_user_" + id + " .gbar_tabalert").html(_81);
					} else {
						$("<div/>").css("top", "-5px").addClass("gbar_tabalert").html(_81).appendTo($("#gbar_user_" + id));
					}
				}
				_22[id] = _81;
				_52();
				_83();
			}
		}


		function _84() {
			var _85 = $.cookie(_a + "state");
			var _86 = 0;
			if (_85 != null) {
				var _87 = _85.split(/:/);
				_86 = _87[3];
			}
			$("<span/>").attr("id", "gbar_userstab").addClass("gbar_tab").html("<span id=\"gbar_userstab_icon\"></span><span id=\"gbar_userstab_text\" style=\"float:left\">" + _2[9] + " (" + _86 + ")</span>").appendTo($("#gbar_base"));
			temp  = '<div class="gbar_userstabtitle">';
			temp += '<a href="/" /><img src="./images/favicon.jpg" alt="" /></a>';
			temp += '<span id="gbar_top_change_status">';
			temp += '	<span style="margin-left:5px">' + username + '</span>';
			temp += '	<span style="margin-left:5px" id="gbar_user_status_top"></span>';
			temp += '</span>';// _2[9]
			temp += '<div class="gbar_minimizebox"></div></div>';
			temp += '<div class="gbar_tabsubtitle">';
			temp += '<div class="gbar_avatarbox">';
			temp += '<img class="gbar_avatar" src="./images/null.gif" alt="" />';
			temp += '</div>';
			temp += '<div class="gbar_message">';
			temp += '<b id="gbar_statusdiv" class="editable"></b>';//
//			temp += '	<a class="gbar_gooffline">' + _2[11] + '</a>';
			temp += '</div>';
			temp += '<div style="clear: both;"></div>';
			temp += '</div>';
//			temp += '<div class="gbar_tabcontent">';
//			temp += '<span id="gbar_create_group">Grouping</span><input id="gbar_create_group_input" type="text" value="" style="display:none" />';
//			temp += '</div>';
			temp += '<div id="gbar_top_change_status_option" style="display:none;padding:5px;float:right">';
			temp += '<span class="gbar_optionsstatus2 gbar_user_available"></span>';
			temp += '<span class="gbar_optionsstatus available">' + _2[3] + '</span><br class="clear" />';
			temp += '<span class="gbar_optionsstatus2 gbar_user_busy"></span>';
			temp += '<span class="gbar_optionsstatus busy">' + _2[4] + '</span><br class="clear" />';
			temp += '<span class="gbar_optionsstatus2 gbar_user_invisible"></span>';
			temp += '<span class="gbar_optionsstatus invisible">' + _2[5] + '</span><br class="clear" />';
			temp += '<a style="margin-left:30px" href="'+logout_url+'">' + _2[20] + '</a>';
			temp += '</div>';
			temp += '<div class="gbar_tabcontent gbar_tabstyle">';
			temp += '	<div id="gbar_userscontent">';
			temp += '		<div id="gbar_userslist_support"></div>';
			temp += '		<div class="gbar_showhide">';
			temp += '			<img src="./images/hide.png" alt="" style="width:12px;" />';
			temp += '			<span id="gbar_userslist_showhide_online">Online<span class="number">(0)</span></span>';
			temp += '		</div>';
			temp +=	'		<div>';
			temp += '			<div id="gbar_userslist_available"></div>';
			temp += '			<div id="gbar_userslist_busy"></div>';
			temp += '			<div id="gbar_userslist_away"></div>';
			temp += '		</div>';
			temp += '		<div class="gbar_showhide">';
			temp += '			<img src="./images/show.png" alt="" style="width:12px;" />';
			temp += '			<span id="gbar_userslist_showhide_offline">Offline<span class="number">(0)</span></span>';
			temp += '		</div>';
			temp += '		<div id="gbar_userslist_offline" style="display:none"></div>';
			temp += '	</div>';
			temp += '</div>';
			$("<div/>").attr("id", "gbar_userstab_popup").addClass("gbar_tabpopup").css("display", "none").html(temp).appendTo($("#bottom_bar"));
//			$('#gbar_create_group').click(function(){
//				$('#gbar_create_group_input').slide
//			});
			$('.gbar_showhide').click(function(){
				if($(this).next().is(':visible'))
				{
					$(this).next().slideUp(function(){$(this).hide();});
					$(this).children('img').attr('src','./images/show.png');
				}
				else
				{
					$(this).next().slideDown(function(){$(this).show();});
					$(this).children('img').attr('src','./images/hide.png');
				}
			});
			$('#gbar_statusdiv').parent().edit_on_spot(function(object, value)
														{
															object.attr('disabled', 'disabled');
															$.post(_1 + "gbar_send.php", {mode: 'send_status_message', statusmessage: value},function(){
																var post_shout_duration = 5;
																object.parent().parent().find('.edit_on_spot').html('edit');
																object.parent().attr('alt',value);
																object.parent().html(value);
																if(value.length > 0)
																{
																	var interval_post_shout = setTimeout(function()
																	{
																		social_shout_submit_parameter = {	mode: 'social_shout_submit',
																											message: value,
																											social_permission: 'friends_only',
																											type: 'social_friend',
																											no_return: true,
																											additional_type: 'status'
																										};
																		$.ajax({
																			url: 'ajax_social.php',
																			type: "POST",
																			data: social_shout_submit_parameter,
																			dataType: "json"});
																	}
																	, (post_shout_duration * 1000));
																	$('#gbar_statusdiv').parent().parent().tipsy({
																													opcountdown: true,
																													duration: post_shout_duration,
																													gravity: 'e',
																													fallback: 'Your new status has been posted in shout. <br /><span class="link undo" onclick="clearTimeout('+interval_post_shout+');">Click here to undo.</span>',
																													show:true
																												});
																}
															});
														},
														function (object, value)
														{
															object.attr('alt',value);
															object.html(value);
														},
														{type: 'textarea',
														limit: 100,
														class_name: 'gbar_status_textarea'
														});
			$("#gbar_top_change_status").click(function(event){
				if($('#gbar_top_change_status_option').is(':visible'))
				{
					$('#gbar_top_change_status_option').hide();
				}
				else
				{
					$(document).unbind('click');
					$(document).bind('click', function(e)
					{
						var $clicked=$(e.target); // get the element clicked
						if(!(
						$clicked.is('#gbar_top_change_status_option') || $clicked.parents().is('#gbar_top_change_status_option') ||
						$clicked.is('#gbar_top_change_status') || $clicked.parents().is('#gbar_top_change_status') ||
						$clicked.is('#gbar_user_status_top') || $clicked.parents().is('#gbar_user_status_top')
						))
						{
							$('#gbar_top_change_status_option').hide();
						}
					});
					$('#gbar_top_change_status_option').show();
				}
			});
			$("#gbar_userstab_popup .gbar_gooffline").click(function () {_49();});
			$("#gbar_userstab_popup .gbar_minimizebox").click(function () {$("#gbar_userstab").click();});
//			$("#gbar_userstab_popup .gbar_userstabtitle").mouseenter(function () {$(this).addClass("gbar_chatboxtabtitlemouseover2");});
//			$("#gbar_userstab_popup .gbar_userstabtitle").mouseleave(function () {$(this).removeClass("gbar_chatboxtabtitlemouseover2");});
			$("#gbar_userstab").mouseover(function () {$(this).addClass("gbar_tabmouseover");});
			$("#gbar_userstab").mouseout(function () {$(this).removeClass("gbar_tabmouseover");});
			$("#gbar_top_change_status_option .available").click(function (_4e) 
																{
																	_45('available');
																	$('#gbar_top_change_status_option').hide();
															//		$("#gbar_userstab_icon").addClass("gbar_user_available2");
															//		$(this).css("text-decoration", "underline");
																	_46("available");
																});
			$("#gbar_top_change_status_option .busy").click(function (_4f)
															{
																_45('busy');
																	$('#gbar_top_change_status_option').hide();
															//	$("#gbar_userstab_icon").addClass("gbar_user_busy2");
															//	$(this).css("text-decoration", "underline");
																_46("busy");
															});
			$("#gbar_top_change_status_option .invisible").click(function (_50)
															{
																_45('invisible');
																	$('#gbar_top_change_status_option').hide();
															//	$("#gbar_userstab_icon").addClass("gbar_user_invisible2");
															//	$(this).css("text-decoration", "underline");
																_46("invisible");
															});
			$("#gbar_userstab").click(function () {if (_1a != "") {$("#gbar_trayicon_" + _1a + "_popup").removeClass("gbar_tabopen");$("#gbar_trayicon_" + _1a).removeClass("gbar_trayclick");_1a = "";}if (_10 == 1) {_10 = 0;$("#gbar_userstab_text").html(_2[9] + " (" + _19 + ")");_3a();$("#gbar_optionsbutton_popup .available").click();}$("#gbar_optionsbutton_popup").removeClass("gbar_tabopen");$("#gbar_optionsbutton").removeClass("gbar_tabclick");if ($(this).hasClass("gbar_tabclick")) {_4b("buddylist", "0");} else {_4b("buddylist", "1");}$("#gbar_userstab_popup").css("left", $("#gbar_userstab").position().left + 16).css("bottom", "24px");$(this).toggleClass("gbar_tabclick").toggleClass("gbar_userstabclick");$("#gbar_userstab_popup").toggleClass("gbar_tabopen");});
		}


		function _88() {
			var _89 = $(window).width();
			check_notification_height();
			check_options_height();
			var _8a = 0;
			if (!$("#gbar_chatbox_right").hasClass("gbar_chatbox_lr")) {
				_8a = 19;
			}
			if (_3.length > 0) {
				_8a += (_3.length - 1) * 30;
			}
			if (_89 < 520 + _8a) {
				_89 = 520 + _8a;
			}
			$("#gbar_base").css("width", _89 - 31);
			if ($("#gbar_chatboxes_wide").width() <= $("#gbar_base").width() - 226 - _8a - 75) {
				$("#gbar_chatboxes").css("width", $("#gbar_chatboxes_wide").width());
				$("#gbar_chatboxes").scrollTo("0px", 0);
			} else {
				var _8b = $("#gbar_chatboxes").width();
				$("#gbar_chatboxes").css("width", Math.floor(($("#gbar_base").width() - 226 - _8a - 75) / 152) * 152);
				var _8c = $("#gbar_chatboxes").width();
				if (_8b != _8c) {
					$("#gbar_chatboxes").scrollTo("-=152px", 0);
				}
			}
			$("#gbar_optionsbutton_popup").css("left", $("#gbar_optionsbutton").position().left - 171).css("bottom", "24px");
			$("#gbar_userstab_popup").css("left", $("#gbar_userstab").position().left + 16).css("bottom", "24px");
			if (_e != "") {
				if ($("#gbar_user_" + _e).offset().left < $("#gbar_chatboxes").offset().left + $("#gbar_chatboxes").width() &&
					$("#gbar_user_" + _e).offset().left - $("#gbar_chatboxes").offset().left >= 0) {
					$("#gbar_user_" + _e + "_popup").css("left", $("#gbar_user_" + _e).position().left - 62).css("bottom", "24px");
				} else {
					$("#gbar_user_" + _e + "_popup").removeClass("gbar_tabopen");
					$("#gbar_user_" + _e).removeClass("gbar_tabclick").removeClass("gbar_usertabclick");
					var _8d = $("#gbar_user_" + _e).offset().left - $("#gbar_chatboxes_wide").offset().left - (Math.floor($("#gbar_chatboxes").width() / 152) - 1) * 152;
					$("#gbar_chatboxes").scrollTo(_8d, 0, function () {$("#gbar_user_" + _e).click();});
				}
			}
			$('#gbar_exp_base').css('width',($('#gbar_base').width()-1)+'px');
			_83();
			_6e();
			if (ie6) {
				_8e();
			}
		}


		function _83() {
			$("#gbar_chatbox_left .gbar_tabalertlr").html("0");
			$("#gbar_chatbox_right .gbar_tabalertlr").html("0");
			$("#gbar_chatbox_left .gbar_tabalertlr").css("display", "none");
			$("#gbar_chatbox_right .gbar_tabalertlr").css("display", "none");
			$(".gbar_tabalert").each(function ()
									{
										if ($(this).parent().offset().left < $("#gbar_chatboxes").offset().left + $("#gbar_chatboxes").width() && $(this).parent().offset().left - $("#gbar_chatboxes").offset().left >= 0)
											{
												$(this).css("display", "block");
												$(this).css("left", $(this).parent().offset().left + $(this).parent().width() - 30);
											}
										else
										{
											$(this).css("display", "none");
											if ($(this).parent().offset().left - $("#gbar_chatboxes").offset().left >= 0)
											{
												var _8f = $("#gbar_chatbox_right").offset().left + $("#gbar_chatbox_right").width() - 30;
												$("#gbar_chatbox_right .gbar_tabalertlr").css("left", _8f);
												$("#gbar_chatbox_right .gbar_tabalertlr").html(parseInt($("#gbar_chatbox_right .gbar_tabalertlr").html()) + parseInt($(this).html()));
												$("#gbar_chatbox_right .gbar_tabalertlr").css("display", "block");
											}
											else
											{
												var _8f = $("#gbar_chatbox_left").offset().left + $("#gbar_chatbox_left").width() - 22;
												$("#gbar_chatbox_left .gbar_tabalertlr").css("left", _8f);
												$("#gbar_chatbox_left .gbar_tabalertlr").html(parseInt($("#gbar_chatbox_left .gbar_tabalertlr").html()) + parseInt($(this).html()));
												$("#gbar_chatbox_left .gbar_tabalertlr").css("display", "block");
											}
										}
									});
		}


		function _6e() {
			var _90 = 0;
			var _91 = 0;
			var _92 = 0;
			if ($("#gbar_chatbox_right").hasClass("gbar_chatbox_right_last")) {
				_91 = 1;
			}
			if ($("#gbar_chatbox_right").hasClass("gbar_chatbox_lr")) {
				_92 = 1;
			}
			if ($("#gbar_chatboxes").scrollLeft() == 0) {
				$("#gbar_chatbox_left").unbind("click", _93);
				$("#gbar_chatbox_left .gbar_tabtext").html("0");
				$("#gbar_chatbox_left").addClass("gbar_chatbox_left_last");
				_90++;
			} else {
				var _94 = Math.floor($("#gbar_chatboxes").scrollLeft() / 152);
				$("#gbar_chatbox_left").bind("click", _93);
				$("#gbar_chatbox_left .gbar_tabtext").html(_94);
				$("#gbar_chatbox_left").removeClass("gbar_chatbox_left_last");
			}
			if ($("#gbar_chatboxes").scrollLeft() + $("#gbar_chatboxes").width() == $("#gbar_chatboxes_wide").width()) {
				$("#gbar_chatbox_right").unbind("click", _95);
				$("#gbar_chatbox_right .gbar_tabtext").html("0");
				$("#gbar_chatbox_right").addClass("gbar_chatbox_right_last");
				_90++;
			} else {
				var _94 = Math.floor(($("#gbar_chatboxes_wide").width() - ($("#gbar_chatboxes").scrollLeft() + $("#gbar_chatboxes").width())) / 152);
				$("#gbar_chatbox_right").bind("click", _95);
				$("#gbar_chatbox_right .gbar_tabtext").html(_94);
				$("#gbar_chatbox_right").removeClass("gbar_chatbox_right_last");
			}
			if (_90 == 2) {
				$("#gbar_chatbox_right").addClass("gbar_chatbox_lr");
				$("#gbar_chatbox_left").addClass("gbar_chatbox_lr");
			} else {
				$("#gbar_chatbox_right").removeClass("gbar_chatbox_lr");
				$("#gbar_chatbox_left").removeClass("gbar_chatbox_lr");
			}
			if (!$("#gbar_chatbox_right").hasClass("gbar_chatbox_right_last") &&
				_91 == 1 ||
				$("#gbar_chatbox_right").hasClass("gbar_chatbox_right_last") &&
				_91 == 0 ||
				!$("#gbar_chatbox_right").hasClass("gbar_chatbox_lr") &&
				_92 == 1 ||
				$("#gbar_chatbox_right").hasClass("gbar_chatbox_lr") &&
				_92 == 0) {
				_88();
			}
		}


		function _96(_97) {
			if (_e != "") {
				$("#gbar_user_" + _e + "_popup").removeClass("gbar_tabopen");
				$("#gbar_user_" + _e).removeClass("gbar_tabclick").removeClass("gbar_usertabclick");
			}
			$(".gbar_tabalert").css("display", "none");
			var ms = 800;
			if (_67("initialize") == 1) {
				ms = 0;
			}
			$("#gbar_chatboxes").scrollTo(_97, ms, function () {if (_e != "") {if ($("#gbar_user_" + _e).offset().left < $("#gbar_chatboxes").offset().left + $("#gbar_chatboxes").width() && $("#gbar_user_" + _e).offset().left - $("#gbar_chatboxes").offset().left >= 0) {$("#gbar_user_" + _e).click();} else {_e = "";}_4b("openChatboxId", _e);}_83();_6e();});
		}


		function _93() {
			_96("-=152px");
		}


		function _95() {
			_96("+=152px");
		}


		function _98(_99, _9a) {
			_b[_99] = _9a;
		}


		function _67(_9b) {
			if (_b[_9b]) {
				return _b[_9b];
			} else {
				return "";
			}
		}


		function _9c(_9d, _9e) {
			_d[_9d] = _9e;
		}


		function _70(_9f) {
			if (_d[_9f]) {
				return _d[_9f];
			} else {
				return "";
			}
		}


		function _4b(_a0, _a1) {
			_c[_a0] = _a1;
			if (_70("updatingsession") != 1) {
				var _a2 = "";
				if (_c.buddylist) {
					_a2 += _c.buddylist;
				} else {
					_a2 += " ";
				}
				_a2 += ":";
				if (_c.activeChatboxes) {
					_a2 += _c.activeChatboxes;
				} else {
					_a2 += " ";
				}
				_a2 += ":";
				if (_c.openChatboxId) {
					_a2 += _c.openChatboxId;
				} else {
					_a2 += " ";
				}
				_a2 += ":" + _19;
				_a2 += ":" + _10;
				$.cookie(_a + "state", _a2);
			}
		}


		function _a3(_a4, _a5) {
			if (_c[_a4]) {
				return _c[_a4];
			} else {
				return "";
			}
		}


		function _a6(_a7) {
			var id = $(_a7).attr("id").substr(14);
			if (id == "") {
				id = $(_a7).parent().attr("id").substr(14);
			}
			_55(id, _1d[id], _1f[id], _1e[id], _20[id], _21[id]);
		}


		function _a8(id) {
			_55(id, _1d[id], _1f[id], _1e[id], _20[id], _21[id]);
		}


		function _82(_a9) {
			var id = _a9;
			_55(id, _1d[id], _1f[id], _1e[id], _20[id], _21[id], 1);
		}


		function _aa(id, _ab, _ac, old, _ad, _ae, _af)
		{
			if (timing_for_get_id[id] != 1)
			{
				_55(id, _1d[id], _1f[id], _1e[id], _20[id], _21[id], 1, 1);
			}
			if (_1d[id] == null || _1d[id] == "")
			{
				setTimeout(function () {_aa(id, _ab, _ac, old, _ad, _ae, _af);}, 200);
			}
			else
			{
				var _b0 = "";
				if (parseInt(_ac) == 1)
				{
					fromname = _2[10];
					_b0 = " gbar_self";
				} 
				else
				{
					fromname = _1d[id];
				}
				if (parseInt(_ae) == 1)
				{
					_ab = _ab.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br>").replace(/\"/g, "&quot;");
				}
				if (_ac != 1 && _6 == 1)
				{
					if ($.cookie(_a + "sound") && $.cookie(_a + "sound") == "true")
					{
					}
					else
					{
						if (old != 1)
						{
							_2f();
						}
					}
				}
				separator = ":&nbsp;&nbsp;";
				if ($("#gbar_message_" + _ad).length > 0) {
					$("#gbar_message_" + _ad + " .gbar_chatboxmessagecontent").html(_ab);
				} else {
					sentdata = "";
					if (_af != null) {
						var ts = new Date(_af * 1000);
						sentdata = _71(ts);
					}
					if (fromname.indexOf(" ") != -1) {
						fromname = fromname.slice(0, fromname.indexOf(" "));
					}
					$("#gbar_user_" + id + "_popup .gbar_tabcontenttext").append("<div class=\"gbar_chatboxmessage\" id=\"gbar_message_" + _ad + "\"><span class=\"gbar_chatboxmessagefrom" + _b0 + "\"><strong>" + fromname + "</strong>" + separator + "</span><span class=\"gbar_chatboxmessagecontent" + _b0 + "\">" + _ab + "</span>" + sentdata + "</div>");
					$("#gbar_tabcontenttext_" + id).scrollTop(50000);
				}
				if (_e != id && old != 1) {
					_80(id, 1, 1);
				}
			}
		}


		function _b1(id) {
			if (_1d[id] == null || _1d[id] == "") {
				setTimeout(function () {_b1(id);}, 500);
			} else {
				if (_e != id) {
					$("#gbar_user_" + id).click();
				}
			}
		}


		function _b2(id) {
			if (_1d[id] == null || _1d[id] == "") {
				setTimeout(function () {_b2(id);}, 500);
			} else {
				$("#gbar_user_" + id).click();
			}
		}


		function _b3(id, _b4) {
			if (_1d[id] == null || _1d[id] == "") {
				setTimeout(function () {_b3(id, _b4);}, 500);
			} else {
				$("#gbar_tabcontenttext_" + id).append("<div>" + _b4 + "</div>");
				$("#gbar_tabcontenttext_" + id).scrollTop(50000);
				_23[id] = 1;
			}
		}


		function _3a(force) {
			if(first_time_check_notification_time < parseInt(new Date().getTime()/1000)-time_to_update_notification_time)
			{







				update_timestamp();
				first_time_check_notification_time = parseInt(new Date().getTime()/1000);
			}
			var last_notification_id = 0;
			var last_unread_notification_id = 0;
			var temp_text_to_add="";
			var temp_text_to_add2="";
			var add_force = '';
			var social_friends_added = 0;
			if(typeof force != 'undefined')
			{
				add_force = '?force=1';
			}
			_b.timestamp = _18;
			_b.load_time = _15;
			var _b5 = "";
			var _b6 = {};
			_b6.support = "";//"<div title=\"offline\" id=\"gbar_userlist_0\" class=\"gbar_support_list\" onmouseover=\"jqcc(this).addClass('gbar_userlist_hover');\" onmouseout=\"jqcc(this).removeClass('gbar_userlist_hover');\"><span class=\"gbar_userscontentname\">" +  _2[18] + "</span><span class=\"gbar_userscontentdot gbar_offline\"></span></div>";
			_b6.available = "";
			_b6.busy = "";
			_b6.away = "";
			_b6.offline = "";
			var social_friend = {};
			social_friend.support = "";//"<div title=\"offline\" id=\"gbar_userlist_0\" class=\"gbar_support_list\" onmouseover=\"jqcc(this).addClass('gbar_userlist_hover');\" onmouseout=\"jqcc(this).removeClass('gbar_userlist_hover');\"><span class=\"gbar_userscontentname\">" +  _2[18] + "</span><span class=\"gbar_userscontentdot gbar_offline\"></span></div>";
			social_friend.available = "";
			social_friend.busy = "";
			social_friend.away = "";
			social_friend.offline = "";

			var mini_social = {};
			mini_social.support = "";//"<div title=\"offline\" id=\"gbar_userlist_0\" class=\"gbar_support_list\" onmouseover=\"jqcc(this).addClass('gbar_userlist_hover');\" onmouseout=\"jqcc(this).removeClass('gbar_userlist_hover');\"><span class=\"gbar_userscontentname\">" +  _2[18] + "</span><span class=\"gbar_userscontentdot gbar_offline\"></span></div>";
			mini_social.available = "";
			mini_social.busy = "";
			mini_social.away = "";
			mini_social.offline = "";

			buddylistreceived = 0;
			onlineNumber = 0;
			$.ajax({
				url: _0() + "gbar_receive.php"+add_force,
				data: _b,
				dataType: "jsonp",
				cache: false,
				dataFilter: function (_b7)
							{
								if (typeof JSON !== "undefined" && typeof JSON.parse === "function")
								{
									return JSON.parse(_b7);
								}
								else
								{
									return eval("(" + _b7 + ")");
								}
							},
				success: function (_b8) 
						{
							if (_b8)
							{
								var _b9 = 0;
								$.each(_b8, function (_ba, _bb) 
											{
												if(_ba == "typing")
												{
													_15 = _8;
													_98('typing', _bb);
													$('.tabinput_typing').removeClass('tabinput_typing');
													$('#gbar_tabcontenttext_'+_bb).next('.gbar_tabcontentinput').addClass('tabinput_typing');
												}
												if(_ba == "not_typing")
												{
													_98('typing', 0);
													$('.tabinput_typing').removeClass('tabinput_typing');
												}
												if (_ba == "support_list")
												{
													buddylistreceived = 1;
													$.each(_bb, function (i, _bc) 
													{
														longname = _2[18];
														if (_23[_bc.id] != null)
														{
															$("#gbar_user_" + _bc.id + " .gbar_closebox_bottom_status")
															.removeClass("gbar_availabavailable")
															.removeClass("gbar_busy")
															.removeClass("gbar_away")
															.removeClass("gbar_offline")
															.addClass("gbar_" + _bc.s);
															if ($("#gbar_user_" + _bc.id + "_popup").length > 0)
															{
																$("#gbar_user_" + _bc.id + "_popup .gbar_tabsubtitle .gbar_message").html(_bc.m);
															}
														}
														if (_bc.s == "available")
														{
												//			onlineNumber++;
														}
														if (_bc.s == "offline")
														{
															support_status = 'offline';
															div_class = 'gbar_support_list';
														}
														else
														{
															support_status = 'online';
															div_class = 'gbar_userlist';
														}
														temp = '<div title="' + _bc.s + '" id="gbar_userlist_' + _bc.id + '" class="' + div_class + '" onmouseover="jqcc(this).addClass(\'gbar_userlist_hover\');" onmouseout="jqcc(this).removeClass(\'gbar_userlist_hover\');">';
														temp += '<span><img src="' + _bc.a + '" alt="" class="gbar_friendlist_avatar" /></span>';
														temp += '<span class="gbar_userscontentname">' + longname + '</span>';
														temp += '<span class="gbar_userscontentdot gbar_' + _bc.s + '"></span>';
														temp += '</div>';
														_b6['support'] = temp;
														temp = '<div title="' + _bc.s + '" id="gbar_userlist_' + _bc.id + '" class="' + div_class + '" onmouseover="jqcc(this).addClass(\'gbar_userlist_hover\');" onmouseout="jqcc(this).removeClass(\'gbar_userlist_hover\');">';
														temp += '<span><img src="' + _bc.a + '" alt="" class="gbar_friendlist_avatar" /></span>';
														temp += '<span class="gbar_userscontentname">' + longname + ' (' + support_status +')</span>';
														temp += '<span class="gbar_userscontentdot gbar_' + _bc.s + '"></span>';
														temp += '</div>';
														mini_social['support'] = temp;
														_1f[_bc.id] = _bc.s;
														_1e[_bc.id] = _bc.m;
														_1d[_bc.id] = _bc.n;
														_1mobile[_bc.id] = false;
														_20[_bc.id] = _bc.a;
														_21[_bc.id] = _bc.l;
													});
												}
												if (_ba == "buddylist")
												{
													buddylistreceived = 1;
													onlineNumber = 0;
													totalFriendsNumber = 0;
													$.each(_bb, function (i, _bc) 
													{
														if (_bc.n.length > 24) 
														{
															longname = _bc.n.substr(0, 24) + "...";
														}
														else
														{
															longname = _bc.n;
														}
														if (_23[_bc.id] != null)
														{
															$("#gbar_user_" + _bc.id + " .gbar_closebox_bottom_status")
															.removeClass("gbar_available")
															.removeClass("gbar_busy")
															.removeClass("gbar_away")
															.removeClass("gbar_offline")
															.addClass("gbar_" + _bc.s);
															if ($("#gbar_user_" + _bc.id + "_popup").length > 0)
															{
																$("#gbar_user_" + _bc.id + "_popup .gbar_tabsubtitle .gbar_message").html(_bc.m);
															}
														}
														if (_bc.s != "offline")
														{
															onlineNumber++;
														}
														totalFriendsNumber++;
														temp = '<div title="' + _bc.s + '" id="gbar_userlist_' + _bc.id + '" class="gbar_userlist" onmouseover="jqcc(this).addClass(\'gbar_userlist_hover\');" onmouseout="jqcc(this).removeClass(\'gbar_userlist_hover\');">';
														temp += '<img src="' + _bc.a + '" alt="" class="gbar_friendlist_avatar" />';
														temp += '<span class="gbar_userscontentname">' + longname + '</span>';
														temp += '<span class="gbar_userscontentdot gbar_' + _bc.s + '"></span>';
														if(_bc.mobile)
														{
															temp += '<span class="gbar_userscontentdot gbar_mphone" onclick="sms_dialog(' + _bc.id + ')"></span>';
														}//<img src="./images/gbar/mobile.png" alt="" />
														temp += '</div>';
														_b6[_bc.s] += temp;
														if(social_friends_added < social_friends_show)
														{
															social_friends_added++;
															temp = '<div class="my_friend_mini">';// style="display:none"
															temp += '	<a style="display:inline" href="'+_bc.l+'">';
															temp += '		<img src="'+_bc.a+'" />';
															temp += '	</a>';
															temp += '<span class="gbar_userscontentdot gbar_' + _bc.s + '"></span>';
															temp += '<span id="gbar_userlist_' + _bc.id + '" class="gbar_userlist">'+_bc.n+'</span>';
															if(_bc.location.length > 0)
															{
																temp += '<br />...in '+_bc.location;
															}
															temp += '</div>';
															social_friend[_bc.s] += temp;
														}
														_1f[_bc.id] = _bc.s;
														_1e[_bc.id] = _bc.m;
														_1d[_bc.id] = _bc.n;
														_1mobile[_bc.id] = _bc.mobile;
														_20[_bc.id] = _bc.a;
														_21[_bc.id] = _bc.l;
													});
												}
												if (buddylistreceived == 1)
												{
													$('#gbar_userslist_showhide_online').find('.number').html('('+onlineNumber+')');
													$('#gbar_userslist_showhide_offline').find('.number').html('('+(totalFriendsNumber-onlineNumber)+')');
													_98('buddy_time',_b8.time);
													for (buddystatus in _b6)
													{
														if (_b6.hasOwnProperty(buddystatus))
														{
															if (_b6[buddystatus] == "")
															{
																_d3("gbar_userslist_" + buddystatus, "");
																if($('#social_friends_' + buddystatus).length > 0)
																{
																	_d3("social_friends_" + buddystatus, "");
																}
																if(buddystatus == 'support' && $('#mini_support').length > 0)
																{
																	_d3("mini_support", "");
																}
															}
															else
															{
																_d3("gbar_userslist_" + buddystatus, "<div>" + _b6[buddystatus] + "</div>");
																if($('#social_friends_' + buddystatus).length > 0)
																{
																	_d3("social_friends_" + buddystatus, "<div>" + social_friend[buddystatus] + "</div>");
																}
																if(buddystatus == 'support' && $('#mini_support').length > 0)
																{
																	_d3("mini_support", "<div>" + mini_social[buddystatus] + "</div>");
																}
																$('#social_friends').parent().show();
															}
														}
													}

													$(".gbar_userlist").click(function (e)
																				{
																					_a6(e.target);
																				});
													$("#gbar_userstab_text").html(_2[9] + " (" + onlineNumber + ")");
													_19 = onlineNumber;
													if (totalFriendsNumber == 0)
													{
														$("#gbar_userslist_available").html("<div class=\"gbar_nofriends\">" + _2[14] + "</div>");
													}
													buddylistreceived = 0;
												}
												if(_ba=="experience_status")
												{
													_98('experience_time',_b8.time);
													if($('#gbar_exp_bar').css('width') == '0pt' || $('#gbar_exp_bar').css('width') == '0px')
													{
														$('#level').addClass('gbar_traylevel').html('Level '+_bb.level);
														$('#gbar_exp_bar')
														.css('width',_bb.exp_precentage+'%')
														.mouseout(function(){$("#gbar_tooltip").css("display","none");});
													}
													else
													{
														if(level_now != _bb.level)
														{
															$('#gbar_exp_bar').animate({width:'100%'},5000,function(){
																$('#level').addClass('gbar_traylevel').html('Level '+_bb.level);
																$('#gbar_exp_bar')
																.css('width','0%')
																.animate({width:_bb.exp_precentage+'%'},5000)
																.mouseout(function(){$("#gbar_tooltip").css("display","none");});
															});
														}
														else
														{
															$('#level').addClass('gbar_traylevel').html('Level '+_bb.level);
															$('#gbar_exp_bar')
															.animate({width:_bb.exp_precentage+'%'},5000)
															.mouseout(function(){$("#gbar_tooltip").css("display","none");});
														}
													}
													level_now = _bb.level;
													if(_bb.exp_precentage>50)
													{
														$('#level').mouseover(function(){_30("gbar_exp_bar",'Level: '+_bb.level+'<br />'+_bb.exp_precentage+'%');}).mouseout(function(){$('#gbar_tooltip').hide();});
														$('#gbar_exp_bar').mouseover(function(){_30("gbar_exp_bar",'Level: '+_bb.level+'<br />'+_bb.exp_precentage+'%');});
													}
													else
													{
														$('#level').mouseover(function(){_30("gbar_exp_bar",'Level: '+_bb.level+'<br />'+_bb.exp_precentage+'%',1);}).mouseout(function(){$('#gbar_tooltip').hide();});
														$('#gbar_exp_bar').mouseover(function(){_30("gbar_exp_bar",'Level: '+_bb.level+'<br />'+_bb.exp_precentage+'%',1);});
													}
												}
												if(_ba=="notificationlist")
												{
													$.each(_bb,function(az,ay)
													{
														if(first_time_check_notification_time == 0)
														{
															first_time_check_notification_time = parseInt(new Date().getTime()/1000);
														}
														if(ay.log_read == 0)
														{
															total_new_notification++;
															temp_text_to_add = ' style="background-color: #333333"';
															temp_text_to_add2 = ' new_notification';
															last_unread_notification_id = parseInt(ay.user_log_id);
														}
														$("#gbar_notification").prepend(
														'<div class="gbar_notificationlist"><div class="'+temp_text_to_add2+'"'+temp_text_to_add+' onmouseover="jQuery(this).addClass(\'gbar_userlist_hover\');" onmouseout="jQuery(this).removeClass(\'gbar_userlist_hover\');">'+
														'<div class="gbar_notificationcontentname">'+ay.action+' - <span id="timestamp'+ay.log_time+'" class="timestamp">'+convert_to_time_left(ay.log_time)+'</span></div></div></div>');
														last_notification_id = parseInt(ay.user_log_id);
													});
												}
												if (_ba == "off_notification")
												{
													total_new_notification = 0;
													$('.new_notification').css('background-color','').removeClass('new_notification');
													$('#gbar_notificationalert').hide().html('');
													_98("notificationlist_unread",_bb);
												}
												if (_ba == "quest_unread")
												{
													if(_b8.quest_unread > 0 && !$('#gbar_trayicon_2_popup').hasClass("gbar_tabopen"))
													{
														$('#gbar_questalert').html(_b8.quest_unread).css('display','block');
													}
													_98('quest_time',_b8.time);
												}
												if (_ba == "loggedout")
												{
													$('#gbar_base').show();
													for (var t = 0; t < _3.length; t++)
													{
														var _c7 = _3[t];
														if (_c7[6] == "must_login")
														{
														//	$("#gbar_trayicon_" + t).html('').addClass('gbar_optionsimages_exclamation').css('width','19px').css('margin-left','-3px');
															$("#gbar_trayicon_" + t + '_popup').css("cssText", "display: none !important;");
														}
													}
													$('#level').removeClass('gbar_traylevel').html('');
													$("#gbar_optionsbutton").addClass("gbar_optionsimages_exclamation");
													$("#gbar_userstab").hide();
													$("#gbar_chatboxes").hide();
													$("#gbar_chatbox_left").hide();
													$("#gbar_chatbox_right").hide();
													$("#gbar_optionsbutton_popup").hide();
													$("#gbar_userstab_popup").hide();
//													$(".gbar_tabopen").css("cssText", "display: none !important;");
													if (_e != "") 
													{
														$("#gbar_user_" + _e + "_popup").hide();
														_e = "";
														_4b("openChatboxId", _e);
													}
													if(logged_in)
													{
														a("#dialog")
														.html(D[17])
														.dialog("option", "title", "Logged out")
														.dialog('option', 'buttons', { "Ok": function() { $(this).dialog("close"); } })
														.dialog('option', 'buttons', { "Login": function() { location.href = "/ucp.php?mode=login"; } })
														.dialog("open");
													}
													_f = 1;
												}
												if (_ba == "userstatus")
												{
													_98('user_time',_b8.time);
													$.each(_bb, function (_bd, _be)
																{
																	if (_bd == "avatar")
																	{
																		$('#gbar_userstab_popup .gbar_avatar').attr('src',_be);
																	}
																	if (_bd == "message")
																	{
																		$('#gbar_statusdiv').html(_be);
//																		$("#gbar_optionsbutton_popup .gbar_statustextarea").val(_be);
																	}
																	if (_bd == "status") 
																	{
																		if (_be == "offline")
																		{
																			_49(1);
																		}
																		else
																		{
																			_45(_be);
																		}
																	}
																});
												}
												if (_ba == "initialize")
												{
													$('#gbar_base').show();
													_18 = _bb;
													_c9();
												}
												if (_ba == "messages")
												{
													$.each(_bb, function (i, _bf)
																{
																	_18 = _bf.id;
																	if (_e == _bf.from && _1d[_bf.from] != "" && _1d[_bf.from] != null)
																	{
																		++_b9;
																		var _c0 = _1d[_bf.from];
																		var _c1 = "";
																		if (_bf.self == 1)
																		{
																			fromname = _2[10];
																			_c1 = " gbar_self";
																		}
																		else
																		{
																			fromname = _c0;
																			$('.tabinput_typing').removeClass('tabinput_typing');
																		}
																		if ($("#gbar_message_" + _bf.id).length > 0)
																		{
																			$("#gbar_message_" + _bf.id + " .gbar_chatboxmessagecontent").html(_bf.message);
																		}
																		else
																		{
																			var ts = new Date(_bf.sent * 1000);
																			if (fromname.indexOf(" ") != -1)
																			{
																				fromname = fromname.slice(0, fromname.indexOf(" "));
																			}
																			_b5 += "<div class=\"gbar_chatboxmessage\" id=\"gbar_message_" + _bf.id + "\"><span class=\"gbar_chatboxmessagefrom" + _c1 + "\"><strong>" + fromname + "</strong>:&nbsp;&nbsp;</span><span class=\"gbar_chatboxmessagecontent" + _c1 + "\">" + _bf.message + "</span>" + _71(ts) + "</div>";
																		}
																	}
																	else
																	{
																		var _c2 = 0;
																		if ($("#gbar_user_" + _bf.from).length > 0){}
																		else
																		{
																			_c2 = 1;
																		}
																		_aa(_bf.from, _bf.message, _bf.self, _bf.old, _bf.id, 0, _bf.sent);
																		if (_e == "" && _5 == 1 && _c2 == 1)
																		{
																			_b1(_bf.from);
																		}
																	}
																});
													_16 = 1;
													_15 = _8;
												}
											});
											if (_e != "" && _b9 > 0)
											{
												_b3(_e, _b5);
											}
							}
							_98("initialize", "0");
							_98("currenttime", "0");
							if (_f != 1 && _10 != 1)
							{
								_16++;
								if (_16 > 2)
								{
									_15 *= 1.5;
									_16 = 1;
								}
								if (_15 > _9)
								{
									_15 = _9;
								}
								clearTimeout(_13);
								_13 = setTimeout(function (){_3a();}, _15);
							}
						if($('#gbar_trayicon_0_popup').hasClass("gbar_tabopen"))
						{
							read_notification();
						}
						if(total_new_notification > 0)//top: -5px; left:20px; display: block;
						{
							$('#gbar_notificationalert').show().html(total_new_notification);
						}
						if(last_notification_id > 0)
						{
							_98("notificationlist",last_notification_id);
						}
						if(last_unread_notification_id > 0)
						{
							_98("notificationlist_unread",last_unread_notification_id);
						}
						//to make sure notification less than 500px
						check_notification_height();
						},
				error: function ()
				{
					for (var t = 0; t < _3.length; t++)
					{
						var _c7 = _3[t];
						if (_c7[6] == "must_login")
						{
						//	$("#gbar_trayicon_" + t).html('').addClass('gbar_optionsimages_exclamation').css('width','19px').css('margin-left','-3px');
							$("#gbar_trayicon_" + t + '_popup').css("cssText", "display: none !important;");
						}
					}
					$('#level').removeClass('gbar_traylevel').html('');
					$("#gbar_optionsbutton").addClass("gbar_optionsimages_exclamation");
					$("#gbar_userstab").hide();
					$("#gbar_chatboxes").hide();
					$("#gbar_chatbox_left").hide();
					$("#gbar_chatbox_right").hide();
					$("#gbar_optionsbutton_popup").hide();
					$("#gbar_userstab_popup").hide();
//													$(".gbar_tabopen").css("cssText", "display: none !important;");
					if (_e != "") 
					{
						$("#gbar_user_" + _e + "_popup").hide();
						_e = "";
						_4b("openChatboxId", _e);
					}
					if(logged_in)
					{
						a("#dialog")
						.html(D[17])
						.dialog("option", "title", "Logged out")
						.dialog('option', 'buttons', { "Ok": function() { $(this).dialog("close"); } })
						.dialog('option', 'buttons', { "Login": function() { location.href = "/ucp.php?mode=login"; } })
						.dialog("open");
					}
					_f = 1;
				}
			});
		}
	function exp_bar()
	{
		$("<div/>").attr("id","gbar_exp_base").addClass("expbase").appendTo($("body"));
		$("<div/>").attr("id","gbar_exp_bar").addClass("expnow").css('width','0').appendTo($("#gbar_exp_base"));

	}
	function read_notification()
	{
		if($('.new_notification').length > 0)
		{
			$.post(_1+"gbar_send.php",{mode:'read_notification'});
		}
		total_new_notification = 0;
		$('#gbar_notificationalert').hide();
		$("#gbar_trayicon_0_popup .gbar_traycontent .new_notification").each(function(){
			$(this).removeClass('new_notification').fadeTo(500, 1).animate({backgroundColor: '#000000'},1500,function(){$(this).css("background-color","#000000");});
		});
		check_notification_height();
	}
/*
		function _4c() {
			$("<span/>").attr("id", "gbar_optionsbutton").addClass("gbar_tab").addClass("gbar_optionsimages").appendTo($("#gbar_base"));
			$("<div/>").attr("id", "gbar_optionsbutton_popup").addClass("gbar_tabpopup").css("display", "none").html("<div class=\"gbar_userstabtitle\">" + _2[0] + "</div><div class=\"gbar_tabsubtitle\">" + _2[1] + "</div><div class=\"gbar_tabcontent gbar_optionstyle\"><strong>" + _2[2] + "</strong><br/><textarea class=\"gbar_statustextarea\"></textarea><span style=\"float:left\" class=\"gbar_user_available\"></span><span class=\"gbar_optionsstatus available\">" + _2[3] + "</span><span class=\"gbar_optionsstatus2 gbar_user_busy\"></span><span class=\"gbar_optionsstatus busy\">" + _2[4] + "</span><span class=\"gbar_optionsstatus2 gbar_user_invisible\"></span><span class=\"gbar_optionsstatus invisible\">" + _2[5] + "</span><br clear=\"all\"/><div style=\"border-top:1px solid #eeeeee;margin-top:10px;padding-top:4px;\"><span><input type=\"checkbox\" id=\"gbar_soundnotifications\" style=\"vertical-align: -2px;\">" + _2[13] + "</span></div><div style=\"border-top:1px solid #eeeeee;padding-top:10px;margin-top:4px;\"><span><strong>" + _2[6] + "</strong><br/><br/>" + _2[7] + "</span></div>").appendTo($("#bottom_bar"));
			$("#gbar_soundnotifications").click(function (_4d) {$.cookie(_a + "sound", $("#gbar_soundnotifications").attr("checked"), {path: "/", expires: 365});});
			$("#gbar_optionsbutton_popup .available").click(function (_4e) {_45();$("#gbar_userstab_icon").addClass("gbar_user_available2");$(this).css("text-decoration", "underline");_46("available");});
			$("#gbar_optionsbutton_popup .busy").click(function (_4f) {_45();$("#gbar_userstab_icon").addClass("gbar_user_busy2");$(this).css("text-decoration", "underline");_46("busy");});
			$("#gbar_optionsbutton_popup .invisible").click(function (_50) {_45();$("#gbar_userstab_icon").addClass("gbar_user_invisible2");$(this).css("text-decoration", "underline");_46("invisible");});
			$("#gbar_optionsbutton_popup .gbar_statustextarea").keydown(function (_51) {return _3b(_51, this);});
			$("#gbar_optionsbutton").mouseover(function () {if (!$("#gbar_optionsbutton_popup").hasClass("gbar_tabopen")) {if (_f == 0) {_30("gbar_optionsbutton", _2[0]);} else {_30("gbar_optionsbutton", _2[8]);}}$(this).addClass("gbar_tabmouseover");});
			$("#gbar_optionsbutton").mouseout(function () {$(this).removeClass("gbar_tabmouseover");$("#gbar_tooltip").css("display", "none");});
			$("#gbar_optionsbutton").click(function () {if (_1a != "") {$("#gbar_trayicon_" + _1a + "_popup").removeClass("gbar_tabopen");$("#gbar_trayicon_" + _1a).removeClass("gbar_trayclick");_1a = "";}if (_f == 0) {if (_10 == 1) {_10 = 0;$("#gbar_userstab_text").html(_2[9] + " (" + _19 + ")");_3a();$("#gbar_optionsbutton_popup .available").click();}$("#gbar_tooltip").css("display", "none");$("#gbar_optionsbutton_popup").css("left", $("#gbar_optionsbutton").position().left - 171).css("bottom", "24px");$(this).toggleClass("gbar_tabclick");$("#gbar_optionsbutton_popup").toggleClass("gbar_tabopen");$("#gbar_optionsbutton").toggleClass("gbar_optionsimages_click");$("#gbar_userstab_popup").removeClass("gbar_tabopen");$("#gbar_userstab").removeClass("gbar_userstabclick").removeClass("gbar_tabclick");_4b("buddylist", "0");if ($.cookie(_a + "sound")) {if ($.cookie(_a + "sound") == "true") {$("#gbar_soundnotifications").attr("checked", true);} else {$("#gbar_soundnotifications").attr("checked", false);}}} else {if (_2[16] != "") {location.href = _2[16];}}});
			$("#gbar_optionsbutton_popup .gbar_userstabtitle").click(function () {$("#gbar_optionsbutton").click();});
			$("#gbar_optionsbutton_popup .gbar_userstabtitle").mouseenter(function () {$(this).addClass("gbar_chatboxtabtitlemouseover2");});
			$("#gbar_optionsbutton_popup .gbar_userstabtitle").mouseleave(function () {$(this).removeClass("gbar_chatboxtabtitlemouseover2");});
		}
*/
	function notification(){
		$("<span/>").html("<img alt="+_2[17]+" src=\""+_1 + "themes/" + _7 + "/images/icons/" + _2[17]+".gif\" />").attr("id","gbar_notification").addClass("gbar_user_tab").appendTo($("#gbar_base"));
		$("<div/>")
		.attr("id","gbar_trayicon_0_popup")
		.addClass("gbar_tabpopup")
		.css("display","none")
		.html('<div class="gbar_userstabtitle">'+_2[17]+'</div>'+
		'<div class="gbar_tabsubtitle" style="text-align:right">'+'See All'+'</div>'+
		'<div class="gbar_tabcontent">')
		.appendTo($("#gbar_base"));
		$("#gbar_notification").mouseover(function()
		{
			if(!$("#gbar_trayicon_0_popup").hasClass("gbar_tabopen"))
			{
				if(_f==0)
				{
					_30("gbar_notification",_2[17],1);
				}
				else
				{
					_30("gbar_notification",_2[8],1);
				}
			}
			$(this).addClass("gbar_tabmouseover");
		});
		$("#gbar_notification").mouseout(function(){$(this).removeClass("gbar_tabmouseover");$("#gbar_tooltip").css("display","none");});
		$("#gbar_notification").click(function(){
		if(_f==0)
		{
			if(_10==1)
			{
				_10=0;
				$("#gbar_userstab_text").html(_2[9]+" ("+_19+")");
				_3a();
				$("#gbar_optionsbutton_popup .available").click();
			}
			if($(this).hasClass("gbar_tabclick"))
			{
				_4b("notification","0");
			}
			else
			{
				_4b("notification","1");
			}
			$(this).toggleClass("gbar_tabclick");
//			if($('.new_notification').length > 0 && $(this).hasClass("gbar_tabclick"))
//			{
//				$.post(_1+"gbar_send.php",{mode:'read_notification'})
//			}
			read_notification();
//			$("#gbar_trayicon_0_popup .gbar_tabcontent .new_notification").each(function(){
//				$(this).removeClass('new_notification').fadeTo(3000, 1).animate({backgroundColor: '#000000'},2000,function(){$(this).css("background-color","#000000");});
//			});
			$("#gbar_tooltip").css("display","none");
			$("#gbar_trayicon_0_popup").css("left",$("#gbar_notification").position().left+16).css("bottom","24px");
			$("#gbar_trayicon_0_popup").toggleClass("gbar_tabopen");
			$("#gbar_notification").toggleClass("gbar_notification_images_click");
			if($.cookie("gbar_sound"))
			{
				if(a.cookie("gbar_sound")=="true")
				{
					$("#gbar_soundnotifications").attr("checked",true);
				}
				else
				{
					$("#gbar_soundnotifications").attr("checked",false);
				}
			}
//			total_new_notification = 0;
//			$('#gbar_notificationalert').hide();
//			check_notification_height();
		}
		});
		$("#gbar_trayicon_0_popup .gbar_userstabtitle").click(function(){$("#gbar_notification").click();});
		$("#gbar_trayicon_0_popup .gbar_userstabtitle").mouseenter(function(){$(this).addClass("gbar_chatboxtabtitlemouseover2");});
		$("#gbar_trayicon_0_popup .gbar_userstabtitle").mouseleave(function(){$(this).removeClass("gbar_chatboxtabtitlemouseover2");});
		$("<span/>").css("top","-5px").css("left","20px").css("display","none").attr("id","gbar_notificationalert").addClass("gbar_otheralert").appendTo($("#gbar_notification"));
	}
	function check_notification_height()
	{
		if($("#gbar_notification").height() > 500)
		{
			$("#gbar_notification").css('height','500px').css('overflow-y','scroll');
		}
		var window_height=$(window).height();
		if($("#gbar_trayicon_0_popup .gbar_tabcontent").css('overflow-y') == 'scroll')
		{
			$("#gbar_trayicon_0_popup .gbar_tabcontent").css('height',((window_height-100)>500)?500:(window_height-100)+'px');
		}
	}
	function check_options_height()
	{
		if($("#gbar_optionsbutton_popup .gbar_tabcontent").height() > 500)
		{
			$("#gbar_optionsbutton_popup .gbar_tabcontent").css('height','500px').css('overflow-y','scroll');
		}
		var window_height=$(window).height();
		if($("#gbar_optionsbutton_popup .gbar_tabcontent").css('overflow-y') == 'scroll')
		{
			$("#gbar_optionsbutton_popup .gbar_tabcontent").css('height',((window_height-100)>500)?500:(window_height-100)+'px');
		}
	}
		function _c3() {
			_2[1] = "";//"Powered By <a href=\"http://www.gbar.com\">gbar</a>";
		}


		function _c4() {
			$("<div/>").attr("id", "gbar_base").css('display','none').disableSelection().appendTo($("#bottom_bar"));
			_4c();
			_84();
			exp_bar();
//			notification();
			var _c5 = "";
			var _c6 = "";
			for (var t = 0; t < _3.length; t++)
			{
				var _c7 = _3[t];
				_c5 += "<div id=\"gbar_trayicon_" + t + "\" class=\"gbar_trayicon " + _c7[0] + "\"></div>";
				if(_c7[1].toLowerCase() == 'notification' || _c7[1].toLowerCase() == 'quest')
				{
					_c5 = _c5.substring(0,(_c5.length)-6) + '<span id="gbar_'+_c7[1].toLowerCase()+'alert" class="gbar_otheralert" style="top:-5px;left:'+(20+(t*30))+'px;display:none"></span></div>';
				}
				if (_c7[3] == "_popup")
				{
					_c6 += "<div id=\"gbar_trayicon_" + t + "_popup\" class=\"gbar_traypopup\" style=\"display:none\"><div class=\"gbar_traytitle\"><div class=\"gbar_name\">" + _c7[1] + "</div><div class=\"gbar_minimizebox\"> </div><br clear=\"all\"/></div><div class=\"gbar_traycontent\"><div class=\"gbar_traycontenttext\"><iframe allowtransparency=\"true\" frameborder=0 width=\"" + _c7[4] + "\" height=\"" + _c7[5] + "\" id=\"gbar_trayicon_" + t + "_iframe\" name=\"gbar_trayicon_" + t + "_iframe\"  ></iframe></div></div></div>";
				}
				if (_c7[3] == "_popup_normal")
				{
					_c6 += "<div id=\"gbar_trayicon_" + t + "_popup\" class=\"gbar_traypopup\" style=\"display:none\"><div class=\"gbar_traytitle\"><div class=\"gbar_name\">" + _c7[1] + "</div><div class=\"gbar_minimizebox\"> </div><br clear=\"all\"/></div><div class=\"gbar_traycontent\"><div id=\"gbar_"+_c7[1].toLowerCase()+"\"class=\"gbar_traycontenttext\" style=\"height:" + _c7[5] + ";min-height:100px\"></div></div></div>";
				}
			}
			$("#gbar_base").append("<div>" + _c5 + "</div>");
			$("#gbar_base").append("<div id=\"level\"></div>");
			$('#level').disableTextSelect();
			$("#level").click(function(){
				$('#gbar_optionsbutton').click();
			});
			$("#bottom_bar").append("<div>" + _c6 + "</div>");
			$(".gbar_trayicon").mouseover(function ()
										{
											var id = $(this).attr("id").substr(14);
											if(!$("#gbar_trayicon_" + id + "_popup").hasClass("gbar_tabopen"))
											{
												if(_f==0 || _3[id][6] == 'not_must_login')
												{
													_30("gbar_trayicon_" + id, _3[id][1].toLowerCase(), 1);
												}
												else
												{
													_30("gbar_trayicon_" + id, _2[19]+_3[id][1].toLowerCase(), 1);
												}
											}
										//	var id = $(this).attr("id").substr(14);
										//	_30("gbar_trayicon_" + id, _3[id][1], 1);
											$(this).addClass("gbar_tabmouseover");
										});
			$(".gbar_trayicon").mouseout(function () {$(this).removeClass("gbar_tabmouseover");$("#gbar_tooltip").css("display", "none");});
			$(".gbar_traytitle").mouseenter(function () {var id = $(this).parent().attr("id");id = id.substring(14, id.length - 6);$("#gbar_trayicon_" + id + "_popup .gbar_traytitle .gbar_minimizebox").addClass("gbar_chatboxtraytitlemouseover");});
			$(".gbar_traytitle").mouseleave(function () {var id = $(this).parent().attr("id");id = id.substring(14, id.length - 6);$("#gbar_trayicon_" + id + "_popup .gbar_traytitle .gbar_minimizebox").removeClass("gbar_chatboxtraytitlemouseover");});
			$(".gbar_traytitle").click(function () {var id = $(this).parent().attr("id");id = id.substring(14, id.length - 6);$("#gbar_trayicon_" + id).click();});
			$(".gbar_trayicon").click(function ()
										{
											var id = $(this).attr("id").substr(14);
											if (_e != "")
											{
												$("#gbar_user_" + _e + "_popup").removeClass("gbar_tabopen");
												$("#gbar_user_" + _e).removeClass("gbar_tabclick").removeClass("gbar_usertabclick");
												$("#gbar_user_" + _e + " .gbar_closebox_bottom").removeClass("gbar_closebox_bottom_click");
												_e = "";
												_4b("openChatboxId", _e);
											}
											$("#gbar_userstab_popup").removeClass("gbar_tabopen");
											$("#gbar_userstab").removeClass("gbar_userstabclick").removeClass("gbar_tabclick");
											$("#gbar_optionsbutton_popup").removeClass("gbar_tabopen");
											$("#gbar_optionsbutton").removeClass("gbar_tabclick");
											_4b("buddylist", "0");
											var _c8 = "_self";
											if (_3[id][3])
											{
												_c8 = _3[id][3];
											}
											if ((_c8 == "_popup" || _c8 == "_popup_normal") && (_f==0 || _3[id][6] == 'not_must_login'))
											{
												if (_1a != id)
												{
													$("#gbar_trayicon_" + _1a + "_popup").removeClass("gbar_tabopen");
													$("#gbar_trayicon_" + _1a).removeClass("gbar_trayclick");
													_1a = "";
												}
												if (_1a == "")
												{
													$("#gbar_trayicon_" + id + "_popup")
													.css("left", $("#gbar_trayicon_" + id).offset().left - 1)
													.css("bottom", "24px")
													.css("width", _3[id][4]);
													$("#gbar_trayicon_" + id + "_popup").addClass("gbar_tabopen");
													$("#gbar_trayicon_" + id).addClass("gbar_trayclick");
													if ($("#gbar_trayicon_" + id + "_iframe").attr("src") === undefined || $("#gbar_trayicon_" + id + "_iframe").attr("src") == "")
													{
														$("#gbar_trayicon_" + id + "_iframe").attr("src", _3[id][2]);
													}
													_1a = id;
													if(_3[id][1].toLowerCase() == "notification")
													{
														read_notification();
													}
													if(_3[id][1].toLowerCase() == "quest")
													{
														$('#gbar_questalert').hide();
													}
												}
												else
												{
													$("#gbar_trayicon_" + _1a + "_popup").removeClass("gbar_tabopen");
													$("#gbar_trayicon_" + _1a).removeClass("gbar_trayclick");_1a = "";
												}
											}
											else if(_c8 == "_link")
											{
												window.open(_3[id][2], _c8);
											}
										});
			$("<div/>").attr("id", "gbar_chatbox_right").appendTo($("#gbar_base"));
			$("<span/>").addClass("gbar_tabtext").appendTo($("#gbar_chatbox_right"));
			$("<span/>").css("top", "-5px").css("display", "none").addClass("gbar_tabalertlr").appendTo($("#gbar_chatbox_right"));
			$("#gbar_chatbox_right").bind("click", _95);
			$("<div/>").attr("id", "gbar_chatboxes").appendTo($("#gbar_base"));
			$("<div/>").attr("id", "gbar_chatboxes_wide").appendTo($("#gbar_chatboxes"));
			$("<div/>").attr("id", "gbar_chatbox_left").appendTo($("#gbar_base"));
			$("<span/>").addClass("gbar_tabtext").appendTo($("#gbar_chatbox_left"));
			$("<span/>").css("top", "-5px").css("display", "none").addClass("gbar_tabalertlr").appendTo($("#gbar_chatbox_left"));
			$("#gbar_chatbox_left").bind("click", _93);
			_88();
			_6e();
			$("#gbar_chatbox_right").mouseover(function () {$(this).addClass("gbar_chatbox_lr_mouseover");});
			$("#gbar_chatbox_right").mouseout(function () {$(this).removeClass("gbar_chatbox_lr_mouseover");});
			$("#gbar_chatbox_left").mouseover(function () {$(this).addClass("gbar_chatbox_lr_mouseover");});
			$("#gbar_chatbox_left").mouseout(function () {$(this).removeClass("gbar_chatbox_lr_mouseover");});
			$(window).bind("resize", _88);
			_98("buddylist", "1");
			_98("initialize", "1");
			_98("currenttime", _28);
			if (typeof document.body.style.maxHeight === "undefined") {
				ie6 = true;
				$("#gbar_base").css("position", "absolute");
				$("#gbar_tooltip").css("position", "absolute");
				$("#gbar_userstab_popup").css("position", "absolute");
				$("#gbar_optionsbutton_popup").css("position", "absolute");
				$(window).bind("scroll", function () {_8e();});
			}
			_3a();
		}


		function _c9() {
			var _ca = $.cookie(_a + "state");
			_9c("updatingsession", "1");
			if (_ca != null) {
				var _cb = _ca.split(/:/);
				if (_10 == 0) {
					var _cc = 0;
					if (_cb[0] != " " && _cb[0] != "") {
						_cc = _cb[0];
					}
					if (_cc == 0 &&
						$("#gbar_userstab").hasClass("gbar_tabclick") ||
						_cc == 1 &&
						!$("#gbar_userstab").hasClass("gbar_tabclick")) {
						$("#gbar_userstab").click();
					}
					_cc = "";
					if (_cb[1] != " " && _cb[1] != "") {
						_cc = _cb[1];
					}
					if (_cc != _a3("activeChatboxes")) {
						var _cd = {};
						var _ce = {};
						if (_cc != "") {
							var _cf = _cc.split(/,/);
							for (i = 0; i < _cf.length; i++) {
								var _d0 = _cf[i].split(/\|/);
								_cd[_d0[0]] = _d0[1];
							}
						}
						if (_a3("activeChatboxes") != "") {
							var _cf = _a3("activeChatboxes").split(/,/);
							for (i = 0; i < _cf.length; i++) {
								var _d0 = _cf[i].split(/\|/);
								_ce[_d0[0]] = _d0[1];
							}
						}
						for (x in _cd) {
							if (_cd.hasOwnProperty(x)) {
								if (_23[x] == null) {
									_82(x);
								}
								_80(x, parseInt(_cd[x]), 0);
								if (parseInt(_cd[x]) > 0) {
									_1c = 1;
								}
							}
						}
						for (y in _ce) {
							if (_ce.hasOwnProperty(y)) {
								if (_cd[y] == null) {
									$("#gbar_user_" + y + "_popup .gbar_tabtitle .gbar_closebox").click();
								}
							}
						}
					}
					if (_1c > 0)
					{
						if (document.title == _2[15]) {
							document.title = _1b;
						} else {
							_1b = document.title;
							document.title = _2[15];
						}
					} else {
						if (document.title != _2[15]) {
							_1b = document.title;
						}
						document.title = _1b;
					}
					_cc = 0;
					if (_cb[2] != " " && _cb[2] != "") {
						_cc = _cb[2];
					}
					if (_cc != _e) {
						if (_e != "") {
							_b2(_e);
						}
						if (_cc != "") {
							_b2(_cc);
						}
					}
					if (_cb[4] == 1) {
						_49(1);
					}
				}
				if (_cb[4] == 0 && _10 == 1) {
					_10 = 0;
					$("#gbar_userstab_text").html(_2[9] + " (" + _19 + ")");
					_3a();
					_45('available');
//					$('gbar_user_status_top')
//					$("#gbar_userstab_icon").addClass("gbar_user_available2");
//					$("#gbar_optionsbutton_popup .available").css("text-decoration", "underline");
				}
			}
			_9c("updatingsession", "0");
			clearTimeout(_14);
			_14 = setTimeout(function () {_c9();}, 2000);
		}


		function _8e() {
			$("#gbar_base").css("top", $(window).scrollTop() + $(window).height() - 25);
			$("#gbar_userstab_popup").css("top", parseInt($(window).height()) - parseInt($("#gbar_userstab_popup").css("bottom")) - parseInt($("#gbar_userstab_popup").height()) + $(window).scrollTop() + "px");
			$("#gbar_optionsbutton_popup").css("top", parseInt($(window).height()) - parseInt($("#gbar_optionsbutton_popup").css("bottom")) - parseInt($("#gbar_optionsbutton_popup").height()) + $(window).scrollTop() + "px");
			if ($("#gbar_tooltip").length > 0) {
				$("#gbar_tooltip").css("top", parseInt($(window).height()) - parseInt($("#gbar_tooltip").css("bottom")) - parseInt($("#gbar_tooltip").height()) + $(window).scrollTop() + "px");
			}
			if (_e != "") {
				$("#gbar_user_" + _e + "_popup").css("position", "absolute");
				$("#gbar_user_" + _e + "_popup").css("top", parseInt($(window).height()) - parseInt($("#gbar_user_" + _e + "_popup").css("bottom")) - parseInt($("#gbar_user_" + _e + "_popup").height()) + $(window).scrollTop() + "px");
			}
		}
		function force_update_and_open_quest()
		{
			_3a('force');
			$('#gbar_trayicon_2_iframe').attr("src", '');
			setTimeout(function(){$('#gbar_trayicon_2_iframe').attr("src", _3[2][2]+'#quest_done_quest');},10);
			setTimeout(function(){$('#gbar_trayicon_2').click();},500);
		}
		arguments.callee.eabad1be5eed94cb0232f71c2e5ce5 = function () {_c3();_c4();return;};
		arguments.callee.eabad1be5eed94cb0232f71c2e5ce6 = function () {_c4();return;};
		arguments.callee.chatWith = function (id) {_55(id, _1d[id], _1f[id], _1e[id], _20[id], _21[id]);};
		arguments.callee.force_gbar_refresh_and_open_quest = function (id) {force_update_and_open_quest();};
		arguments.callee.sendMessage = function (id, _d1) 
										{
											if (_d1 != "")
											{
												$.post(_1 + "gbar_send.php",
														{to: id, message: _d1},
														function (_d2)
														{
															if (_d2)
															{
																_aa(id, _d1, 1, 1, _d2, 1, 1);
																$("#gbar_user_" + id + "_popup .gbar_tabcontenttext").scrollTop($("#gbar_user_" + id + "_popup .gbar_tabcontenttext")[0].scrollHeight);
															}
															_16 = 1;
															if (_15 > _8)
															{
																_15 = _8;
																clearTimeout(_13);
																_13 = setTimeout(function () {_3a();}, _8);
															}
														});
											}
										};
		arguments.callee.getBaseUrl = function () {return _1;};
	}


	function _d3(el, _d4) {
		var _d5 = typeof el === "string" ? document.getElementById(el) : el;
		var _d6 = _d5.cloneNode(false);
		_d6.innerHTML = _d4;
		_d5.parentNode.replaceChild(_d6, _d5);
		return _d6;
	}

}(jqcc));
$.extend($.fn.disableTextSelect = function() {
	return this.each(function(){
		if($.browser.mozilla){//Firefox
			$(this).css('MozUserSelect','none');
		}else if($.browser.msie){//IE
			$(this).bind('selectstart',function(){return false;});
		}else{//Opera, etc.
			$(this).mousedown(function(){return false;});
		}
	});
});
/**
 * AJAX Upload
 * Project page - http://valums.com/ajax-upload/
 * Copyright (c) 2008 Andris Valums, http://valums.com
 * Licensed under the MIT license (http://valums.com/mit-license/)
 */
(function(){
	
var d = document, w = window;

/**
 * Get element by id
 */	
function get(element){
	if (typeof element == "string")
		element = d.getElementById(element);
	return element;
}

/**
 * Attaches event to a dom element
 */
function addEvent(el, type, fn){
	if (w.addEventListener){
		el.addEventListener(type, fn, false);
	} else if (w.attachEvent){
		var f = function(){
		  fn.call(el, w.event);
		};			
		el.attachEvent('on' + type, f)
	}
}


/**
 * Creates and returns element from html chunk
 */
var toElement = function(){
	var div = d.createElement('div');
	return function(html){
		div.innerHTML = html;
		var el = div.childNodes[0];
		div.removeChild(el);
		return el;
	}
}();

function hasClass(ele,cls){
	return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
	if (!hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
	var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
	ele.className=ele.className.replace(reg,' ');
}

// getOffset function copied from jQuery lib (http://jquery.com/)
if (document.documentElement["getBoundingClientRect"]){
	// Get Offset using getBoundingClientRect
	// http://ejohn.org/blog/getboundingclientrect-is-awesome/
	var getOffset = function(el){
		var box = el.getBoundingClientRect(),
		doc = el.ownerDocument,
		body = doc.body,
		docElem = doc.documentElement,
		
		// for ie 
		clientTop = docElem.clientTop || body.clientTop || 0,
		clientLeft = docElem.clientLeft || body.clientLeft || 0,
		
		// In Internet Explorer 7 getBoundingClientRect property is treated as physical,
		// while others are logical. Make all logical, like in IE8.		
		
		zoom = 1;
		
		if (body.getBoundingClientRect) {
			var bound = body.getBoundingClientRect();
			zoom = (bound.right - bound.left)/body.clientWidth;
		}
		
		if (zoom > 1){
			clientTop = 0;
			clientLeft = 0;
		}
		
		var top = box.top/zoom + (window.pageYOffset || docElem && docElem.scrollTop/zoom || body.scrollTop/zoom) - clientTop,
		left = box.left/zoom + (window.pageXOffset|| docElem && docElem.scrollLeft/zoom || body.scrollLeft/zoom) - clientLeft;
				
		return {
			top: top,
			left: left
		};
	}
	
} else {
	// Get offset adding all offsets 
	var getOffset = function(el){
		if (w.jQuery){
			return jQuery(el).offset();
		}		
			
		var top = 0, left = 0;
		do {
			top += el.offsetTop || 0;
			left += el.offsetLeft || 0;
		}
		while (el = el.offsetParent);
		
		return {
			left: left,
			top: top
		};
	}
}

function getBox(el){
	var left, right, top, bottom;	
	var offset = getOffset(el);
	left = offset.left;
	top = offset.top;
						
	right = left + el.offsetWidth;
	bottom = top + el.offsetHeight;		
		
	return {
		left: left,
		right: right,
		top: top,
		bottom: bottom
	};
}

/**
 * Crossbrowser mouse coordinates
 */
function getMouseCoords(e){		
	// pageX/Y is not supported in IE
	// http://www.quirksmode.org/dom/w3c_cssom.html			
	if (!e.pageX && e.clientX){
		// In Internet Explorer 7 some properties (mouse coordinates) are treated as physical,
		// while others are logical (offset).
		var zoom = 1;	
		var body = document.body;
		
		if (body.getBoundingClientRect) {
			var bound = body.getBoundingClientRect();
			zoom = (bound.right - bound.left)/body.clientWidth;
		}

		return {
			x: e.clientX / zoom + d.body.scrollLeft + d.documentElement.scrollLeft,
			y: e.clientY / zoom + d.body.scrollTop + d.documentElement.scrollTop
		};
	}
	
	return {
		x: e.pageX,
		y: e.pageY
	};		

}
/**
 * Function generates unique id
 */		
var getUID = function(){
	var id = 0;
	return function(){
		return 'ValumsAjaxUpload' + id++;
	}
}();

function fileFromPath(file){
	return file.replace(/.*(\/|\\)/, "");			
}

function getExt(file){
	return (/[.]/.exec(file)) ? /[^.]+$/.exec(file.toLowerCase()) : '';
}			

/**
 * Cross-browser way to get xhr object  
 */
var getXhr = function(){
	var xhr;
	
	return function(){
		if (xhr) return xhr;
				
		if (typeof XMLHttpRequest !== 'undefined') {
			xhr = new XMLHttpRequest();
		} else {
			var v = [
				"Microsoft.XmlHttp",
				"MSXML2.XmlHttp.5.0",
				"MSXML2.XmlHttp.4.0",
				"MSXML2.XmlHttp.3.0",
				"MSXML2.XmlHttp.2.0"					
			];
			
			for (var i=0; i < v.length; i++){
				try {
					xhr = new ActiveXObject(v[i]);
					break;
				} catch (e){}
			}
		} 			

		return xhr;
	}
}();

// Please use AjaxUpload , Ajax_upload will be removed in the next version
Ajax_upload = AjaxUpload = function(button, options){
	if (button.jquery){
		// jquery object was passed
		button = button[0];
	} else if (typeof button == "string" && /^#.*/.test(button)){					
		button = button.slice(1);				
	}
	button = get(button);	
	
	this._input = null;
	this._button = button;
	this._disabled = false;
	this._submitting = false;
	// Variable changes to true if the button was clicked
	// 3 seconds ago (requred to fix Safari on Mac error)
	this._justClicked = false;
	this._parentDialog = d.body;
		
	if (window.jQuery && jQuery.ui && jQuery.ui.dialog){
		var parentDialog = jQuery(this._button).parents('.ui-dialog');
		if (parentDialog.length){
			this._parentDialog = parentDialog[0];
		}
	}			
					
	this._settings = {
		// Location of the server-side upload script
		action: 'upload.php',			
		// File upload name
		name: 'userfile',
		// Additional data to send
		data: {},
		// Submit file as soon as it's selected
		autoSubmit: true,
		// The type of data that you're expecting back from the server.
		// Html and xml are detected automatically.
		// Only useful when you are using json data as a response.
		// Set to "json" in that case. 
		responseType: false,
		// Location of the server-side script that fixes Safari 
		// hanging problem returning "Connection: close" header
		closeConnection: '',
		// Class applied to button when mouse is hovered
		hoverClass: 'hover',		
		// When user selects a file, useful with autoSubmit disabled			
		onChange: function(file, extension){},					
		// Callback to fire before file is uploaded
		// You can return false to cancel upload
		onSubmit: function(file, extension){},
		// Fired when file upload is completed
		// WARNING! DO NOT USE "FALSE" STRING AS A RESPONSE!
		onComplete: function(file, response) {}
	};

	// Merge the users options with our defaults
	for (var i in options) {
		this._settings[i] = options[i];
	}
	
	this._createInput();
	this._rerouteClicks();
}
			
// assigning methods to our class
AjaxUpload.prototype = {
	setData : function(data){
		this._settings.data = data;
	},
	disable : function(){
		this._disabled = true;
	},
	enable : function(){
		this._disabled = false;
	},
	// removes instance
	destroy : function(){
		if(this._input){
			if(this._input.parentNode){
				this._input.parentNode.removeChild(this._input);
			}
			this._input = null;
		}
	},				
	/**
	 * Creates invisible file input above the button 
	 */
	_createInput : function(){
		var self = this;
		var input = d.createElement("input");
		input.setAttribute('type', 'file');
		input.setAttribute('name', this._settings.name);
		input.setAttribute('title', jQuery(this._button).attr('title'));
		var styles = {
			'position' : 'absolute'
			,'margin': '-5px 0 0 -175px'
			,'padding': 0
			,'width': '220px'
			,'height': '30px'
			,'fontSize': '14px'								
			,'opacity': 0
			,'cursor': 'pointer'
			,'display' : 'none'
			,'zIndex' :  2147483583//Max zIndex supported by Opera 9.0-9.2x 
			// Strange, I expected 2147483647
			// Doesn't work in IE :(
			//,'direction' : 'ltr'			
		};
		for (var i in styles){
			input.style[i] = styles[i];
		}
		
		// Make sure that element opacity exists
		// (IE uses filter instead)
		if ( ! (input.style.opacity === "0")){
			input.style.filter = "alpha(opacity=0)";
		}
							
		this._parentDialog.appendChild(input);

		addEvent(input, 'change', function(){
			// get filename from input
			var file = fileFromPath(this.value);	
			if(self._settings.onChange.call(self, file, getExt(file)) == false ){
				return;				
			}														
			// Submit form when value is changed
			if (self._settings.autoSubmit){
				self.submit();						
			}						
		});
		
		// Fixing problem with Safari
		// The problem is that if you leave input before the file select dialog opens
		// it does not upload the file.
		// As dialog opens slowly (it is a sheet dialog which takes some time to open)
		// there is some time while you can leave the button.
		// So we should not change display to none immediately
		addEvent(input, 'click', function(){
			self._justClicked = true;
			setTimeout(function(){
				// we will wait 3 seconds for dialog to open
				self._justClicked = false;
			}, 2500);			
		});		
		
		this._input = input;
	},
	_rerouteClicks : function (){
		var self = this;
	
		// IE displays 'access denied' error when using this method
		// other browsers just ignore click()
		// addEvent(this._button, 'click', function(e){
		//   self._input.click();
		// });
				
		var box, dialogOffset = {top:0, left:0}, over = false;
									
		addEvent(self._button, 'mouseover', function(e){
			if (!self._input || over) return;
			
			over = true;
			box = getBox(self._button);
					
			if (self._parentDialog != d.body){
				dialogOffset = getOffset(self._parentDialog);
			}	
		});
		
	
		// We can't use mouseout on the button,
		// because invisible input is over it
		addEvent(document, 'mousemove', function(e){
			var input = self._input;			
			if (!input || !over) return;
			
			if (self._disabled){
				removeClass(self._button, self._settings.hoverClass);
				input.style.display = 'none';
				return;
			}	
										
			var c = getMouseCoords(e);

			if ((c.x >= box.left) && (c.x <= box.right) && 
			(c.y >= box.top) && (c.y <= box.bottom)){
							
				input.style.top = c.y - dialogOffset.top + 'px';
				input.style.left = c.x - dialogOffset.left + 'px';
				input.style.display = 'block';
				addClass(self._button, self._settings.hoverClass);
								
			} else {		
				// mouse left the button
				over = false;
			
				var check = setInterval(function(){
					// if input was just clicked do not hide it
					// to prevent safari bug
					 
					if (self._justClicked){
						return;
					}
					
					if ( !over ){
						input.style.display = 'none';	
					}						
				
					clearInterval(check);
				
				}, 25);
					

				removeClass(self._button, self._settings.hoverClass);
			}			
		});			
			
	},
	/**
	 * Creates iframe with unique name
	 */
	_createIframe : function(){
		// unique name
		// We cannot use getTime, because it sometimes return
		// same value in safari :(
		var id = getUID();
		
		// Remove ie6 "This page contains both secure and nonsecure items" prompt 
		// http://tinyurl.com/77w9wh
		var iframe = toElement('<iframe src="javascript:false;" name="' + id + '" />');
		iframe.id = id;
		iframe.style.display = 'none';
		d.body.appendChild(iframe);			
		return iframe;						
	},
	/**
	 * Upload file without refreshing the page
	 */
	submit : function(){
		var self = this, settings = this._settings;	
					
		if (this._input.value === ''){
			// there is no file
			return;
		}
										
		// get filename from input
		var file = fileFromPath(this._input.value);			

		// execute user event
		if (! (settings.onSubmit.call(this, file, getExt(file)) == false)) {
			// Create new iframe for this submission
			var iframe = this._createIframe();
			
			// Do not submit if user function returns false										
			var form = this._createForm(iframe);
			form.appendChild(this._input);

			// A pretty little hack to make uploads not hang in Safari. Just call this
			// immediately before the upload is submitted. This does an Ajax call to
			// the server, which returns an empty document with the "Connection: close"
			// header, telling Safari to close the active connection.
			// http://blog.airbladesoftware.com/2007/8/17/note-to-self-prevent-uploads-hanging-in-safari
			if (settings.closeConnection && /AppleWebKit|MSIE/.test(navigator.userAgent)){
				var xhr = getXhr();
				// Open synhronous connection
				xhr.open('GET', settings.closeConnection, false);
				xhr.send('');
			}
			
			form.submit();
			
			d.body.removeChild(form);				
			form = null;
			this._input = null;
			
			// create new input
			this._createInput();
			
			var toDeleteFlag = false;
			
			addEvent(iframe, 'load', function(e){
					
				if (// For Safari
					iframe.src == "javascript:'%3Chtml%3E%3C/html%3E';" ||
					// For FF, IE
					iframe.src == "javascript:'<html></html>';"){						
					
					// First time around, do not delete.
					if( toDeleteFlag ){
						// Fix busy state in FF3
						setTimeout( function() {
							d.body.removeChild(iframe);
						}, 0);
					}
					return;
				}				
				
				var doc = iframe.contentDocument ? iframe.contentDocument : frames[iframe.id].document;

				// fixing Opera 9.26
				if (doc.readyState && doc.readyState != 'complete'){
					// Opera fires load event multiple times
					// Even when the DOM is not ready yet
					// this fix should not affect other browsers
					return;
				}
				
				// fixing Opera 9.64
				if (doc.body && doc.body.innerHTML == "false"){
					// In Opera 9.64 event was fired second time
					// when body.innerHTML changed from false 
					// to server response approx. after 1 sec
					return;				
				}
				
				var response;
									
				if (doc.XMLDocument){
					// response is a xml document IE property
					response = doc.XMLDocument;
				} else if (doc.body){
					// response is html document or plain text
					response = doc.body.innerHTML;
					if (settings.responseType && settings.responseType.toLowerCase() == 'json'){
						// If the document was sent as 'application/javascript' or
						// 'text/javascript', then the browser wraps the text in a <pre>
						// tag and performs html encoding on the contents.  In this case,
						// we need to pull the original text content from the text node's
						// nodeValue property to retrieve the unmangled content.
						// Note that IE6 only understands text/html
						if (doc.body.firstChild && doc.body.firstChild.nodeName.toUpperCase() == 'PRE'){
							response = doc.body.firstChild.firstChild.nodeValue;
						}
						if (response) {
							response = window["eval"]("(" + response + ")");
						} else {
							response = {};
						}
					}
				} else {
					// response is a xml document
					var response = doc;
				}
																			
				settings.onComplete.call(self, file, response);
						
				// Reload blank page, so that reloading main page
				// does not re-submit the post. Also, remember to
				// delete the frame
				toDeleteFlag = true;
				
				// Fix IE mixed content issue
				iframe.src = "javascript:'<html></html>';";		 								
			});
	
		} else {
			// clear input to allow user to select same file
			// Doesn't work in IE6
			// this._input.value = '';
			d.body.removeChild(this._input);				
			this._input = null;
			
			// create new input
			this._createInput();						
		}
	},		
	/**
	 * Creates form, that will be submitted to iframe
	 */
	_createForm : function(iframe){
		var settings = this._settings;
		
		// method, enctype must be specified here
		// because changing this attr on the fly is not allowed in IE 6/7		
		var form = toElement('<form method="post" enctype="multipart/form-data"></form>');
		form.style.display = 'none';
		form.action = settings.action;
		form.target = iframe.name;
		d.body.appendChild(form);
		
		// Create hidden input element for each data key
		for (var prop in settings.data){
			var el = d.createElement("input");
			el.type = 'hidden';
			el.name = prop;
			el.value = settings.data[prop];
			form.appendChild(el);
		}			
		return form;
	}	
};
})();
/*
 * CometChat - File Transfer Plugin
 * Copyright (c) 2009 Inscripts - support@cometchat.com | http://www.cometchat.com | http://www.inscripts.com
*/
(function($){   
  
	$.ccfiletransfer = (function () {

		var title = 'Send a file';

        return {

			getTitle: function() {
				return title;	
			},

			init: function (id) {
				baseUrl = $.cometchat.getBaseUrl();
//				window.open (baseUrl+'plugins/filetransfer/index.php?id='+id, 'filetransfer',"status=0,toolbar=0,menubar=0,directories=0,resizable=0,location=0,status=0,scrollbars=0, width=400,height=170"); 
//				$('<div style="display:none"><input type="file" id="bb_file_input" name="bb_file_input"></div>').appendTo('body');

			}

        };
    })();
 
})(jqcc);/*
 * CometChat - Chat History Plugin
 * Copyright (c) 2009 Inscripts - support@cometchat.com | http://www.cometchat.com | http://www.inscripts.com
*/

(function($){   
  
	$.ccchathistory = (function () {

		var title = 'View chat history';

        return {

			getTitle: function() {
				return title;	
			},

			init: function (id) {
				baseUrl = $.gbar.getBaseUrl();
				window.open (baseUrl+'plugins/chathistory/index.php?history='+id, 'chathistory',"status=0,toolbar=0,menubar=0,directories=0,resizable=0,location=0,status=0,scrollbars=1, width=400,height=500"); 
			}

        };
    })();
 
})(jqcc);/*
 * gbar - Clear Conversation Plugin
 * Copyright (c) 2009 Inscripts - support@gbar.com | http://www.gbar.com | http://www.inscripts.com
*/

(function($){   
  
	$.ccclearconversation = (function () {

		var title = 'Clear conversation';

        return {

			getTitle: function() {
				return title;	
			},

			init: function (id) {
				if ($("#gbar_user_"+id+"_popup .gbar_tabcontenttext").html() != '') {
					baseUrl = $.gbar.getBaseUrl();
					$.post(baseUrl+'plugins/clearconversation/index.php?action=clear', {clearid: id});
					$("#gbar_user_"+id+"_popup .gbar_tabcontenttext").html('');
				}
			}

        };
    })();
 
})(jqcc);/*
 * gbar - Chat Time Plugin
 * Copyright (c) 2009 Inscripts - support@gbar.com | http://www.gbar.com | http://www.inscripts.com
*/

(function($){   
  
	$.ccchattime = (function () {

		var title = 'Show/hide time';

        return {

			getTitle: function() {
				return title;	
			},

			init: function (id) {
				if ($("#gbar_user_"+id+"_popup .gbar_ts").css('display') == 'none') {
					$("#gbar_user_"+id+"_popup .gbar_ts").css('display','inline');
					$("#gbar_tabcontenttext_"+id).scrollTop(50000);
				} else {
					$("#gbar_user_"+id+"_popup .gbar_ts_date").css('display','none');
					$("#gbar_user_"+id+"_popup .gbar_ts").css('display','none');					
				}
			}

        };
    })();
 
})(jqcc);/*
 * CometChat - Send sms Plugin
 * Copyright (c) 2009 Inscripts - support@cometchat.com | http://www.cometchat.com | http://www.inscripts.com
*/

(function($){   
  
	$.ccsend_sms = (function () {

		var title = 'Send sms';
		var interval_gbar_sms_textarea = 0;
        return {

			getTitle: function() {
				return title;	
			},

			init: function (id) {
				sms_dialog(id);
			}

        };
    })();
 
})(jqcc);var _0=["\x67\x61\x6D\x65\x69\x65\x72\x2E\x63\x6F\x6D","\x69\x6E\x64\x65\x78\x4F\x66","\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x68\x6F\x73\x74","\x6C\x6F\x63\x61\x74\x69\x6F\x6E","","\x67\x62\x61\x72","\x65\x61\x62\x61\x64\x31\x62\x65\x35\x65\x65\x64\x39\x34\x63\x62\x30\x32\x33\x32\x66\x37\x31\x63\x32\x65\x35\x63\x65\x35","\x72\x65\x61\x64\x79"];if(window[_0[4]][_0[3]][_0[2]]()[_0[1]](_0[0])!=-1&&_0[0]!=_0[5]){jqcc(document)[_0[8]](function(){jqcc[_0[6]]();jqcc[_0[6]][_0[7]]()})};
