function get_page_size()
{var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=windowWidth;}else{pageWidth=xScroll;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);return arrayPageSize;}
function get_page_scroll(){var yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;}else if(document.body){yScroll=document.body.scrollTop;}
arrayPageScroll=new Array('',yScroll)
return arrayPageScroll;}
function grayscale(image,bPlaceImage)
{var myCanvas=document.createElement("canvas");var myCanvasContext=myCanvas.getContext("2d");var imgWidth=image.width;var imgHeight=image.height;myCanvas.width=imgWidth;myCanvas.height=imgHeight;myCanvasContext.drawImage(image,0,0);var imageData=myCanvasContext.getImageData(0,0,imgWidth,imgHeight);for(j=0;j<imageData.height;i++)
{for(i=0;i<imageData.width;j++)
{var index=(i*4)*imageData.width+(j*4);var red=imageData.data[index];var green=imageData.data[index+1];var blue=imageData.data[index+2];var alpha=imageData.data[index+3];var average=(red+green+blue)/3;imageData.data[index]=average;imageData.data[index+1]=average;imageData.data[index+2]=average;imageData.data[index+3]=alpha;}}
if(bPlaceImage)
{var myDiv=document.createElement("div");myDiv.appendChild(myCanvas);image.parentNode.appendChild(myCanvas);}
return myCanvas.toDataURL();}
function set_opacity(obj,value){obj.style.opacity=value/10;obj.style.filter='alpha(opacity='+value*10+')';}
Array.prototype.in_array=function(p_val){for(var i=0,l=this.length;i<l;i++){if(this[i]==p_val){return true;}}
return false;}
Array.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,'');}
function get_args()
{var args=new Object();var query=location.search.substring(1);var pairs=query.split("&");for(var i=0;i<pairs.length;i++)
{var pos=pairs[i].indexOf('=');if(pos==-1)continue;var argname=pairs[i].substring(0,pos);var value=pairs[i].substring(pos+1);args[argname]=unescape(value);}
return args;}
function in_array(needle,haystack)
{for(var i in haystack)
{if(needle==haystack[i])return true;}
return false;}
String.prototype.trim=function()
{return this.replace(/^\s+|\s+$/,'');}
String.prototype.is_empty=function()
{if(this.trim()=='')return true;}
String.prototype.ucfirst=function()
{return this.substr(0,1).toUpperCase()+this.substr(1,this.length);}
String.prototype.strip_tags=function()
{return this.replace(/<&#91;^>&#93;*>/g,'');}
stripslashes=function(str){return(str+'').replace(/\\(.?)/g,function(s,n1){switch(n1){case'\\':return'\\';case'0':return'\0';case'':return'';default:return n1;}});}
String.prototype.str_replace=function(search,replace,count){var i=0,j=0,temp='',repl='',sl=0,fl=0,f=[].concat(search),r=[].concat(replace),s=this,ra=r instanceof Array,sa=s instanceof Array;s=[].concat(s);if(count){this.window[count]=0;}
for(i=0,sl=s.length;i<sl;i++){if(s[i]===''){continue;}
for(j=0,fl=f.length;j<fl;j++){temp=s[i]+'';repl=ra?(r[j]!==undefined?r[j]:''):r[0];s[i]=(temp).split(f[j]).join(repl);if(count&&s[i]!==temp){this.window[count]+=(temp.length-s[i].length)/f[j].length;}}}
return sa?s:s[0];}
substr=function(f_string,f_start,f_length){f_string+='';if(f_start<0){f_start+=f_string.length;}
if(f_length==undefined){f_length=f_string.length;}else if(f_length<0){f_length+=f_string.length;}else{f_length+=f_start;}
if(f_length<f_start){f_length=f_start;}
return f_string.substring(f_start,f_length);}
font_size_tofit=function(element,max)
{var fontSize=max;var ourText=element.childNodes[1];var maxHeight=element.getHeight();var maxWidth=element.getWidth();var textHeight;var textWidth;do
{ourText.style.fontSize=fontSize+'px';textHeight=ourText.offsetHeight;textWidth=ourText.getWidth();fontSize=fontSize-1;}
while((textHeight>maxHeight||textWidth>maxWidth)&&fontSize>3);}
var data_class=Class.create({get:function(varname)
{},set:function(varname,value,global)
{if(global)
{global='&global=1';}
else
{var global='';}
new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=data.set&var='+varname+'&value='+value+global,onComplete:function(response)
{return true;}});}});var data=new data_class();
var dir='';var location_store=new Array();var uri_split=new Array();var Global=Class.create({disable_apis:new Array(),uri:new Array(),args:new Object(),last_active:0,initialize:function()
{this.args=get_args();document.observe('mousemove',function()
{global.last_active=global.now();});},now:function()
{return parseInt(new Date().getTime().toString().substring(0,10));},set_uri:function(string)
{uri_split=string.split(',');},update_status:function()
{var status_obj=$('status_field');var status=status_obj.value;if(status==''||status=='What are you up to...?')
{user.alert('Please enter a status before updating.');return;}
$('status_load').style.display='block';$('status_count').style.display='none';$('status_field').disabled=true;$('status_field').className='';new Ajax.Request(dir+'/scripts/php/actions.php',{parameters:'action=api.update_status&status='+escape(status)+'&disable='+this.disable_apis.join(','),onComplete:function(response)
{if(uri_split[0]=='dashboard')
{var range=document.createRange();range.selectNode(document.body);var parsedHTML=range.createContextualFragment(response.feed.template);var feed=document.createElement('li');feed.style.display='none';feed.appendChild(parsedHTML);$('status_load').style.display='none';$('status_count').style.display='block';$('status_count').innerHTML='140';$('status_field').disabled=false;$('status_field').value='What are you up to...?';$('feeds').insertBefore(feed,$('feeds').firstChild);new Effect.BlindDown(feed);new Effect.Pulsate(feed,{pulses:5,duration:2.5});}},onError:function(response)
{$('status_load').style.display='none';$('status_count').style.display='block';$('status_count').innerHTML='140';$('status_field').disabled=false;$('status_field').value='What are you up to...?';user.alert('We were unable to update some or all of your networks. They may just be down, but the issue has been reported so we suggest that you try again later.<br />Sorry for any inconvenience caused.');}});},toggle_api:function(which,default_set)
{var new_list=new Array();var there=false;for(var i=0;i<this.disable_apis.length;i++)
{if(this.disable_apis[i]!=which)
{new_list[new_list.length]=this.disable_apis[i];}
else
{there=true;}}
if(!there)
{new_list[new_list.length]=which;$('api_icon_'+which).className='network '+which+' disabled';}
else
{$('api_icon_'+which).className='network '+which+' enabled';}
this.disable_apis=new_list;if(default_set==null)
{data.set('status_disable.'+which,((there)?0:1));}},toggle_status_updater:function(btn_obj)
{if($('you').style.display=='none')
{Effect.BlindDown('you');btn_obj.innerHTML='Hide Status Updater';global.set_session('hide_status_updater','0');}
else
{Effect.BlindUp('you');btn_obj.innerHTML='Show Status Updater';global.set_session('hide_status_updater','1');}},search_location:function(buttonObj)
{var fieldObj=buttonObj.parentNode.parentNode.childNodes[1];$('search_results').style.display='none';$('loading_search').style.display='block';$('search_results').innerHTML='';new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=location.search&q='+fieldObj.value,onComplete:function(response)
{response.results=response.response;if(response.results.length)
{for(var i=0;i<response.results.length;i++)
{var li=document.createElement('li');var title=document.createElement('div');title.innerHTML=response.results[i].title;li.appendChild(title);var address=document.createElement('span');address.innerHTML=response.results[i].streetAddress;li.appendChild(address);var set=document.createElement('a');set.className='buttonslim';set.setAttribute('href','#');set.setAttribute('onclick','global.set_location(\''+response.results[i].title+' ('+response.results[i].streetAddress+')\', \''+response.results[i].lat+'\', \''+response.results[i].lng+'\'); return false;');var set_text=document.createElement('span');set_text.innerHTML='Set Location';set.appendChild(set_text);li.appendChild(set);var clear=document.createElement('div');clear.className='clear';li.appendChild(clear);$('search_results').appendChild(li);}}
else
{}
$('search_results').style.display='block';$('loading_search').style.display='none';popup.reposition();}});},set_location:function(string,lat,long)
{new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=location.set&location='+escape(string)+'&lat='+lat+'&long='+long,onComplete:function(response)
{if(uri_split[0]=='user')
{}
else
{$('you_location').innerHTML=string;popup.close();user.alert('Your location has successfully been updated.');}}});},set_search_type:function(type,headerelem,headerinputclass)
{document.forms['search_header'].elements['search[type]'].value=type;if(uri_split[0]=='search')document.forms['search_page'].elements['search[type]'].value=type;if(headerinputclass!=undefined||headerinputclass!=false)
{document.forms['search_header'].elements['search[query]'].className=headerinputclass;}
else
{document.forms['search_header'].elements['search[query]'].className='';}
if(headerelem!=false)
{var headertypes=headerelem.parentNode.parentNode;for(var i=0;i<headertypes.childNodes.length;i++)
{headertypes.childNodes[i].className='';}
headerelem.parentNode.className='current';}
if(uri_split[0]=='search')
{switch(type)
{case'updates':if(uri_split[0]=='search')document.forms['search_page'].elements['search[query]'].value='Search Updates';break;case'people':if(uri_split[0]=='search')document.forms['search_page'].elements['search[query]'].value='Search People';break;case'places':if(uri_split[0]=='search')document.forms['search_page'].elements['search[query]'].value='Search Locations';break;case'discussions':if(uri_split[0]=='search')document.forms['search_page'].elements['search[query]'].value='Search Discussions';break;case'photos':if(uri_split[0]=='search')document.forms['search_page'].elements['search[query]'].value='Search Photos';break;}}
if(uri_split[0]=='search')
{for(var i=0;i<$('search_page').childNodes[1].childNodes[1].childNodes[1].childNodes.length;i++)
{if($('search_page').childNodes[1].childNodes[1].childNodes[1].childNodes[i].tagName=='A')
{$('search_page').childNodes[1].childNodes[1].childNodes[1].childNodes[i].className=(type==$('search_page').childNodes[1].childNodes[1].childNodes[1].childNodes[i].getAttribute('id').replace('search_type_',''))?'active':'';}}}},update_status_counter:function(field,counter)
{var limit=140;counter=$(counter);counter.innerHTML=limit-field.value.length;counter.className='counter';if((limit-field.value.length)<=50)
{counter.className='counter low';}
if((limit-field.value.length)<=0)
{counter.className='counter empty';}},set_session:function(name,value)
{new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=data.set_session&name='+name+'&value='+escape(value)});},});var global=new Global();global.last_active=global.now();
var popup_class=Class.create({initialize:function(file)
{},show:function(file,params)
{new Ajax.Request(dir+'/content/popups/'+file+'.php',{method:'post',parameters:params,onComplete:function(response)
{if(response)
{var body=document.getElementsByTagName('body')[0];var container=document.createElement('div');container.setAttribute('id','popup');container.className='popup-container';var content=document.createElement('div');content.className='popup-content';content.innerHTML=response;container.insertBefore(content,container.firstChild);var mask=document.createElement('div');mask.setAttribute('id','popup-mask');mask.className='popup-mask';body.insertBefore(mask,body.firstChild);body.insertBefore(container,body.firstChild);var size=get_page_size();var scroll=get_page_scroll();content.style.top=(size[3]/2)-(content.offsetHeight/2)+'px';content.style.left=(size[0]/2)-(content.offsetWidth/2)+'px';mask.style.height=size[1]+'px';return false;}}});return false;},close:function()
{$('popup').style.display='none';$('popup-mask').style.display='none';document.getElementsByTagName('body')[0].removeChild($('popup'));document.getElementsByTagName('body')[0].removeChild($('popup-mask'));},reposition:function()
{var size=get_page_size();var scroll=get_page_scroll();$('popup').childNodes[0].style.top=(scroll[1]+((size[3]-$('popup').childNodes[0].offsetHeight)/2)+'px');$('popup').childNodes[0].style.left=(((size[0]-$('popup').childNodes[0].offsetWidth)/2)+'px');}});var popup=new popup_class();
var switch_class=Class.create({initialize:function(){},set_on:function(which){alert(which);var switchObj=which.parentElement.parentElement;alert('1');switchObj.childNodes[1].className='on current';switchObj.childNodes[3].className='off';switchObj.childNodes[1].innerHTML='On';var link=document.createElement('a');link.setAttribute('href','#');link.setAttribute('onclick','switch_class.set_off(this); return false;');link.innerHTML='Off';switchObj.childNodes[3].appendChild(link);},set_off:function(which){var switchObj=which.parentElement.parentElement;switchObj.childNodes[3].className='off current';switchObj.childNodes[1].className='on';switchObj.childNodes[3].innerHTML='Off';var link=document.createElement('a');link.setAttribute('href','#');link.setAttribute('onclick','switch_class.set_on(this); return false;');link.innerHTML='On';switchObj.childNodes[1].appendChild(link);}});var switch_class=new switch_class();
var user_class=Class.create({initialize:function()
{},alert:function(message)
{popup.show('user_alert',{message:message});},confirm:function(message)
{return confirm(message);}});var user=new user_class();
var class_api=Class.create({initialize:function(){},post_comment:function(which,postid,buttonObj)
{var fieldObj=buttonObj.parentNode.parentNode.childNodes[0];buttonObj.disabled=true;fieldObj.disabled=true;new Ajax.Request(dir+'/scripts/php/actions.php',{parameters:'action=api.post_comment&which='+which+'&postid='+postid+'&comment='+fieldObj.value,onComplete:function(response)
{var comment=document.createElement('li');var comment_photo=document.createElement('div');comment_photo.className='photo';var comment_photo_img=document.createElement('img');comment_photo_img.setAttribute('src',response.user.photo);comment_photo.appendChild(comment_photo_img);comment.appendChild(comment_photo);var comment_user=document.createElement('div');comment_user.className='user';var comment_user_link=document.createElement('a');comment_user_link.setAttribute('href',response.user.profile);comment_user_link.setAttribute('target','_blank');comment_user_link.innerHTML=response.user.name;comment_user.appendChild(comment_user_link);comment.appendChild(comment_user);var comment_time=document.createElement('div');comment_time.className='time';comment_time.innerHTML=response.comment.time;comment.appendChild(comment_time);var comment_text=document.createElement('div');comment_text.className='text';comment_text.innerHTML=response.comment.text;comment.appendChild(comment_text);var comment_clear=document.createElement('div');comment_clear.className='clear';comment.appendChild(comment_clear);$('cl_'+postid).appendChild(comment);fieldObj.value='Write another comment...';fieldObj.disabled=false;buttonObj.disabled=false;fieldObj.select();}});},load_comments:function(which,postid)
{new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=api.load_comments&which='+which+'&postid='+postid,onComplete:function(response)
{$('cl_'+postid).innerHTML='';for(var i=0;i<response.comments.length;i++)
{var comment=document.createElement('li');var comment_photo=document.createElement('div');comment_photo.className='photo';var comment_photo_img=document.createElement('img');comment_photo_img.setAttribute('src',response.comments[i].user.photo);comment_photo.appendChild(comment_photo_img);comment.appendChild(comment_photo);var comment_user=document.createElement('div');comment_user.className='user';var comment_user_link=document.createElement('a');comment_user_link.setAttribute('href',response.comments[i].user.profile);comment_user_link.setAttribute('target','_blank');comment_user_link.innerHTML=response.comments[i].user.name;comment_user.appendChild(comment_user_link);comment.appendChild(comment_user);var comment_time=document.createElement('div');comment_time.className='time';comment_time.innerHTML=response.comments[i].time;comment.appendChild(comment_time);var comment_text=document.createElement('div');comment_text.className='text';comment_text.innerHTML=response.comments[i].text;comment.appendChild(comment_text);var comment_clear=document.createElement('div');comment_clear.className='clear';comment.appendChild(comment_clear);$('cl_'+postid).appendChild(comment);}}});}});var api=new class_api();
var icontip=Class.create({initialize:function(text,element)
{var tipstr=text.toLocaleLowerCase().replace(' ','_');if($('tip_'+tipstr))return;var tip=document.createElement('div');tip.setAttribute('id','tip_'+tipstr);tip.className='icontip';tip.style.display='none';var row=document.createElement('div');row.className='row';var row_left=document.createElement('div');row_left.className='left';row.appendChild(row_left);var middle=document.createElement('div');middle.className='text';middle.innerHTML=text;row.appendChild(middle);var row_right=document.createElement('div');row_right.className='right';row.appendChild(row_right);tip.appendChild(row);var arrow=document.createElement('div');arrow.className='arrow';tip.appendChild(arrow);document.getElementsByTagName('body')[0].insertBefore(tip,document.getElementsByTagName('body')[0].firstChild);tip.clonePosition(element,{setWidth:false,setHeight:false});tip.style.left=tip.style.left.replace('px','')-(tip.getWidth()/4)+'px';var overtip=false;tip.observe('mouseover',function()
{overtip=true;});tip.observe('mouseout',function()
{overtip=false;});element.observe('mouseout',function()
{if(overtip)return;new Effect.Move(tip,{duration:0.8,x:0,y:15,mode:'relative'});new Effect.Fade(tip,{duration:0.8,afterFinish:function(){if($('tip_'+tipstr)===false)return;document.getElementsByTagName('body')[0].removeChild(tip);}});});new Effect.Move(tip,{duration:0.8,x:0,y:-15,mode:'relative'});new Effect.Appear(tip,{duration:0.8});}});
var Animation=Class.create({initialize:function(element,frames,height,speed,hide_on_stop)
{this._element=(typeof element=='string')?$(element):element;this._frames=frames;this._height=height;this._hide_on_stop=hide_on_stop;this._speed=(speed)?speed:0.1;this._count=0;this._interval=null;this._count=0;},start:function()
{if(this._interval)return;this._interval=setInterval(this.update_position.bind(this),this._speed);this._element.style.display='block';},stop:function()
{clearInterval(this._interval);this._interval=null;if(this._hide_on_stop)this._element.style.display='none';},update_position:function()
{this._element.style.backgroundPosition='0 -'+(this._height*this._count)+'px';if(this._count==this._frames)
{this._count=0;return;}
this._count++;}});
var sending_friend_request=false;send_friend_request=function(userid,buttonObj)
{if(sending_friend_request)return;sending_friend_request=true;new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=friends.send_friend_request&userid='+userid,onComplete:function(transport)
{user.alert('A friend request has been sent to the user.');$('add_friend_button').innerHTML='Friend Request Sent';$('add_friend_button').setAttribute('onlick','return false;');sending_friend_request=false;}});}
var TextAreaResize=Class.create();TextAreaResize.prototype={initialize:function(element,options){this.element=element;this.options=Object.extend({},options||{});Event.observe(this.element,'keyup',this.onKeyUp.bindAsEventListener(this));this.onKeyUp();},onKeyUp:function(){var cols=this.element.cols;var linecount=0;$A(this.element.value.split("\n")).each(function(l){linecount+=1+Math.floor(l.length/cols);})
this.element.rows=linecount;}}
set_feed=function(apiid,netobj)
{$('feed_load').style.display='block';$('no_feeds').style.display='none';$('feeds').style.display='none';new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=api.get_feed&which='+apiid,onError:function(response)
{switch(response.error)
{case'no_feeds':$('feed_load').style.display='none';$('no_feeds').style.display='block';break;}},onComplete:function(response)
{$('feeds').innerHTML='';for(var i=0;i<response.items.length;i++)
{var li=document.createElement('li');var div_photo=document.createElement('div');div_photo.className='photo';div_photo.style.backgroundImage='url('+response.items[i].user.photo+')';if(response.which=='twitter')
{div_photo.style.width='48px';div_photo.style.height='48px';}
if(response.which=='plurk')
{div_photo.style.width='45px';div_photo.style.width='45px;';}
if(response.which=='lastfm')
{div_photo.style.width='64px;';div_photo.style.width='64px;';}
li.appendChild(div_photo);var div_main=document.createElement('div');div_main.setAttribute('class','main');var div_feed=document.createElement('feed');div_feed.className='feed';var div_name=document.createElement('div');div_name.className='name';if(response.which=='lastfm')
{div_name.innerHTML='<a href="'+response.items[i].user.profile+'" target="_blank">'+response.items[i].user.name+'</a>';}
else
{if(response.items[i].to)
{div_name.innerHTML='<a href="'+response.items[i].user.profile+'" target="_blank">'+response.items[i].user.name+'</a> > <a href="'+response.items[i].to.profile+'" target="_blank">'+response.items[i].to.name+'</a>';}
else
{div_name.innerHTML='<a href="'+response.items[i].user.profile+'" target="_blank">'+response.items[i].user.name+'</a>'+((response.items[i].hide_said!='1')?' said:':'');}}
div_feed.appendChild(div_name);var div_text=document.createElement('div');div_text.className='text';div_text.innerHTML=response.items[i].text;div_feed.appendChild(div_text);div_main.appendChild(div_feed);var div_info=document.createElement('div');div_info.className='info';var div_time=document.createElement('div');div_time.className='time';div_time.innerHTML=response.items[i].date;div_info.appendChild(div_time);if(response.which=='facebook')
{var div_comment=document.createElement('div');div_comment.className='comment';var div_comment_link=document.createElement('a');div_comment_link.setAttribute('href','#');div_comment_link.setAttribute('onclick','toggle_post_comment(\''+response.items[i].postid+'\'); return false;');div_comment_link.innerHTML='Comment';div_comment.appendChild(div_comment_link);div_info.appendChild(div_comment);var div_like=document.createElement('div');div_like.className='like';var div_like_link=document.createElement('a');div_like_link.setAttribute('href','#');div_like_link.setAttribute('onclick','comment_like(\''+response.items[i].postid+'\'); return false;');div_like_link.innerHTML='Like';div_like.appendChild(div_like_link);div_info.appendChild(div_like);}
else if(response.which=='twitter')
{var div_reply=document.createElement('div');div_reply.className='like';var div_reply_link=document.createElement('a');div_reply_link.setAttribute('href','#');div_reply_link.setAttribute('onclick','popup.show(\'twitter_popup\', {type: \'reply\', postid:\''+response.items[i].postid+'\', username:\''+response.items[i].user.username+'\'}); return false;');div_reply_link.innerHTML='Reply';div_reply.appendChild(div_reply_link);div_info.appendChild(div_reply);var div_repost=document.createElement('div');div_repost.className='like';var div_repost_link=document.createElement('a');div_repost_link.setAttribute('href','#');div_repost_link.setAttribute('onclick','popup.show(\'twitter_popup\', {type:\'repost\', username: \''+response.items[i].user.username+'\', text:\''+escape(response.items[i].text)+'\'}); return false;');div_repost_link.innerHTML='Repost';div_repost.appendChild(div_repost_link);div_info.appendChild(div_repost);}
div_main.appendChild(div_info);var div_clear=document.createElement('div');div_clear.className='clear';div_main.appendChild(div_clear);var post_comments=document.createElement('ul');post_comments.className='comments';post_comments.setAttribute('id','cl_'+response.items[i].postid);if(apiid=='facebook')
{if(response.items[i].comments.comment_list)
{if(response.items[i].comments.comment_list.length)
{for(var j=0;j<response.items[i].comments.comment_list.length;j++)
{console.log(response.items[i].comments.comment_list[j]);var comment=document.createElement('li');var comment_photo=document.createElement('div');comment_photo.className='photo';var comment_photo_img=document.createElement('img');comment_photo_img.setAttribute('src',response.items[i].comments.comment_list[j].user.photo);comment_photo.appendChild(comment_photo_img);comment.appendChild(comment_photo);var comment_user=document.createElement('div');comment_user.className='user';var comment_user_link=document.createElement('a');comment_user_link.setAttribute('href',response.items[i].comments.comment_list[j].user.profile);comment_user_link.setAttribute('target','_blank');comment_user_link.innerHTML=response.items[i].comments.comment_list[j].user.name;comment_user.appendChild(comment_user_link);comment.appendChild(comment_user);var comment_time=document.createElement('div');comment_time.className='time';comment_time.innerHTML=response.items[i].comments.comment_list[j].time;comment.appendChild(comment_time);var comment_text=document.createElement('div');comment_text.className='text';comment_text.innerHTML=response.items[i].comments.comment_list[j].text;comment.appendChild(comment_text);var comment_clear=document.createElement('div');comment_clear.className='clear';comment.appendChild(comment_clear);post_comments.appendChild(comment);if(response.items[i].comments.comment_list.length<response.items[i].comments.count&&j==0)
{var comment_load=document.createElement('li');comment_load.className='load';var comment_load_link=document.createElement('a');comment_load_link.setAttribute('href','#');comment_load_link.setAttribute('onclick','api.load_comments(\''+apiid+'\', \''+response.items[i].postid+'\'); return false;');comment_load_link.innerHTML='Show '+(response.items[i].comments.count-response.items[i].comments.comment_list.length)+' more comments...';comment_load.appendChild(comment_load_link);post_comments.appendChild(comment_load);}}}}
div_main.appendChild(post_comments);if(response.items[i].comments.can_post)
{var comment_post=document.createElement('div');comment_post.className='comment_post';comment_post.setAttribute('id','cp_'+response.items[i].postid);comment_post.style.display=(response.items[i].comments.length>0)?'block':'none';var comment_post_field=document.createElement('textarea');comment_post_field.setAttribute('onfocus','if(this.value == \'Post a comment...\') { this.value=\'\'; } else { this.select(); }');comment_post_field.rows=1;comment_post_field.cols=89;comment_post_field.value='Post a comment...';new TextAreaResize(comment_post_field);comment_post.appendChild(comment_post_field);var comment_post_button=document.createElement('div');comment_post_button.className='button';comment_post_button.innerHTML='<a onclick="api.post_comment(\''+apiid+'\', \''+response.items[i].postid+'\', this); return false;" class="buttonslim" style="background-color: #F3F3F3;"><span style="background-color: #F3F3F3;">Share!</span></a>';comment_post.appendChild(comment_post_button);var comment_post_clear=document.createElement('div');comment_post_clear.className='clear';comment_post.appendChild(comment_post_clear);div_main.appendChild(comment_post);}}
li.appendChild(div_main);$('feeds').appendChild(li);}
$('feed_load').style.display='none';$('feeds').style.display='block';var netoblist=netobj.parentNode.parentNode;for(var i=0;i<netoblist.childNodes.length;i++)
{if(netoblist.childNodes[i].tagName=='LI'&&netoblist.childNodes[i].className!='bottom')
{netoblist.childNodes[i].className=netoblist.childNodes[i].className.replace('current','');}}
netobj.parentNode.addClassName('current');}});}
toggle_post_comment=function(postid)
{$('cp_'+postid).style.display=($('cp_'+postid).style.display=='block')?'none':'block';if($('cp_'+postid).childNodes[0].tagName=='TEXTAREA')
{$('cp_'+postid).childNodes[0].focus();$('cp_'+postid).childNodes[0].setAttribute('onblur','if(this.value==\'\') { this.parentNode.style.display = \'none\'; }');}
else
{$('cp_'+postid).childNodes[1].focus();$('cp_'+postid).childNodes[1].setAttribute('onblur','if(this.value==\'\') { this.parentNode.style.display = \'none\'; }');}}
post_tweet=function(buttonObj,replyid)
{var fieldObj=buttonObj.parentNode.parentNode.childNodes[5].childNodes[0];fieldObj.disabled=true;if(replyid!=undefined)
{params='action=api.post_tweet&text='+escape(fieldObj.value)+'&postid='+replyid;}
else
{params='action=api.post_tweet&text='+escape(fieldObj.value);}
new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:params,onComplete:function(response)
{var li=document.createElement('li');var div_photo=document.createElement('div');div_photo.className='photo';var div_photo_img=document.createElement('img');div_photo_img.setAttribute('src',response.post.user.photo);div_photo.appendChild(div_photo_img);li.appendChild(div_photo);var div_main=document.createElement('div');div_main.setAttribute('class','main');var div_feed=document.createElement('feed');div_feed.className='feed';var div_name=document.createElement('div');div_name.className='name';div_name.innerHTML='<a href="'+response.post.user.profile+'" target="_blank">'+response.post.user.name+'</a>'+((response.post.hide_said!='1')?' said:':'');div_feed.appendChild(div_name);var div_text=document.createElement('div');div_text.className='text';div_text.innerHTML=response.post.text;div_feed.appendChild(div_text);div_main.appendChild(div_feed);var div_info=document.createElement('div');div_info.className='info';var div_time=document.createElement('div');div_time.className='time';div_time.innerHTML=response.post.date;div_info.appendChild(div_time);var div_reply=document.createElement('div');div_reply.className='like';var div_reply_link=document.createElement('a');div_reply_link.setAttribute('href','#');div_reply_link.setAttribute('onclick','popup.show(\'twitter_popup\', {type: \'reply\', postid:\''+response.post.postid+'\', username:\''+response.post.user.username+'\'}); return false;');div_reply_link.innerHTML='Reply';div_reply.appendChild(div_reply_link);div_info.appendChild(div_reply);var div_repost=document.createElement('div');div_repost.className='like';var div_repost_link=document.createElement('a');div_repost_link.setAttribute('href','#');div_repost_link.setAttribute('onclick','popup.show(\'twitter_popup\', {type:\'repost\', username: \''+response.post.user.username+'\', text:\''+escape(response.post.text)+'\'}); return false;');div_repost_link.innerHTML='Repost';div_repost.appendChild(div_repost_link);div_info.appendChild(div_repost);div_main.appendChild(div_info);var div_clear=document.createElement('div');div_clear.className='clear';div_main.appendChild(div_clear);li.appendChild(div_main);popup.close();$('feeds').insertBefore(li,$('feeds').firstChild);new Effect.BlindDown(li);new Effect.Pulsate(li,{pulses:5,duration:2.5});}});}
post_comment=function(feedid,buttonObj)
{var fieldObj=buttonObj.parentNode.parentNode.childNodes[1];if(fieldObj.value==''||fieldObj.value=='Write another comment...')
{user.alert('Please enter a comment before submitting.');return;}
fieldObj.disabled=true;new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=feed.post_comment&feedid='+feedid+'&comment='+escape(fieldObj.value),onComplete:function(response)
{var comment=document.createElement('li');var comment_photo=document.createElement('div');comment_photo.className='photo';var comment_photo_img=document.createElement('img');comment_photo_img.setAttribute('src',response.user.photo);comment_photo.appendChild(comment_photo_img);comment.appendChild(comment_photo);var comment_user=document.createElement('div');comment_user.className='user';var comment_user_link=document.createElement('a');comment_user_link.setAttribute('href',response.user.profile);comment_user_link.setAttribute('target','_blank');comment_user_link.innerHTML=response.user.name;comment_user.appendChild(comment_user_link);comment.appendChild(comment_user);var comment_time=document.createElement('div');comment_time.className='time';comment_time.innerHTML=response.comment.time;comment.appendChild(comment_time);var comment_text=document.createElement('div');comment_text.className='text';comment_text.innerHTML=response.comment.text;comment.appendChild(comment_text);var comment_clear=document.createElement('div');comment_clear.className='clear';comment.appendChild(comment_clear);$('cl_'+response.feedid).appendChild(comment);fieldObj.value='Write another comment...';fieldObj.disabled=false;buttonObj.disabled=false;fieldObj.select();}});}
load_comments=function(feedid,loadObj)
{loadObj.className='loading';new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=feed.load_comments&feedid='+feedid,onComplete:function(response)
{$('cl_'+response.feedid).innerHTML='';for(var i=0;i<response.comments.length;i++)
{var comment=document.createElement('li');var comment_photo=document.createElement('div');comment_photo.className='photo';var comment_photo_img=document.createElement('img');comment_photo_img.setAttribute('src',response.comments[i].user.photo);comment_photo.appendChild(comment_photo_img);comment.appendChild(comment_photo);var comment_user=document.createElement('div');comment_user.className='user';var comment_user_link=document.createElement('a');comment_user_link.setAttribute('href',response.comments[i].user.profile);comment_user_link.setAttribute('target','_blank');comment_user_link.innerHTML=response.comments[i].user.name;comment_user.appendChild(comment_user_link);comment.appendChild(comment_user);var comment_time=document.createElement('div');comment_time.className='time';comment_time.innerHTML=response.comments[i].time;comment.appendChild(comment_time);var comment_text=document.createElement('div');comment_text.className='text';comment_text.innerHTML=response.comments[i].text;comment.appendChild(comment_text);var comment_clear=document.createElement('div');comment_clear.className='clear';comment.appendChild(comment_clear);$('cl_'+response.feedid).appendChild(comment);}}});}
delete_status=function(feedid)
{if(user.confirm('Are you sure you want to delete this feed? It can not be retrieved. \nN.B. Your status will not be deleted on external networks.'))
{new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=feed.delete_status&feedid='+feedid,onComplete:function(response)
{new Effect.Fade('fd_'+response.feedid,{afterFinish:function()
{$('feeds').removeChild($('fd_'+response.feedid));}});}});}}
var folder_in_manage=false;var friends;var to_friend=[];var over_userlist=false;document.observe('dom:loaded',function()
{load_friends();});update_check=function(selectObj)
{for(var i=0;i<$('mail').childNodes.length;i++)
{if($('mail').childNodes[i].tagName!='LI')continue;$('mail').childNodes[i].childNodes[1].childNodes[0].checked=false;}
switch(selectObj.options[selectObj.selectedIndex].value)
{case'all':for(var i=0;i<$('mail').childNodes.length;i++)
{if($('mail').childNodes[i].tagName!='LI')continue;$('mail').childNodes[i].childNodes[1].childNodes[0].checked=true;}
break;case'none':break;case'read':for(var i=0;i<$('mail').childNodes.length;i++)
{if($('mail').childNodes[i].tagName!='LI')continue;var class_split=$('mail').childNodes[i].className.split(' ');if(class_split.in_array('read')==false)continue;$('mail').childNodes[i].childNodes[1].childNodes[0].checked=true;}
break;case'unread':for(var i=0;i<$('mail').childNodes.length;i++)
{if($('mail').childNodes[i].tagName!='LI')continue;var class_split=$('mail').childNodes[i].className.split(' ');if(class_split.in_array('read')==true)continue;$('mail').childNodes[i].childNodes[1].childNodes[0].checked=true;}
break;}}
new_folder=function()
{var li=document.createElement('li');var field=document.createElement('input');field.setAttribute('onblur','cancel_folder(this);');field.setAttribute('onkeyup','create_folder(event, this);');li.appendChild(field);$('folders').appendChild(li);field.focus();}
cancel_folder=function(fieldObj)
{$('folders').removeChild(fieldObj.parentNode);}
create_folder=function(event,fieldObj)
{if(event.keyCode==13)
{var title=fieldObj.value;var folderObj=fieldObj.parentNode;var loading=document.createElement('div');loading.className='loading';folderObj.appendChild(loading);new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=mailbox.create_folder&title='+title,onComplete:function(response)
{var link=document.createElement('a');link.setAttribute('href',response.folder.link);link.innerHTML=response.folder.title;folderObj.innerHTML='';folderObj.setAttribute('folderid',response.folder.folderid);folderObj.appendChild(link);if(folder_in_manage)
{var rename_icon=document.createElement('a');rename_icon.setAttribute('href','#');rename_icon.setAttribute('onclick','rename_folder(this.parentNode); return false;');rename_icon.className='rename';folderObj.appendChild(rename_icon);var delete_icon=document.createElement('a');delete_icon.setAttribute('href','#');delete_icon.setAttribute('onclick','delete_folder(this.parentNode); return false;');delete_icon.className='delete';folderObj.appendChild(delete_icon);}}});}}
manage_folders=function(manageObj)
{if(folder_in_manage)return;folder_in_manage=true;var count=0;var folders=$('folders').cleanWhitespace();for(var i=0;i<$('folders').childNodes.length;i++)
{if(count>0&&count<($('folders').childNodes.length-1))
{var rename_icon=document.createElement('a');rename_icon.setAttribute('href','#');rename_icon.setAttribute('onclick','rename_folder(this.parentNode); return false;');rename_icon.className='rename';$('folders').childNodes[i].appendChild(rename_icon);var delete_icon=document.createElement('a');delete_icon.setAttribute('href','#');delete_icon.setAttribute('onclick','delete_folder(this.parentNode); return false;');delete_icon.className='delete';$('folders').childNodes[i].appendChild(delete_icon);}
count++;}
manageObj.innerHTML='Done';manageObj.setAttribute('onclick','finish_edit_folders(this); return false;');}
var name_store='';rename_folder=function(folderObj)
{name_store=folderObj.childNodes[0].innerHTML;folderObj.childNodes[0].style.display='none';folderObj.childNodes[1].style.display='none';folderObj.childNodes[2].style.display='none';var field=document.createElement('input');field.setAttribute('value',name_store);field.setAttribute('onkeyup','update_folder(event, this, false);');field.setAttribute('onblur','update_folder(event, this, true);');folderObj.appendChild(field);field.focus();field.select();}
update_folder=function(event,fieldObj,blur)
{if(event.keyCode==13||blur)
{var title=fieldObj.value;var folderObj=fieldObj.parentNode;if(title==name_store)
{cancel_rename(fieldObj);return false;}
var loading=document.createElement('div');loading.className='loading';folderObj.appendChild(loading);new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=mailbox.rename_folder&title='+title+'&folderid='+folderObj.getAttribute('folderid'),onComplete:function(response)
{folderObj.removeChild(folderObj.childNodes[3]);folderObj.childNodes[0].innerHTML=response.folder.title;folderObj.childNodes[0].style.display='block';folderObj.childNodes[1].style.display='block';folderObj.childNodes[2].style.display='block';}});}}
cancel_rename=function(fieldObj)
{var folderObj=fieldObj.parentNode;folderObj.removeChild(fieldObj);folderObj.childNodes[0].style.display='block';folderObj.childNodes[1].style.display='block';folderObj.childNodes[2].style.display='block';}
delete_folder=function(folderObj)
{if(user.confirm('Are you sure you wish to delete this folder? It can not be retrieved and all of its contents will be moved back to your Inbox'))
{new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=mailbox.delete_folder&folderid='+folderObj.getAttribute('folderid'),onComplete:function(response)
{folderObj.parentNode.removeChild(folderObj);}});}}
finish_edit_folders=function(manageObj)
{if(!folder_in_manage)return;folder_in_manage=false;var count=0;for(var i=0;i<$('folders').childNodes.length;i++)
{if($('folders').childNodes[i].tagName!='LI')continue;if(count>2)
{$('folders').childNodes[i].removeChild($('folders').childNodes[i].childNodes[1]);$('folders').childNodes[i].removeChild($('folders').childNodes[i].childNodes[1]);}
count++;}
manageObj.innerHTML='Manage Folders';manageObj.setAttribute('onclick','manage_folders(this); return false;');}
delete_mail=function()
{var ids=[];for(var i=0;i<$('mail').childNodes.length;i++)
{if($('mail').childNodes[i].tagName!='LI')continue;if($('mail').childNodes[i].childNodes[1].childNodes[1].checked)
{ids.push($('mail').childNodes[i].childNodes[1].childNodes[1].getAttribute('value'));}}
if(ids.length==0)
{user.alert('Please select at least 1 mail item.');return;}
if(user.confirm('Are you sure you wish to delete these mail items? All replies will also be deleted and neither can be retrieved.'))
{new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=mailbox.delete_mail&ids='+ids.join(','),onComplete:function(response)
{for(var i=0;i<response.ids.length;i++)
{new Effect.Fade('m_'+response.ids[i],{afterFinish:function(effect)
{$('mail').removeChild(effect.element);}});}}});}}
mark_mail_unread=function(mailid)
{if(mailid!=undefined)
{var ids=[];ids[0]=mailid;$('m_'+mailid).childNodes[1].childNodes[3].className='mark unread';$('m_'+mailid).className='';}
else
{var ids=[];for(var i=0;i<$('mail').childNodes.length;i++)
{if($('mail').childNodes[i].tagName!='LI')continue;if($('mail').childNodes[i].childNodes[1].childNodes[1].checked)
{ids.push($('mail').childNodes[i].childNodes[1].childNodes[1].getAttribute('value'));$('m_'+$('mail').childNodes[i].childNodes[1].childNodes[1].getAttribute('value')).childNodes[1].childNodes[3].className='mark unread';$('m_'+$('mail').childNodes[i].childNodes[1].childNodes[1].getAttribute('value')).className='';}}}
if(ids.length==0)
{user.alert('Please select at least 1 mail item.');return;}
new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=mailbox.mark_unread&ids='+ids.join(','),onComplete:function(response)
{for(var i=0;i<response.ids.length;i++)
{$('m_'+response.ids).childNodes[1].childNodes[3].className='mark unread';}}});}
mark_mail_read=function(mailid)
{if(mailid!=undefined)
{var ids=[];ids[0]=mailid;$('m_'+mailid).childNodes[1].childNodes[3].className='mark read';$('m_'+mailid).className='read';}
else
{var ids=[];for(var i=0;i<$('mail').childNodes.length;i++)
{if($('mail').childNodes[i].tagName!='LI')continue;if($('mail').childNodes[i].childNodes[1].childNodes[1].checked)
{ids.push($('mail').childNodes[i].childNodes[1].childNodes[0].getAttribute('value'));$('m_'+$('mail').childNodes[i].childNodes[1].childNodes[0].getAttribute('value')).childNodes[1].childNodes[3].className='mark read';$('m_'+$('mail').childNodes[i].childNodes[1].childNodes[0].getAttribute('value')).className='read';}}}
if(ids.length==0)
{user.alert('Please select at least 1 mail item.');return;}
new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=mailbox.mark_read&ids='+ids.join(','),onComplete:function(response)
{for(var i=0;i<response.ids.length;i++)
{$('m_'+response.ids).childNodes[1].childNodes[3].className='mark read';}}});}
move_mail=function()
{var ids=[];for(var i=0;i<$('mail').childNodes.length;i++)
{if($('mail').childNodes[i].tagName!='LI')continue;if($('mail').childNodes[i].childNodes[1].childNodes[1].checked)
{ids.push($('mail').childNodes[i].childNodes[1].childNodes[0].getAttribute('value'));$('m_'+$('mail').childNodes[i].childNodes[1].childNodes[0].getAttribute('value')).childNodes[1].childNodes[3].className='mark read';$('m_'+$('mail').childNodes[i].childNodes[1].childNodes[0].getAttribute('value')).className='read';}}
popup.show('mail_set_folder',{mailids:ids});}
load_friends=function()
{new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=friends.get',onComplete:function(response)
{friends=response.friends;}});}
send_message_search_to=function(fieldObj)
{var results=[];var user_list=fieldObj.parentNode.parentNode.childNodes[7];user_list.innerHTML='';for(var i=0;i<friends.length;i++)
{if(friends[i].first_name.toLowerCase().indexOf(fieldObj.value.toLowerCase())>=0||friends[i].second_name.toLowerCase().indexOf(fieldObj.value.toLowerCase())>=0||friends[i].username.toLowerCase().indexOf(fieldObj.value.toLowerCase())>=0)
{results.push(friends[i]);}}
if(results.length)
{for(var i=0;i<results.length;i++)
{var li=document.createElement('li');var link=document.createElement('a');link.setAttribute('href','#');link.setAttribute('onclick','add_user(\''+results[i].userid+'\', \''+results[i].first_name+' '+results[i].second_name+'\'); return false;');link.innerHTML=results[i].first_name+' '+results[i].second_name;li.appendChild(link);user_list.appendChild(li);}
user_list.style.display='block';fieldObj.focus();user_list.onmouseover=function()
{over_userlist=true;}
user_list.onmouseout=function()
{over_userlist=false;}
fieldObj.onblur=function()
{if(over_userlist)return;user_list.style.display='none';}}}
document.observe('dom:loaded',function()
{$('to_field').onblur=function()
{$('user_list').style.display='none';$('user_list').value='';}});add_user=function(userid,name)
{to_friend.push(userid);var li=document.createElement('li');var namee=document.createElement('span');namee.innerHTML=name;li.appendChild(namee);var remove=document.createElement('a');remove.setAttribute('href','#');remove.setAttribute('onclick','remove_message_user(this, \''+userid+'\'); return false;');li.appendChild(remove);$('to_list').appendChild(li);$('to_list').style.display='block';update_user_field();$('to_field').value='';$('to_field').focus();$('user_list').style.display='none';$('to_list').onclick=function()
{$('to_field').focus();}}
remove_message_user=function(removeObj,userid)
{var new_to_friend=[];for(var i=0;i<to_friend.length;i++)
{if(to_friend[i].userid!=userid)
{new_to_friend.push(to_friend[i].userid);}}
to_friend=new_to_friend;removeObj.parentNode.parentNode.removeChild(removeObj.parentNode);update_user_field();}
update_user_field=function()
{var row_height=0;var row_width=0;var rows=0;for(var i=0;i<$('to_list').childNodes.length;i++)
{row_width+=$('to_list').childNodes[i].offsetWidth+5;if(row_width>460)
{rows++;row_width=$('to_list').childNodes[i].offsetWidth+5;}}
$('to_field').style.paddingTop=((rows*25)+2)+'px';$('to_field').style.paddingLeft=(row_width+2)+'px';$('to_field').style.width=((460-row_width)+9)+'px';}
process_send_message=function()
{var form=document.forms['send_message'];var errors=[];if(to_friend.length==0)
{errors.push('Please add at least one recipient.');}
if(form.message.value=='')
{errors.push('Please add a message to send.');}
if(errors.length)
{user.alert('The following errors occurred:\n'+errors.join('\n')+'Please fix before continuing.');}
else
{new Ajax.Request(dir+'/scripts/php/actions.php',{method:'post',parameters:'action=mailbox.send&to='+to_friend.join(',')+'&subject='+form.subject.value+'&message='+form.message.value,onComplete:function(response)
{if(response.status=='ok')
{var popup_message=$('send_message').cleanWhitespace();popup_message.childNodes[1].style.display='none';popup_message.childNodes[2].style.display='block';popup.reposition();}}});}}
var Tooltip=Class.create({initialize:function(element,content,options)
{element=$(element);if(options==undefined)options={direction:'top'};var box=document.createElement('div');box.setAttribute('id','tooltip_'+element.getAttribute('id'));box.className='tooltip';box.style.position='absolute';var box_arrow=document.createElement('div');box_arrow.className='arrow '+options.direction;box.appendChild(box_arrow);var box_close=document.createElement('a');box_close.className='close';box_close.setAttribute('href','#');box_close.setAttribute('onclick','return false;');box_close.onmouseup=function()
{data.set('tooltip_mark.'+this.parentNode.getAttribute('id').replace('tooltip_',''),true);new Effect.Fade(this.parentNode);}
box.appendChild(box_close);var box_content=document.createElement('span');box_content.innerHTML=content;box.appendChild(box_content);switch(options.direction)
{case'top':box.style.top=(element.offsetTop+element.offsetHeight+21)+'px';box.style.left=(element.offsetLeft-(element.offsetWidth/4))+'px';break;case'left':break;case'right':break;case'bottom':break;}
document.getElementsByTagName('body')[0].appendChild(box);},});