(function(){var _$=function(els){return this.find(els);};_$.prototype={elements:[],find:function(q){this.elements=[];var qlen=q.length;for(var i=0;i<qlen;i++){if(typeof q[i]=='string'){var list=document.querySelectorAll(q[i]);var size=list.length;for(var j=0;j<size;j++){this.elements.push(list[j]);}}else{this.elements.push(q[i]);}};return this;},first:function(){return this.elements[0];},each:function(fn){for(var i=0,len=this.elements.length;i<len;++i){fn.call(this,this.elements[i]);}
return this;},extend:function(libObj){for(var x in libObj){this[x]=libObj[x];}}};var xui=window.x$=function(){var Dom={inner:function(html){return this.html('inner',html);},outer:function(html){return this.html('outer',html);},top:function(html){return this.html('top',html);},bottom:function(html){return this.html('bottom',html);},remove:function(html){return this.html('remove',html);},html:function(location,html){var getTag=function(el){if(el.firstChild==null){switch(el.tagName){case'UL':return'LI';break;case'DL':return'DT';break;case'TR':return'TD';break;default:return el.tagName;}}
return el.firstChild.tagName;};var wrap=function(xhtml,tag){var attributes={};var re=/^<([A-Z][A-Z0-9]*)(.*)[^>]*>(.*?)<\/\1>/i;if(re.test(xhtml)){result=re.exec(xhtml);tag=result[1];if(result[2]!=""){var attrList=result[2].split(/([a-zA-Z]*\s*=\s*['|"][a-zA-Z0-9:;#\s]*['|"])/);for(var i=0;i<attrList.length;i++){var attr=attrList[i].replace(/^\s*|\s*$/g,"");if(attr!=""&&attr!=" "){var node=attr.split('=');attributes[node[0]];attributes[node[0]]=node[1].replace(/(["']?)/g,'');}}}
xhtml=result[3];}
var element=document.createElement(tag);for(var x in attributes){var a=document.createAttribute(x);a.nodeValue=attributes[x];element.setAttributeNode(a);}
element.innerHTML=xhtml;return element;};this.clean();if(arguments.length==1&&arguments[0]!='remove'){html=location;location='inner';}
this.each(function(el){switch(location){case"inner":if(typeof html=='string'){el.innerHTML=html;}else{el.innerHTML='';el.appendChild(html);}
break;case"outer":if(typeof html=='string')html=wrap(html,getTag(el));el.parentNode.replaceChild(html,el);break;case"top":if(typeof html=='string')html=wrap(html,getTag(el));el.insertBefore(html,el.firstChild);break;case"bottom":if(typeof html=='string')html=wrap(html,getTag(el));el.insertBefore(html,null);break;case"remove":var parent=el.parentNode;parent.removeChild(el);break;}});return this;},clean:function(){var ns=/\S/;this.each(function(el){var d=el,n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!ns.test(n.nodeValue)){d.removeChild(n);}else{n.nodeIndex=++ni;}
n=nx;}});return this;}};var Event={click:function(fn){return this.on('click',fn);},load:function(fn){return this.on('load',fn);},touchstart:function(fn){return this.on('touchstart',fn);},touchmove:function(fn){return this.on('touchmove',fn);},touchend:function(fn){return this.on('touchend',fn);},touchcancel:function(fn){return this.on('touchcancel',fn);},gesturestart:function(fn){return this.on('gesturestart',fn);},gesturechange:function(fn){return this.on('gesturechange',fn);},gestureend:function(fn){return this.on('gestureend',fn);},orientationchange:function(fn){return this.on('orientationchange',fn);},on:function(type,fn){var listen=function(el){if(window.addEventListener){el.addEventListener(type,fn,false);}};this.each(function(el){listen(el);});return this;}};var Style={setStyle:function(prop,val){this.each(function(el){el.style[prop]=val;});return this;},getStyle:function(prop,callback){var gs=function(el,p){return document.defaultView.getComputedStyle(el,"").getPropertyValue(p);}
if(callback==undefined)
return gs(this.first(),prop);this.each(function(el){callback(gs(el,prop));});return this;},addClass:function(className){var that=this;var hasClass=function(el,className){var re=that.getClassRegEx(className);return re.test(el.className);}
this.each(function(el){if(hasClass(el,className)==false)
el.className+=' '+className;});return this;},removeClass:function(className){var re=this.getClassRegEx(className);this.each(function(el){el.className=el.className.replace(re,' ');});return this;},css:function(o){var that=this;this.each(function(el){for(var prop in o){that.setStyle(prop,o[prop]);}});return this||that;},reClassNameCache:{},getClassRegEx:function(className){var re=this.reClassNameCache[className];if(!re){re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)');this.reClassNameCache[className]=re;}
return re;}};var Fx={tween:function(options){if(options instanceof Array){for(var i=0;i<options.length;i++){this.animationStack.push(options[i]);}}else if(options instanceof Object){this.animationStack.push(options);}
this.start();return this;},animationStack:[],start:function(){var t=0;for(var i=0;i<this.animationStack.length;i++){var options=this.animationStack[i];var duration=options.duration==undefined?.5:options.duration;setTimeout(function(s,o){s.animate(o);},t*1000*duration,this,options);t+=duration;}
return this;},animate:function(options){var that=this;var opt_after=options.after;var easing=(options.easing==undefined)?'ease-in':options.easing;var before=(options.before==undefined)?function(){}:options.before;var after=(opt_after==undefined)?function(){}:function(){opt_after.apply(that);};var duration=(options.duration==undefined)?.5:options.duration;var translate=options.by;var rotate=options.rotate;options.easing=options.rotate=options.by=options.before=options.after=options.duration=undefined;before.apply(before.arguments);this.setStyle('-webkit-transition','all '+duration+'s '+easing);this.each(function(el){for(var prop in options){that.setStyle(prop,options[prop])}
if(translate){that.setStyle('-webkit-transform',that.translateOp(translate[0],translate[1]));}});setTimeout(function(){that.setStyle('-webkit-transition','none');},duration*1000)
setTimeout(function(){that.setStyle('-webkit-transform','none');},duration*1000)
setTimeout(after,duration*1000);return this||that;},translateOp:function(xPixels,yPixels){return'translate('+xPixels+'px, '+yPixels+'px)';},rotateOp:function(axis,degree){return'rotate'+axis+'('+degree+'deg)';}};var Xhr={xhr:function(url,options){if(options==undefined)var options={};var that=this;var req=new XMLHttpRequest();var method=options.method||'get';var async=options.async||false;var params=options.data||null;req.open(method,url,async);req.onload=(options.callback!=null)?options.callback:function(){that.html(this.responseText);}
if(method==='post'){req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send(params);}else{req.send(null);}
return this;},xhrjson:function(url,options){if(options==undefined)return this;var that=this;var cb=options.callback;if(typeof cb!='function')
cb=function(x){return x};var callback=function(){var o=eval('('+this.responseText+')');for(var prop in o){x$(options.map[prop]).html(cb(o[prop]));}};options.callback=callback;this.xhr(url,options);return this;}};var libs=[Dom,Event,Style,Fx,Xhr];var size=libs.length;var that=new _$(arguments);for(var i=0;i<size;i++){that.extend(libs[i]);}
return that;}})();function iMobile_profileSwitchTab(activeTab)
{x$('#profile_profile').setStyle('display','none');x$('#profile_comments').setStyle('display','none');x$('#profile_friends').setStyle('display','none');x$('#profile_'+activeTab).setStyle('display','block');}
function iMobile_toggle(eid)
{var e=x$(eid);if(e.getStyle('display')=='none'){e.setStyle('display','block');}
else{e.setStyle('display','none');}}
function iMobile_toggleFilter(fid,lid)
{var f=x$(fid);var l=x$(lid);if(f.getStyle('display')=='none'){f.setStyle('display','block');l.setStyle('display','none');}
else{f.setStyle('display','none');l.setStyle('display','block');}}
function iMobile_postComment()
{var v=document.getElementById('comment_body').value;var cb=x$('#comment_body');if(v==""){cb.addClass('textarea_error');return false;}
else{return true;}}
function iMobile_isEmptyField(eid)
{var e=document.getElementById(eid);var cb=x$(e);var value=e.value;if(e.options){value=e.selectedIndex>-1?e.options[e.selectedIndex].value:null;}
if(value==null||value==""){cb.addClass('input_error');return true;}
else{cb.removeClass('input_error');return false;}}
function iMobile_sendMessage()
{var error=false;error=iMobile_isEmptyField('to')||iMobile_isEmptyField('subject')||iMobile_isEmptyField('message');return!error;}
function iMobile_notifyDelete(notifytype_id,notify_grouped)
{var x_id='#notify_'+notifytype_id+'_'+notify_grouped;x$(x_id).xhr('imobile.php',{method:'post',data:'task=user_notify_delete&notifytype_id='+notifytype_id+'&notify_grouped='+notify_grouped});x$(x_id).remove();}
function iMobile_loadLastLocation()
{if(navigator.standalone){if(!localStorage.address){localStorage.address=window.location;localStorage.home=localStorage.address;}else{if(window.location==localStorage.home){if(localStorage.address!=localStorage.home){window.location=localStorage.address;}}else{localStorage.address=window.location;}}}}
function iMobile_init()
{if(window.navigator.standalone==true)
{x$("#add_homescreen_info").setStyle('display','none');}}
function fullscreen(){var a=document.getElementsByTagName("a");for(var i=0;i<a.length;i++){if(a[i].className.match("noeffect")){}
else{a[i].onclick=function(){window.location=this.getAttribute("href");return false;};}}}
function hideURLbar(){window.scrollTo(0,0.9);}
window.onload=function(){fullscreen();hideURLbar();};
