/* file=class_base.js */

var SocialEngineAPI={version:'0.1.0alpha'};SocialEngineAPI.Base=new Class({initialize:function()
{this.version=SocialEngineAPI.version;},RegisterModule:function(moduleObject)
{moduleObject.Base=this;}});
/* file=class_core.js */

SocialEngineAPI.Core=new Class({Base:{},settings:{},plugins:{},options:{ajaxURL:'js_api.php'},initialize:function()
{},ImportSettings:function(settings)
{this.settings=settings;},ImportPlugins:function(plugins)
{this.plugins=plugins;}});
/* file=class_language.js */

if(typeof(SocialEngineAPI)=="undefined")
var SocialEngineAPI={};SocialEngineAPI.Language=new Class({Base:{},initialize:function()
{this.languageVariables=new Hash();},Translate:function(id)
{var rawValue=this.languageVariables.get(id)||'Missing Language Variable #'+id;return rawValue;},TranslateFormatted:function(id,params)
{var rawValue=this.languageVariables.get(id)||'Missing Language Variable #'+id;params.unshift(rawValue);var formattedValue=sprintf.run(params);return formattedValue;},Import:function(languageVariableObject)
{if($type(languageVariableObject)=="object")
this.languageVariables.extend(languageVariableObject);}});var SocialEngineLanguage=SocialEngineAPI.Language;
/* file=class_url.js */

SocialEngineAPI.URL=new Class({Base:{},url_base:null,url_host:null,url_info:{},initialize:function()
{},url_create:function(name,user,id1,id2,id3)
{var url_template=(SocialEngine.Core.settings.setting_url?this.url_info[name].url_subdirectory:this.url_info[name].url_regular);if(!url_template)return false;url_template=url_template.replace('$user',user);url_template=url_template.replace('$id1',id1);url_template=url_template.replace('$id2',id2);url_template=url_template.replace('$id3',id3);return this.url_base+url_template;},url_userdir:function(user_id)
{return'uploads_user/'+(user_id+999-((user_id-1)%1000)).toString()+'/'+user_id+'/';},ImportURLBase:function(url_base,url_host)
{this.url_base=url_base;this.url_host=url_host;},ImportURLInfo:function(url_info)
{this.url_info=url_info;}});
/* file=class_comments.js */

SocialEngineAPI.Comments=new Class({Implements:[Options],Base:{},page:1,total:0,range:5,changed:false,isEditing:false,options:{'ajaxURL':'misc_js.php','ajaxMethod':'post','ajaxSecure':false,'canComment':false,'commentHTML':false,'commentCode':false,'originalHeight':75,'type':false,'typeName':false,'typeIdentifier':false,'typeID':false,'paginate':false,'cpp':false,'commentLinks':{'reply':false,'walltowall':false},'object_owner':false,'object_owner_id':false,'typeTab':false,'typeCol':false,'typeTabParent':false,'typeColParent':false,'typeChild':false,'ownerImage':'./images/no_avatar_s.jpg','ownerImageAlt':'No Avatar'},initialize:function(options){this.setOptions(options);if(this.options.initialTotal)
this.total=this.options.initialTotal;var bind=this;window.addEvent('domready',function(){bind.showPostComment();bind.options.originalHeight=textarea_autogrow('comment_body');bind.getComments(1);});},showPostComment:function(){var innerHTML="";innerHTML+="<div class='contentBox'>"
+"<div class='boxHeader2' style='margin-bottom:1px'>"
+"<div class='headerRight'><a class='link2h icon commentLink'>"
+"<span id='"+this.options.type+'_'
+this.options.typeID+'_totalcomments'+"'>"
+this.total+" comments"+"</span></a></div>"
+"<h2 id=\"comments\">"
+this.Base.Language.Translate(854)
+"</h2></div>"
if(this.options.canComment){innerHTML+="<div class='shadowBox commentHeader'>"
+"<form action='misc_js.php' method='post' target='ajaxframe'>"
+"<div class='avatar left'>"
+"<img alt='"
+this.options.ownerImageAlt
+"' src='"
+this.options.ownerImage
+"'/>"
+"</div>"
+"<div class='commentMessage left'>"
+"<textarea name='comment_body' id='comment_body' class='formElement field mbm-0'>"
+this.Base.Language.Translate(829)+"</textarea>";if(this.options.commentHTML)
innerHTML+="<div>"
+"<span class='lgray'>"
+this.Base.Language.TranslateFormatted(1034,[this.options.commentHTML])
+"</span>"+"</div>";if(this.options.commentCode)
innerHTML+="<div style='margin-top: 5px;'>"
+"<a href='javascript:void(0);' onClick=\"this.blur();$('secure_image').src=$('secure_image').src+'?'+(new Date()).getTime();\">"
+"<img src='./images/secure.php' id='secure_image' border='0' height='20' width='67' class='signup_code'>"
+"</a>"
+" <input type='text' name='comment_secure' id='comment_secure' class='text' size='6' maxlength='10' /> "
+"<img src='./images/icons/tip.gif' border='0' class='Tips1' style='vertical-align: middle;' title='"
+this.Base.Language.Translate(856)+"' />"
+"</div>";innerHTML+="</div>";innerHTML+="<div class='commentSubmit'>"
+"<input type='submit' id='comment_submit' class='mbButton mbw-80' value='Send'>"
+"<input type='hidden' name='task' value='comment_post'>"
+"<input type='hidden' name='type' value='"
+this.options.type+"'>"
+"<input type='hidden' name='iden' value='"
+this.options.typeIdentifier+"'>"
+"<input type='hidden' name='value' value='"
+this.options.typeID+"'>";if(this.options.object_owner&&this.options.object_owner_id){innerHTML+='<input type="hidden" name="object_owner" value="'
+this.options.object_owner
+'">'
+'<input type="hidden" name="object_owner_id" value="'
+this.options.object_owner_id+'">';}else{innerHTML+='<input type="hidden" name="user" value="'+this.Base.Owner.user_info.user_username+'">';}
if(this.options.typeTab)
innerHTML+="<input type='hidden' name='tab' value='"
+this.options.typeTab+"'>";if(this.options.typeCol)
innerHTML+="<input type='hidden' name='col' value='"
+this.options.typeCol+"'>";if(this.options.typeTabParent)
innerHTML+='<input type="hidden" name="tab_parent" value="'+this.options.typeTabParent+'">';if(this.options.typeColParent)
innerHTML+='<input type="hidden" name="col_parent" value="'+this.options.typeColParent+'">';if(this.options.typeChild)
innerHTML+='<input type="hidden" name="child" value="1">';innerHTML+="</div>"+"<div class='clear'></div>";innerHTML+="</form><div id='comment_error' style='color: #FF0000; display: none;'></div>"+"</div>";}else{if(this.Base.Viewer.user_exists){innerHTML+='<div class="noticeBox"><span>The owner doesn\'t allow comments on this '+this.options.typeName+'.</span></div>'
+'<div class="clear"></div>';}else{innerHTML+='<div class="noticeBox"><span>If you would like to comment, please <a href="/sign-in?return_url='+escape(location.href)+'">Sign in</a> or <a href="/sign-up">Sign up</a> for free</span></div>'
+'<div class="clear"></div>';}}
innerHTML+='<div style="display: none;" id="confirmcommentdelete">'
+'<div class="popupContent">'
+this.Base.Language.Translate(1026)
+'</div>'
+'<div class="fixedSubmit">'
+'<form action="misc_js.php" method="post" target="ajaxframe">'
+'<input type="submit" class="mbButton" value="'
+this.Base.Language.Translate(175)
+'" onClick="parent.TB_remove();"> '
+'<input type="button" class="mbButton mbButtonWhite" value="'
+this.Base.Language.Translate(39)
+'" onClick="parent.TB_remove();">'
+'<input type="hidden" name="task" value="comment_delete">'
+'<input type="hidden" name="comment_id" id="del_comment_id" value="0">'
+'<input type="hidden" name="type" value="'
+this.options.type
+'">'
+'<input type="hidden" name="iden" value="'
+this.options.typeIdentifier
+'">'
+'<input type="hidden" name="value" value="'
+this.options.typeID+'">';if(this.options.object_owner&&this.options.object_owner_id){innerHTML+='<input type="hidden" name="object_owner" value="'
+this.options.object_owner
+'">'
+'<input type="hidden" name="object_owner_id" value="'
+this.options.object_owner_id+'">';}else{innerHTML+='<input type="hidden" name="user" value="'+this.Base.Owner.user_info.user_username+'">';}
if(this.options.typeTab)
innerHTML+='<input type="hidden" name="tab" value="'+this.options.typeTab+'">';if(this.options.typeCol)
innerHTML+='<input type="hidden" name="col" value="'+this.options.typeCol+'">';if(this.options.typeTabParent)
innerHTML+='<input type="hidden" name="tab_parent" value="'+this.options.typeTabParent+'">';if(this.options.typeColParent)
innerHTML+='<input type="hidden" name="col_parent" value="'+this.options.typeColParent+'">';if(this.options.typeChild)
innerHTML+='<input type="hidden" name="child" value="1">';innerHTML+='</form>'+'</div></div>';var postCommentContainerElement=$(this.options.type+'_'
+this.options.typeID+'_postcomment');if(postCommentContainerElement)postCommentContainerElement.innerHTML=innerHTML;var bind=this;if(this.options.canComment&&postCommentContainerElement){postCommentContainerElement.getElement('form').addEvent('submit',function(){bind.checkText();});postCommentContainerElement.getElement('textarea').addEvent('focus',function(){bind.removeText(this);});postCommentContainerElement.getElement('textarea').addEvent('blur',function(){bind.addText(this);});}},doCommentPost:function(e){var event=new Event(e);var postData={'task':'comment_post','type':this.options.type,'iden':this.options.typeIdentifier,'value':this.options.typeID,'tab':this.options.typeTab,'col':this.options.typeCol};if(this.options.typeTabParent)
postData.tab_parent=this.options.typeTabParent;if(this.options.typeColParent)
postData.col_parent=this.options.typeColParent;if(this.options.typeChild)
postData.child=this.options.typeChild;if(this.options.object_owner&&this.options.object_owner_id){postData.object_owner=this.options.object_owner;postData.object_owner_id=this.options.object_owner_id;}else{postData.user=this.Base.Owner.user_info.user_username;}
if($type(document.comment_post_form.comment_body))
postData.comment_body=document.comment_post_form.comment_body.value;if($type(document.comment_post_form.comment_secure))
postData.comment_secure=document.comment_post_form.comment_secure.value;var bind=this;var request=new Request.JSON({'url':this.options.ajaxURL,'method':this.options.ajaxMethod,'secure':this.options.ajaxSecure,'data':postData,'onComplete':function(responseObject,responseText){bind.addComment(responseObject.is_error,responseObject.comment_body,responseObject.comment_date);}}).send();event.stop();},doCommentEdit:function(){var postData={'task':'comment_edit','type':this.options.type,'iden':this.options.typeIdentifier,'value':this.options.typeID,'user':this.Base.Owner.user_info.user_username};if($type(document.editCommentForm.comment_id))
postData.comment_id=document.editCommentForm.comment_id.value;if($type(document.editCommentForm.comment_edit))
postData.comment_edit=document.editCommentForm.comment_edit.value;var bind=this;var request=new Request.JSON({'url':this.options.ajaxURL,'method':this.options.ajaxMethod,'secure':this.options.ajaxSecure,'data':postData,'onComplete':function(responseObject,responseText){bind.getComments();}}).send();},doCommentDelete:function(e,commentID){var event=new Event(e);var postData={'task':'comment_delete','comment_id':commentID,'type':this.options.type,'iden':this.options.typeIdentifier,'value':this.options.typeID,'tab':this.options.typeTab,'col':this.options.typeCol,'user':this.Base.Owner.user_info.user_username};if(this.options.typeTabParent)
postData.tab_parent=this.options.typeTabParent;if(this.options.typeColParent)
postData.col_parent=this.options.typeColParent;if(this.options.typeChild)
postData.child=this.options.typeChild;if(this.options.object_owner)
postData.object_owner=this.options.object_owner;if(this.options.object_owner_id)
postData.object_owner_id=this.options.object_owner_id;if($type(document.commentDeleteForm.comment_body))
postData.comment_body=document.commentDeleteForm.comment_body.value;if($type(document.commentDeleteForm.comment_secure))
postData.comment_secure=document.commentDeleteForm.comment_secure.value;var bind=this;var request=new Request.JSON({'url':this.options.ajaxURL,'method':this.options.ajaxMethod,'secure':this.options.ajaxSecure,'data':postData,'evalScripts':true,'onComplete':function(){bind.getComments(this.page);}}).send();event.stop();},getComments:function(direction){if(direction=='next')
this.page++;else if(direction=='previous')
this.page--;else if(direction=='first')
this.page=1;else if(direction=='last')
this.page=Math.ceil(this.total/this.options.cpp);else if(typeof(direction)=='number'&&direction>0)
this.page=direction;else if($type(direction))
this.page=direction;if(this.options.paginate){}else{this.options.cpp=this.total;}
if(this.options.object_owner&&this.options.object_owner_id){var object_owner=this.options.object_owner;var object_owner_id=this.options.object_owner_id;var user='';}else{var object_owner='';var object_owner_id='';var user=this.Base.Owner.user_info.user_username;}
var bind=this;var request=new Request.JSON({'url':this.options.ajaxURL,'method':this.options.ajaxMethod,'secure':this.options.ajaxSecure,'data':{'task':'comment_get','user':user,'object_owner':object_owner,'object_owner_id':object_owner_id,'type':this.options.type,'iden':this.options.typeIdentifier,'value':this.options.typeID,'cpp':this.options.cpp,'p':this.page},'onSuccess':function(responseObject,responseText){bind.updateComments(responseObject);}});request.send();},updateComments:function(responseObject){var commentContainerElement=$(this.options.type+'_'
+this.options.typeID+'_comments');if($type(responseObject)!="object"){if(commentContainerElement)
commentContainerElement.set('html','Comments: There was an error processing the <a onclick="alert(\''
+JSON.encode(this.options).replace(/"/g,'&quot;')+'\')">request</a>.');return false;}
this.total=parseInt(responseObject.total_comments)||0;this.page=responseObject.p;var maxpage=responseObject.maxpage;var p_start=responseObject.p_start;var p_end=responseObject.p_end;var pages=responseObject.pages;var totalCommentElement=$(this.options.type+'_'
+this.options.typeID+'_totalcomments');var comments=$H(responseObject.comments);totalCommentElement.innerHTML=this.total;var commentBodyDiv=document.createElement('div');commentContainerElement.empty();var bind=this;if(bind.Base.Core.settings.setting_url){var querySeparator='?';}else{var querySeparator='&';}
comments.each(function(commentObject,commentID){var newComment=new Element('div',{'id':'comment_'+commentID});var newCommentInnerHTML="<div class='comment'>";if(commentObject.comment_authoruser_id&&commentObject.comment_authoruser_exists)
newCommentInnerHTML+="<div class='avatar left'><a href='"
+commentObject.comment_authoruser_url
+"'><img src='"
+commentObject.comment_authoruser_photo
+"' class='photo' width='"
+commentObject.comment_authoruser_photo_width
+"'></a></div>";else
newCommentInnerHTML+="<div class='avatar left'><img src='./images/no_avatar_s.jpg' class='photo' width='75'></div>";newCommentInnerHTML+="<div class='commentMessage bordered left'>";if(!commentObject.comment_authoruser_id)
newCommentInnerHTML+="<span class='userinfo'><strong>"
+bind.Base.Language.Translate(835)
+"</strong>";else if(!commentObject.comment_authoruser_exists)
newCommentInnerHTML+="<span class='userinfo'><strong>"
+bind.Base.Language.Translate(1071)
+"</strong>";else
newCommentInnerHTML+="<span class='userinfo'><a href='"
+commentObject.comment_authoruser_url
+"' class='link'><strong>"
+commentObject.comment_authoruser_displayname
+"</strong></a>";newCommentInnerHTML+="&nbsp;<span class='miniText lgray'>"
+commentObject.comment_date+"</span></span>";newComment.setProperty('html',commentObject.comment_body);newCommentInnerHTML+="<p class='comment' id='profile_comment_body_"
+commentID
+"'>"
+(commentObject.comment_body?commentObject.comment_body:"&nbsp;")
+"</p>";var links=new Array();if(bind.Base.Viewer.user_exists&&commentObject.comment_authoruser_id&&commentObject.comment_authoruser_exists){if(bind.options.commentLinks.reply&&bind.Base.Viewer.user_info.user_id==bind.Base.Owner.user_info.user_id&&bind.Base.Viewer.user_info.user_id!=commentObject.comment_authoruser_id){links.push("<li><a title='"
+'Reply'
+"' href='"
+commentObject.comment_authoruser_url
+querySeparator
+"v=comments' class='iconSprite undoGray'>"
+"</a></li>");}
if(bind.Base.Viewer.user_info.user_id>0&&commentObject.comment_authoruser_id!=bind.Base.Viewer.user_info.user_id){links.push("<li><a title='"
+'Send message'
+"' href=\"javascript:TB_show('"
+bind.Base.Language.Translate(784)
+"', 'user_messages_new.php?to_user="
+commentObject.comment_authoruser_displayname
+"&to_id="
+commentObject.comment_authoruser_username
+"&TB_iframe=true&height=400&width=450', '', 1);\" class='iconSprite mailGray'>"
+"</a></li>");}
if(commentObject.comment_authoruser_id==bind.Base.Viewer.user_info.user_id){links.push("<li><a class=\"commentEditLink iconSprite documentPencilGray\" href=\"javascript:void(0);\" id='comment_edit_link_"
+commentID
+"' title='"
+'Edit comment'
+"'>"
+"</a></li>");}}
if((commentObject.comment_authoruser_exists&&commentObject.comment_authoruser_id==bind.Base.Viewer.user_info.user_id)||(bind.Base.Viewer.user_exists&&bind.Base.Viewer.user_info.user_id==bind.Base.Owner.user_info.user_id)){links.push("<li><a class=\"commentDeleteLink iconSprite crossGray\" href=\"javascript:void(0);\" id='comment_delete_link_"
+commentID
+"' title='"
+'Delete comment'
+"'>"
+"</a></li>");}
if(links.push()>0){newCommentInnerHTML+="<div class='commentActions'>";newCommentInnerHTML+="<ul class='commentActionList'>";newCommentInnerHTML+=links.join('');newCommentInnerHTML+="</ul></div>";}
newCommentInnerHTML+="</div><div class='clear'></div></div>";newComment.setProperty('html',newCommentInnerHTML);if(navigator.userAgent.toLowerCase().indexOf('chrome')>-1)
newComment.inject(commentContainerElement,'top');else
newComment.inject(commentContainerElement,'bottom');if(newComment.getElement('.commentEditLink'))
newComment.getElement('.commentEditLink').addEvent('click',function(){bind.editComment(commentID);});if(newComment.getElement('.commentDeleteLink'))
newComment.getElement('.commentDeleteLink').addEvent('click',function(){bind.confirmDelete(commentID);});});if(this.options.paginate&&this.total>this.options.cpp){var mpage=Math.ceil(this.total/this.options.cpp);var pfrom=Math.max(1,this.page-this.range);var pto=Math.min(mpage,this.page+this.range);var commentPaginationTop=new Element('div',{'class':'pages'});var commentPaginationBottom=new Element('div',{'class':'pages'});var paginationHTMLTop='<div class="navigator">';var paginationHTMLBottom='<div class="navigator">';if(this.page>1){paginationHTMLTop+="<a href='javascript:void(0);' id='comment_first_page_top'>First</a>";paginationHTMLTop+="<a href='javascript:void(0);' id='comment_previous_page_top'>Previous</a>";paginationHTMLBottom+="<a href='javascript:void(0);' id='comment_first_page_bottom'>First</a>";paginationHTMLBottom+="<a href='javascript:void(0);' id='comment_previous_page_bottom'>Previous</a>";}else{paginationHTMLTop+="<span class='edge'>First</span>";paginationHTMLTop+="<span class='edge'>Previous</span>";paginationHTMLBottom+="<span class='edge'>First</span>";paginationHTMLBottom+="<span class='edge'>Previous</span>";}
if(p_start==p_end){paginationHTMLTop+="<span class='current'>"
+this.Base.Language.TranslateFormatted(184,[p_start,this.total])+"</span>";paginationHTMLBottom+="<span class='current'>"
+this.Base.Language.TranslateFormatted(184,[p_start,this.total])+"</span>";}else{for(curpage=pfrom;curpage<=pto;curpage++){if(curpage==this.page){paginationHTMLTop+="<span class='current'>"+curpage+"</span>";paginationHTMLBottom+="<span class='current'>"+curpage+"</span>";}else{paginationHTMLTop+="<a id='comment_page_top_"+curpage+"' href='javascript:void(0);'>"+curpage+"</a>";paginationHTMLBottom+="<a id='comment_page_bottom_"+curpage+"' href='javascript:void(0);'>"+curpage+"</a>";}}}
if(this.page!=maxpage){paginationHTMLTop+="<a href='javascript:void(0);' id='comment_next_page_top'>Next</a>";paginationHTMLTop+="<a href='javascript:void(0);' id='comment_last_page_top'>Last</a>";paginationHTMLBottom+="<a href='javascript:void(0);' id='comment_next_page_bottom'>Next</a>";paginationHTMLBottom+="<a href='javascript:void(0);' id='comment_last_page_bottom'>Last</a>";}else{paginationHTMLTop+="<span class='edge'>Next</span>";paginationHTMLTop+="<span class='edge'>Last</span>";paginationHTMLBottom+="<span class='edge'>Next</span>";paginationHTMLBottom+="<span class='edge'>Last</span>";}
paginationHTMLTop+='</div>';paginationHTMLBottom+='</div>';commentPaginationTop.setProperty('html',paginationHTMLTop);commentPaginationBottom.setProperty('html',paginationHTMLBottom);commentPaginationTop.inject(commentContainerElement,'top');commentPaginationBottom.inject(commentContainerElement);if(commentPaginationTop.getElement('a[id=comment_first_page_top]'))
commentPaginationTop.getElement('a[id=comment_first_page_top]').addEvent('click',function(){bind.getComments('first');});if(commentPaginationBottom.getElement('a[id=comment_first_page_bottom]'))
commentPaginationBottom.getElement('a[id=comment_first_page_bottom]').addEvent('click',function(){bind.getComments('first');});if(commentPaginationTop.getElement('a[id=comment_previous_page_top]'))
commentPaginationTop.getElement('a[id=comment_previous_page_top]').addEvent('click',function(){bind.getComments('previous');});if(commentPaginationBottom.getElement('a[id=comment_previous_page_bottom]'))
commentPaginationBottom.getElement('a[id=comment_previous_page_bottom]').addEvent('click',function(){bind.getComments('previous');});if(commentPaginationTop.getElement('a[id=comment_next_page_top]'))
commentPaginationTop.getElement('a[id=comment_next_page_top]').addEvent('click',function(){bind.getComments('next');});if(commentPaginationBottom.getElement('a[id=comment_next_page_bottom]'))
commentPaginationBottom.getElement('a[id=comment_next_page_bottom]').addEvent('click',function(){bind.getComments('next');});if(commentPaginationTop.getElement('a[id=comment_last_page_top]'))
commentPaginationTop.getElement('a[id=comment_last_page_top]').addEvent('click',function(){bind.getComments('last');});if(commentPaginationBottom.getElement('a[id=comment_last_page_bottom]'))
commentPaginationBottom.getElement('a[id=comment_last_page_bottom]').addEvent('click',function(){bind.getComments('last');});for(curpage=pfrom;curpage<=pto;curpage++){if(commentPaginationTop.getElement('a[id=comment_page_top_'+curpage+']'))
commentPaginationTop.getElement('a[id=comment_page_top_'+curpage+']').addEvent('click',function(e,cpage){bind.getComments(cpage);}.bindWithEvent(this,curpage));if(commentPaginationBottom.getElement('a[id=comment_page_bottom_'+curpage+']'))
commentPaginationBottom.getElement('a[id=comment_page_bottom_'+curpage+']').addEvent('click',function(e,cpage){bind.getComments(cpage);}.bindWithEvent(this,curpage));}}},addComment:function(is_error,comment_body,comment_date){if(!this.options.canComment)
return false;if(is_error){$('comment_error').style.display='block';if(!comment_body.trim()){this.addText($('comment_body'));$('comment_error').innerHTML=this.Base.Language.Translate(831);}else{$('comment_error').innerHTML=this.Base.Language.Translate(832);}
$('comment_submit').value="GO!";$('comment_submit').disabled=false;}else{$('comment_error').style.display='none';$('comment_error').innerHTML='';$('comment_body').value='';$('comment_body').style.height=this.options.originalHeight+'px';this.addText($('comment_body'));$('comment_submit').value="GO!";$('comment_submit').disabled=false;if($('comment_secure')){$('comment_secure').value='';$('secure_image').src=$('secure_image').src+'?'
+(new Date()).getTime();}
this.page=1;this.total++;this.getComments();$('comment_body').focus();}},editComment:function(commentID){var bind=this;if(this.isEditing)
return false;this.isEditing=true;var commentElement=$('profile_comment_body_'+commentID);var height=commentElement.offsetHeight+10;var commentText=commentElement.innerHTML.replace(/<br>/gi,'\r\n').replace(/>/gi,'&gt;');var innerHTML='';innerHTML+='<a class="iconSmall deleteSmallGray" id="edit_cancel'
+commentID
+'" title="Cancel editing" href="javascript:void(0)" style="display:block; height:16px; right:43px; position:absolute; top:0;"></a>';innerHTML+="<form action='misc_js.php' method='post' target='ajaxframe' name='editCommentForm'>";innerHTML+="<textarea class='formElement field' name='comment_edit' id='comment_edit_"
+commentID
+"' style='height: "
+height
+" px; width: 90%;'>"+commentText+"</textarea>";innerHTML+="<input type='hidden' name='task' value='comment_edit'>";innerHTML+="<input type='hidden' name='comment_id' value='"
+commentID+"'>";innerHTML+="<input type='hidden' name='type' value='"
+this.options.type+"'>";innerHTML+="<input type='hidden' name='iden' value='"
+this.options.typeIdentifier+"'>";innerHTML+="<input type='hidden' name='value' value='"
+this.options.typeID+"'>";if(this.options.typeTab)
innerHTML+='<input type="hidden" name="tab" value="'+this.options.typeTab+'">';if(this.options.typeCol)
innerHTML+='<input type="hidden" name="col" value="'+this.options.typeCol+'">';if(this.options.typeTabParent)
innerHTML+='<input type="hidden" name="tab_parent" value="'+this.options.typeTabParent+'">';if(this.options.typeColParent)
innerHTML+='<input type="hidden" name="col_parent" value="'+this.options.typeColParent+'">';if(this.options.typeChild)
innerHTML+='<input type="hidden" name="child" value="1">';innerHTML+="</form>";commentElement.innerHTML=innerHTML;textarea_autogrow('comment_edit_'+commentID);$('comment_edit_'+commentID).focus();$('comment_edit_link_'+commentID).removeClass('commentEditLink');$('comment_edit_link_'+commentID).removeClass('documentPencilGray');$('comment_edit_link_'+commentID).addClass('commentSubmitLink');$('comment_edit_link_'+commentID).addClass('floppyGray');$('comment_edit_link_'+commentID).set('title','Save');$$('.commentSubmitLink').addEvent('click',function(){document.editCommentForm.submit();$('comment_edit_link_'+commentID).removeClass('commentSubmitLink');$('comment_edit_link_'+commentID).removeClass('floppyGray');$('comment_edit_link_'+commentID).addClass('ajaxLoader');bind.isEditing=false;});$('edit_cancel'+commentID).addEvent('click',function(){window.parent.getComments();bind.isEditing=false;});},confirmDelete:function(commentID){$('del_comment_id').value=commentID;TB_show(this.Base.Language.Translate(1025),'#TB_inline?height=100&width=300&inlineId=confirmcommentdelete','',1);var bind=this;$('TB_window').getElement('form').name='commentDeleteForm';$('TB_window').getElement('form').addEvent('submit',function(event){bind.doCommentDelete(event,commentID);});},removeText:function(commentBody){if(!this.changed){commentBody.value='';commentBody.style.color='#000000';this.changed=true;}},addText:function(commentBody){if(!commentBody.value.trim()){commentBody.value=this.Base.Language.Translate(829);commentBody.style.color='#888888';this.changed=false;}},checkText:function(commentBody){if(!this.changed)
$('comment_body').value='';$('comment_submit').value="GO!";$('comment_submit').disabled=true;}});
/* file=class_tags.js */

SocialEngineAPI.Tags=new Class({Implements:[Options],Base:{},isTagging:false,newtag:false,tags:[],options:{'ajaxURL':'misc_js.php','ajaxMethod':'post','ajaxSecure':false,'canTag':false,'type':false,'media_id':false,'media_dir':false,'object_owner':false,'object_owner_id':false},initialize:function(options)
{this.setOptions(options);if(this.options.initialTotal)this.total=this.options.initialTotal;var bind=this;window.addEvent('domready',function()
{bind.showTagForm();});},showTagForm:function()
{var innerHTML="";var bind=this;if(this.options.canTag)
{innerHTML+="<div class='media_photo_tagform_titlebar'><img src='images/icons/photos16.gif' class='icon' />"+this.Base.Language.Translate(1212)+"</div>"+"<div style='padding: 7px;'>"+"<div style='text-align: left;'>"+"<div style='font-size: 7pt; margin-bottom: 5px;'>"+this.Base.Language.Translate(1213)+"</div>"+"<div style='text-align: center;'><input type='text' style='width: 130px; padding-left: 4px; font-size: 8pt;' name='media_photo_tag' id='media_photo_tag' class='text' maxlength='40'/></div>"+"</div>"+"<div id='media_photo_friendlist' class='media_photo_friendlist'>";if(bind.Base.Viewer.user_exists)
{innerHTML+="<div><a href='javascript:void(0)' id='tag_me'>"+bind.Base.Viewer.user_displayname+bind.Base.Language.Translate(1214)+"</a></div>";}
innerHTML+="</div>"+"<div>"+"<input type='button' class='button' name='save' id='tag_save' value='"+bind.Base.Language.Translate(1215)+"' />&nbsp;&nbsp;"+"<input type='button' class='button' id='tag_cancel' name='cancel' value='"+bind.Base.Language.Translate(39)+"' />"+"</div>"+"</div>";var newTagForm=new Element('div',{'id':'media_photo_tagform','class':'media_photo_tagform','html':innerHTML});var mediaContainer=$('media_photo_div');newTagForm.inject(mediaContainer);if(newTagForm.getElement('input[id=tag_cancel]'))newTagForm.getElement('input[id=tag_cancel]').addEvent('click',function()
{bind.cancelTag();});if(newTagForm.getElement('input[id=tag_save]'))newTagForm.getElement('input[id=tag_save]').addEvent('click',function()
{bind.saveTag(0);});if(newTagForm.getElement('a[id=tag_me]'))newTagForm.getElement('a[id=tag_me]').addEvent('click',function()
{bind.saveTag(bind.Base.Viewer.user_info.user_id);});var request=new Request.JSON({secure:false,url:'misc_js.php?task=friends_all',onComplete:function(jsonObj){bind.addFriendToList(jsonObj.friends);}}).send();}},addFriendToList:function(friends)
{var bind=this;friends.each(function(friend){for(var x in friend){var newDiv=new Element("div",{'id':'friend_div_'+x});var newAnchor=new Element("a",{'href':'javascript:void(0)','id':'friend_link_'+x,'html':friend[x]}).inject(newDiv);newDiv.inject($('media_photo_friendlist'));$('friend_link_'+x).addEvent('click',function(){bind.saveTag(x);});}});},insertTag:function(tag_id,tag_link,tag_text,tag_x,tag_y,tag_width,tag_height,tagged_user)
{var newHTML='';var bind=this;if($('media_tags').style.display=='none')
{$('media_tags').style.display='block';}else if(bind.tags.length!=0)
{newHTML='<span id="tag_comma_'+tag_id+'">, </span>';}
var newSpan=new Element("span",{'id':'full_tag_'+tag_id,'html':newHTML});if(tag_link!='')
{var newAnchor=new Element("a",{'href':tag_link,'id':'tag_link_'+tag_id,'html':tag_text}).inject(newSpan);}
else{var newAnchor=new Element("span",{'id':'tag_link_'+tag_id,'html':tag_text,'styles':{'cursor':'pointer'}}).inject(newSpan);}
if(bind.Base.Viewer.user_exists&&(bind.Base.Viewer.user_info.user_username==tagged_user||bind.Base.Viewer.user_info.user_username==bind.Base.Owner.user_info.user_username))
{var media_tags_text=$(newSpan).get('html');$(newSpan).set('html',media_tags_text,' (<a href=\'javascript:void(0);\' id=\'new_removetag_link\'>'+bind.Base.Language.Translate(1228)+'</a>)');}
newSpan.inject($('media_tags'));bind.createTag(tag_id,tag_text,tag_x,tag_y,tag_width,tag_height);$('tag_link_'+tag_id).addEvent('mouseover',function(){bind.showTag(tag_id);});$('tag_link_'+tag_id).addEvent('mouseout',function(){bind.hideTag(tag_id);});if($('new_removetag_link')){$('new_removetag_link').addEvent('click',function(){bind.removeTag(tag_id);});$('new_removetag_link').set('id','removetag_link_'+tag_id);}
bind.tags.push(tag_id);},createTag:function(tag_id,label_text,tag_x,tag_y,tag_width,tag_height)
{var bind=this;new Element("div",{'id':'tag_'+tag_id,'html':'<img src="./images/trans.gif" width="100%" height="100%" />','class':'tag_div_hidden','styles':{'width':(parseInt(tag_width)-4)+'px','height':(parseInt(tag_height)-4)+'px','top':tag_x+'px','left':tag_y+'px'}}).inject($('media_photo_div'));new Element("div",{'id':'tag_label_'+tag_id,'html':label_text,'class':'tag_label','styles':{'display':'none','top':(parseInt(tag_x)+parseInt(tag_height)+10)+'px','left':tag_y+'px'}}).inject($('media_photo_div'));$('tag_'+tag_id).addEvent('mouseover',function(){bind.showTag(tag_id);});$('tag_'+tag_id).addEvent('mouseout',function(){bind.hideTag(tag_id);});},showTag:function(tag_id)
{$('tag_'+tag_id).className='tag_div';$('tag_label_'+tag_id).style.display='block';},hideTag:function(tag_id)
{$('tag_'+tag_id).className='tag_div_hidden';$('tag_label_'+tag_id).style.display='none';},addTag:function()
{if(!this.isTagging){this.isTagging=true;this.newtag=new MooCrop('media_photo');var bind=this;var indicator=$('media_photo_tagform').inject(bind.newtag.wrapper);indicator.setStyles({'top':this.newtag.crop.bottom+10,'left':this.newtag.crop.right+10,'display':'block'});this.newtag.addEvent('onBegin',function(imgsrc,crop,bound,hanlde){indicator.setStyle('display','none');});this.newtag.addEvent('onCrop',function(imgsrc,crop,bound,hanlde){indicator.setStyles({'top':crop.bottom+10,'left':crop.right+10,'display':'none'});});this.newtag.addEvent('onComplete',function(imgsrc,crop,bound,hanlde){indicator.setStyle('display','block');});}},cancelTag:function()
{if(this.isTagging){$('media_photo_tag').value='';$('media_photo_tagform').inject('media_photo_div').setStyle('display','none');var stopTagging=this.newtag.removeOverlay.bind(this.newtag);stopTagging();this.isTagging=false;}},saveTag:function(mediatag_user_id)
{if(this.isTagging){if(this.options.object_owner&&this.options.object_owner_id)
{var object_owner=this.options.object_owner;var object_owner_id=this.options.object_owner_id;var user='';}else{var object_owner='';var object_owner_id='';var user=this.Base.Owner.user_info.user_username;}
var url="misc_js.php?task=tag_do"+"&mediatag_user_id="+mediatag_user_id+"&mediatag_text="+encodeURIComponent($('media_photo_tag').value)+"&mediatag_x="+this.newtag.crop.top+"&mediatag_y="+this.newtag.crop.left+"&mediatag_height="+this.newtag.crop.height+"&mediatag_width="+this.newtag.crop.width+"&user="+user+"&object_owner="+object_owner+"&object_owner_id="+object_owner_id+"&type="+this.options.type+"&media_id="+this.options.media_id+"&media_dir="+this.options.media_dir;$('ajaxframe').src=url;$('media_photo_tag').value='';$('media_photo_tagform').inject('media_photo_div').setStyle('display','none');var stopTagging=this.newtag.removeOverlay.bind(this.newtag);stopTagging();this.isTagging=false;}},removeTag:function(tag_id)
{if(this.options.object_owner&&this.options.object_owner_id)
{var object_owner=this.options.object_owner;var object_owner_id=this.options.object_owner_id;var user='';}else{var object_owner='';var object_owner_id='';var user=this.Base.Owner.user_info.user_username;}
var url="misc_js.php?task=tag_remove"+"&mediatag_id="+tag_id+"&user="+user+"&object_owner="+object_owner+"&object_owner_id="+object_owner_id+"&type="+this.options.type+"&media_id="+this.options.media_id;$('ajaxframe').src=url;$('tag_'+tag_id).destroy();$('tag_label_'+tag_id).destroy();$('full_tag_'+tag_id).destroy();if(this.tags.indexOf(tag_id)==0&&$('tag_comma_'+this.tags[1])){$('tag_comma_'+this.tags[1]).destroy();}
this.tags.splice(this.tags.indexOf(tag_id),1);if(this.tags.length==0){$('media_tags').style.display='none';}}});var MooCrop=new Class({calculateHandles:true,current:{},options:{maskColor:'black',maskOpacity:'.3',handleColor:'#FFFFFF',handleWidth:'5px',handleHeight:'5px',cropBorder:'1px dashed #FFFFFF',min:{'width':50,'height':50},showMask:true,showHandles:false},initialize:function(el,options){this.setOptions(options);this.img=$(el);if(this.img.get('tag')!='img')return false;this.resizeFunc=this.refresh.bindWithEvent(this);this.removeFunc=this.removeListener.bind(this);this.buildOverlay();this.setup();},setup:function(){$(this.cropArea).setStyles({'width':this.options.min.width,'height':this.options.min.height,'top':(this.img.height-this.options.min.height)/2,'left':(this.img.width-this.options.min.width)/2});this.current.crop=this.crop=this.getCropArea();this.handleWidthOffset=this.options.handleWidth.toInt()/2;this.handleHeightOffset=this.options.handleHeight.toInt()/2;this.fixBoxModel();this.drawMasks();this.positionHandles();},getCropArea:function(){var crop=this.cropArea.getCoordinates();crop.left-=this.offsets.x;crop.right-=this.offsets.x;crop.top-=this.offsets.y;crop.bottom-=this.offsets.y;return crop;},fixBoxModel:function(){var diff=this.boxDiff=(this.crop.width-this.options.min.width)/2;var b=this.bounds={'top':diff,'left':diff,'right':this.img.width+(diff*2),'bottom':this.img.height+(diff*2),'width':this.options.min.width+(diff*2),'height':this.options.min.height+(diff*2)};this.wrapper.setStyles({'width':b.right,'height':b.bottom,'background':'url('+this.img.src+') no-repeat '+diff+'px '+diff+'px'});this.north.setStyle('width',b.right);this.south.setStyle('width',b.right);},activate:function(event,handle){event.stop();this.current={'x':event.page.x,'y':event.page.y,'handle':handle,'crop':this.current.crop};if(this.current.handle=='NESW'&&!this.options.showHandles)this.hideHandles();this.fireEvent('onBegin',[this.img.src,this.getCropInfo(),this.bounds,handle]);document.addEvent('mousemove',this.resizeFunc);document.addEvent('mouseup',this.removeFunc);},removeListener:function(){if(this.current.handle=='NESW'&&!this.options.showHandles)this.showHandles();document.removeEvent('mousemove',this.resizeFunc);document.removeEvent('mouseup',this.removeFunc);this.crop=this.current.crop;this.fireEvent('onComplete',[this.img.src,this.getCropInfo(),this.bounds,this.current.handle]);},refresh:function(event){var xdiff=this.current.x-event.page.x;var ydiff=this.current.y-event.page.y;var b=this.bounds;var c=this.crop;var handle=this.current.handle;var styles={};var dragging=(handle.length>2)?true:false;if(handle.contains("S")){if(c.bottom-ydiff>b.bottom)ydiff=c.bottom-b.bottom;if(!dragging){if((c.height-ydiff)<b.height)ydiff=c.height-b.height;styles['height']=c.height-ydiff;}}
if(handle.contains("N")){if(c.top-ydiff<b.top)ydiff=c.top;if(!dragging){if((c.height+ydiff)<b.height)ydiff=b.height-c.height;styles['height']=c.height+ydiff;}
styles['top']=c.top-ydiff;}
if(handle.contains("E")){if(c.right-xdiff>b.right)xdiff=c.right-b.right;if(!dragging){if((c.width-xdiff)<b.width)xdiff=c.width-b.width;styles['width']=c.width-xdiff;}}
if(handle.contains("W")){if(c.left-xdiff<b.left)xdiff=c.left;if(!dragging){if((c.width+xdiff)<b.width)xdiff=b.width-c.width;styles['width']=c.width+xdiff;}
styles['left']=c.left-xdiff;}
var preCssStyles=$merge(styles);if($defined(styles.width))styles.width-=this.boxDiff*2;if($defined(styles.height))styles.height-=this.boxDiff*2;this.cropArea.setStyles(styles);this.getCurrentCoords(preCssStyles);this.drawMasks();this.positionHandles();this.fireEvent('onCrop',[this.img.src,this.getCropInfo(),b,handle]);},getCurrentCoords:function(changed){var current=$merge(this.crop);if($defined(changed.left)){current.left=changed.left;if($defined(changed.width))current.width=changed.width;else current.right=current.left+current.width;}
if($defined(changed.top)){current.top=changed.top;if($defined(changed.height))current.height=changed.height;else current.bottom=current.top+current.height;}
if($defined(changed.width)&&!$defined(changed.left)){current.width=changed.width;current.right=current.left+current.width;}
if($defined(changed.height)&&!$defined(changed.top)){current.height=changed.height;current.bottom=current.top+current.height;}
this.current.crop=current;},drawMasks:function(){if(!this.options.showMask)return;var b=this.bounds;var c=this.current.crop;var handle=this.current.handle;this.north.setStyle('height',c.top+'px');this.south.setStyle('height',b.bottom-c.bottom+'px');this.east.setStyles({height:c.height+'px',width:b.right-c.right+'px',top:c.top+'px',left:c.right+'px'});this.west.setStyles({height:c.height+'px',width:c.left+'px',top:c.top+'px'});},positionHandles:function(){if(!this.calculateHandles)return;var c=this.current.crop;var wOffset=this.handleWidthOffset;var hOffset=this.handleHeightOffset;this.handles.get('N').setStyles({'left':c.width/2-wOffset+'px','top':-hOffset+'px'});this.handles.get('NE').setStyles({'left':c.width-wOffset+'px','top':-hOffset+'px'});this.handles.get('E').setStyles({'left':c.width-wOffset+'px','top':c.height/2-hOffset+'px'});this.handles.get('SE').setStyles({'left':c.width-wOffset+'px','top':c.height-hOffset+'px'});this.handles.get('S').setStyles({'left':c.width/2-wOffset+'px','top':c.height-hOffset+'px'});this.handles.get('SW').setStyles({'left':-wOffset+'px','top':c.height-hOffset+'px'});this.handles.get('W').setStyles({'left':-wOffset+'px','top':c.height/2-hOffset+'px'});this.handles.get('NW').setStyles({'left':-wOffset+'px','top':-hOffset+'px'});},hideHandles:function(){this.calculateHandles=false;this.handles.each(function(handle){handle.setStyle('display','none');});},showHandles:function(){this.calculateHandles=true;this.positionHandles();this.handles.each(function(handle){handle.setStyle('display','block');});},buildOverlay:function(){var o=this.options;this.wrapper=new Element("div",{'styles':{'z-index':100,'position':'relative','width':this.img.width,'height':this.img.height,'background':'url('+this.img.src+') no-repeat','float':this.img.getStyle('float'),'margin-left':'auto','margin-right':'auto'}}).injectBefore(this.img);this.img.setStyle('display','none');this.offsets={x:this.wrapper.getLeft(),y:this.wrapper.getTop()};this.wrapper.addEvent('mouseover',function(event){return false;});if(this.options.showMask){var maskStyles={'position':'absolute','overflow':'hidden','background-color':o.maskColor,'opacity':o.maskOpacity};this.north=new Element("div",{'styles':$merge(maskStyles,{'left':'0px'})}).injectInside(this.wrapper);this.south=new Element("div",{'styles':$merge(maskStyles,{'bottom':'0px','left':'0px'})}).injectInside(this.wrapper);this.east=new Element("div",{'styles':maskStyles}).injectInside(this.wrapper);this.west=new Element("div",{'styles':$merge(maskStyles,{'left':'0px'})}).injectInside(this.wrapper);}
this.cropArea=new Element("div",{'styles':{'position':'absolute','top':'0px','left':'0px','border':o.cropBorder,'cursor':'move'},'events':{'dblclick':function(){this.fireEvent('onDblClk',[this.img.src,this.getCropInfo(),this.bounds])}.bind(this),'mousedown':this.activate.bindWithEvent(this,'NESW')}}).injectInside(this.wrapper);this.handles=new Hash();['N','NE','E','SE','S','SW','W','NW'].each(function(handle){this.handles.set(handle,new Element("div",{'styles':{'position':'absolute','background-color':o.handleColor,'width':o.handleWidth,'height':o.handleHeight,'overflow':'hidden','cursor':(handle.toLowerCase()+'-resize')},'events':{'mousedown':this.activate.bindWithEvent(this,handle)}}).injectInside(this.cropArea));},this);},getCropInfo:function(){var c=$merge(this.current.crop);c.width-=this.boxDiff*2;c.height-=this.boxDiff*2;return c;},removeOverlay:function(){this.wrapper.destroy();this.img.setStyle('display','');}});MooCrop.implement(new Events,new Options);
/* file=class_user.js */

SocialEngineAPI.User=new Class({Base:{},user_exists:false,user_displayname:false,user_displayname_short:false,user_info:{},profile_info:{},level_info:{},usersetting_info:{},options:{'ajaxURL':'misc_js.php','ajaxMethod':'post','ajaxSecure':false,'displayname_order':'standard'},user_status:'',user_notify_cookie:{},user_notify_count:0,initialize:function()
{},userPhotoFullPath:function()
{if(!this.Base.URL)
return false;if(!this.user_info.user_photo)
return this.Base.URL.url_base+'images/no_avatar_s.jpg';return this.Base.URL.url_base+this.Base.URL.url_userdir(this.user_info.user_id)+this.user_info.user_photo;},userStatusChange:function()
{if(!$('ajax_status'))return false;var userStatus=this.user_status.replace(/<wbr>/g,'').replace(/&shy;/g,'');var statusHTML=this.user_displayname_short+" <input type='text' class='text_small' name='status_new' id='status_new' maxlength='400' value='";statusHTML+=(userStatus==''?this.Base.Language.Translate(744):userStatus);statusHTML+="' size='10' style='width: 140px; margin: 2px 0px 2px 0px;' onkeypress='return ( (new Event(event)).key==\"enter\" ? SocialEngine.Viewer.userStatusChangeSubmit() : true );'>"+"<br />"+"<a href='javascript:void(0);' onclick='SocialEngine.Viewer.userStatusChangeSubmit(); return false;'>"+
this.Base.Language.Translate(746)+"</a> | <a href='javascript:void(0);' onclick='SocialEngine.Viewer.userStatusChangeReturn(); return false;'>"+
this.Base.Language.Translate(747)+"</a>";$('ajax_status').innerHTML=statusHTML;$('status_new').focus();$('status_new').select();},userStatusChangeReturn:function()
{if(!$('ajax_status'))return false;if(this.user_status=='')
{$('ajax_status').innerHTML="<a href='javascript:void(0);' onclick='SocialEngine.Viewer.userStatusChange(); return false;'>"+this.Base.Language.Translate(743)+"</a>";}
else
{$('ajax_status').innerHTML="<div id='ajax_status'>"+this.user_displayname_short+" <span id='ajax_currentstatus_value'>"+this.user_status+"</span><br />"+"<div style='padding-top: 5px;'>"+"<div style='float: left; padding-right: 5px;'>"+"[ <a href='javascript:void(0);' onClick='SocialEngine.Viewer.userStatusChange(); return false;'>"+this.Base.Language.Translate(745)+"</a> ]"+"</div>"+"<div class='home_updated'>"+"<span id='ajax_currentstatus_date'>"+this.Base.Language.Translate(1113)+" "+this.Base.Language.TranslateFormatted(773,[1])+"</span>"+"</div>"+"<div style='clear: both; height: 0px;'></div>"+"</div>"+"</div>";}},userStatusChangeSubmit:function()
{if(!$('ajax_status'))return false;var bind=this;var request=new Request.JSON({'url':this.options.ajaxURL,'method':this.options.ajaxMethod,'secure':this.options.ajaxSecure,'data':{'task':'status_change','status':$('status_new').value},'onComplete':function(responseObject,responseText)
{bind.user_status=responseObject.status;bind.userStatusChangeReturn();}}).send();},userDelete:function()
{TB_show(this.Base.Language.Translate(759),'#TB_inline?height=300&width=600&inlineId=confirmdelete','',1);},userDeleteConfirm:function(delete_token)
{var bind=this;var request=new Request.JSON({'url':'user_account_delete.php','method':this.options.ajaxMethod,'secure':this.options.ajaxSecure,'data':{'task':'sendconf','token':delete_token,'options':$('userDeleteForm').toQueryString()},'onComplete':function(responseObject,responseText)
{if(responseObject.result){TB_show("Email sent",'#TB_inline?height=200&width=400&inlineId=deleteemailsent','',1);}else{var errorBox=$('userDeleteError');new Fx.Slide(errorBox).hide();errorBox.setStyle('display','block');errorBox.getChildren('span').set('html',responseObject.error);errorBox.slideIn();}}}).send();},userActionDelete:function(action_id)
{var bind=this;var request=new Request.JSON({'url':this.options.ajaxURL,'method':this.options.ajaxMethod,'secure':this.options.ajaxSecure,'data':{'task':'action_delete','action_id':action_id},'onComplete':function(responseObject,responseText)
{if($('action_'+action_id))
{$('action_'+action_id).style.display='none';total_actions--;if(total_actions==0)
$('actions').style.display="none";}}}).send();},userNotifyShow:function()
{this.user_notify_cookie=new Hash.Cookie('se_show_newupdates',{duration:3600});var minimizedCount=parseInt(this.user_notify_cookie.get('total'));if(!$type(minimizedCount))minimizedCount=0;if(minimizedCount<this.user_notify_count)
{this.user_notify_cookie.set('total',0);$('newupdates').style.display='block';$('newupdates').fade('in');}},userNotifyPopup:function()
{TB_show(this.Base.Language.Translate(1198),'#TB_inline?height=150&width=300&inlineId=newupdates_popup','',1);},userNotifyUpdate:function()
{var bind=this;var request=new Request.JSON({'url':this.options.ajaxURL,'method':this.options.ajaxMethod,'secure':this.options.ajaxSecure,'data':{'task':'notify_get'},'onComplete':function(responseObject,responseText)
{bind.userNotifyGenerate(responseObject);bind.userNotifyShow();}}).send();},userNotifyGenerate:function(notifyData)
{if(!$type(notifyData.notifys)||notifyData.notifys.length==0||!$('newupdates_popup'))
{$('notify_total').innerHTML=this.user_notify_count=0;return;}
$('notify_total').innerHTML=this.user_notify_count=notifyData.total;var HTML="<div style='margin-top: 10px;'>"+
this.Base.Language.TranslateFormatted(1199,["<span id='notifyscount'>"+notifyData.total_grouped+"</span>"])+"</div>";notifyData.notifys.each(function(notify_info)
{HTML+="<div style='font-weight: bold; padding-top: 5px;' id='notify_"+notify_info.notifytype_id+"_"+notify_info.notify_grouped+"'>"+"<a href='javascript:void(0);' onClick=\"SocialEngine.Viewer.userNotifyDelete('"+notify_info.notifytype_id+"', '"+notify_info.notify_grouped+"');\">X</a>"+"<img src='./images/icons/"+notify_info.notify_icon+"' border='0' style='border: none; margin: 0px 5px 0px 5px; display: inline; vertical-align: middle;' class='icon' />"+"<a href='"+notify_info.notify_url+"'>"+notify_info.notify_text_output+"</a>"+"</div>";});$('newupdates_popup').innerHTML=HTML;},userNotifyDelete:function(notifytype_id,notify_grouped)
{var bind=this;var request=new Request.JSON({'url':this.options.ajaxURL,'method':this.options.ajaxMethod,'secure':this.options.ajaxSecure,'data':{'task':'notify_delete','notifytype_id':notifytype_id,'notify_grouped':notify_grouped},'onComplete':function(responseObject,responseText)
{$("TB_window").getElements('div[id=notify_'+notifytype_id+'_'+notify_grouped+']').each(function(el)
{if(el.id=='notify_'+notifytype_id+'_'+notify_grouped)
{el.style.display='none';bind.user_notify_count--;}});$('newupdates_popup').getElements('div[id=notify_'+notifytype_id+'_'+notify_grouped+']').each(function(el)
{if(el.id=='notify_'+notifytype_id+'_'+notify_grouped)
el.style.display='none';});$('notify_total').innerHTML=bind.user_notify_count;$("TB_window").getElements('span[id=notifyscount]').each(function(el)
{if(el.id=='notifyscount')el.innerHTML=bind.user_notify_count;});if(bind.user_notify_count==0)
{TB_remove();$('newupdates').style.display='none';}}}).send();},userNotifyHide:function()
{$('newupdates').fade('out');this.user_notify_cookie.set('total',this.user_notify_count)},userPhotoRemove:function()
{var bind=this;var request=new Request.JSON({'url':'user_editprofile_photo.php','method':this.options.ajaxMethod,'secure':this.options.ajaxSecure,'data':{'task':'remove'}}).send();if($('userEditRemovePhotoLink')&&$('userEditPhotoImg'))
{$('userEditRemovePhotoLink').destroy();$('userEditPhotoImg').set({width:'',height:'',src:'./images/no_avatar_m.jpg'});}
else
{window.location.reload(false);}},ImportUserInfo:function(user_info)
{if(!user_info||$type(user_info)!="object"||!user_info.user_exists)
{this.user_exists=false;return;}
this.user_exists=true;user_info.user_id=parseInt(user_info.user_id);delete user_info.user_exists;this.user_info=user_info;this.user_info.user_fname=this.user_info.user_fname.trim();this.user_info.user_lname=this.user_info.user_lname.trim();if(this.user_info.user_fname&&this.user_info.user_lname)
{if(this.options.displayname_order=="asian")
{this.user_displayname_short=this.user_info.user_lname;this.user_displayname=this.user_info.user_lname+' '+this.user_info.user_fname;}
else
{this.user_displayname_short=this.user_info.user_fname;this.user_displayname=this.user_info.user_fname+' '+this.user_info.user_lname;}}
else if(this.user_info.user_fname)
{this.user_displayname=this.user_displayname_short=this.user_info.user_fname;}
else if(this.user_info.user_lname)
{this.user_displayname=this.user_displayname_short=this.user_info.user_lname;}
else if(this.user_info.user_username)
{this.user_displayname=this.user_displayname_short=this.user_info.user_username;}}});
/* file=ratings.js */

SocialEngineAPI.RabidRatings=new Class({Implements:[Options],Base:{},options:{url:null,leftMargin:0,starWidth:10,starMargin:1,scale:5,snap:1},initialize:function(options){this.setOptions(options);var activeColor=this.options.activeColor;var votedColor=this.options.votedColor;var fillColor=this.options.fillColor;window.addEvent('domready',function(){$$('.rabidRating').each(this.setupElement.bind(this));}.bind(this));},setupElement:function(el){if(!Browser.Engine.trident4){el.id=el.getAttribute('id');el.wrapper=el.getElement('.rateHolder');el.textEl=el.getElement('.rateError');el.ratingText=el.getElement('.ratingText');el.offset=el.getPosition().x;el.fill=el.getElement('.ratingFill');el.starPercent=this.getStarPercent(el.id);el.ratableId=this.getRatableId(el.id);this.fillVote(el.starPercent,el);el.currentFill=this.getFillPercent(el.starPercent);el.morphFx=new Fx.Morph(el.fill,{'link':'chain'});el.widthFx=new Fx.Tween(el.fill,{property:'width',link:'chain'});if(this.Base.Viewer.user_exists){el.mouseCrap=function(e){var fill=e.client.x-el.offset;var fillPercent=this.getVotePercent(fill);var step;if(this.options.snap===0)step=1;else step=(100/this.options.scale)*this.options.snap;var nextStep=Math.floor(fillPercent/step)+1;this.fillVote(nextStep*step,el);}.bind(this);el.wrapper.addEvent('mouseenter',function(e){el.morphFx.start('.rabidRating .ratingActive');el.wrapper.addEvent('mousemove',el.mouseCrap);});el.wrapper.addEvent('mouseleave',function(e){el.removeEvent(el.mouseCrap);el.morphFx.start('.rabidRating .ratingFill');el.widthFx.start(el.currentFill);});el.wrapper.addEvent('click',function(e){el.currentFill=el.newFill;el.morphFx.start('.rabidRating .ratingVoted');el.wrapper.removeEvents();el.addClass('ratingVoted');el.textEl.addClass('loading');var votePercent=this.getVotePercent(el.newFill);if(this.options.url!=null){var req=new Request({url:this.options.url,onComplete:el.updateText}).post({vote:votePercent,id:el.ratableId});}}.bind(this));el.updateText=function(text){error=text.split('ERROR:')[1];el.textEl.removeClass('loading');if(error){el.showError(error);return false;}};el.showError=function(error){el.textEl.addClass('ratingError');oldTxt=el.textEl.get('text');el.textEl.set('text',error);(function(){el.textEl.set('text',oldTxt);el.textEl.removeClass('ratingError');}).delay(3000);};}}else{var plain=el.getElement('.ratingText').inject(el,'before');}},fillVote:function(percent,el){el.newFill=this.getFillPercent(percent);if(this.getVotePercent(el.newFill)>100){el.newFill=this.getFillPercent(100);}
el.fill.setStyle('width',el.newFill);},getStarPercent:function(id){var stars=id.match(/([^-]+)-(\d*\.?\d+)_(\d*\.?\d+)$/);var ratableId=stars[1];var score=stars[2].toFloat();var scale=stars[3].toFloat();var percent=(score/scale)*100;return percent;},getFillPercent:function(starPercent){return(starPercent/100)*((this.options.starWidth+this.options.starMargin)*this.options.scale)+this.options.leftMargin;},getVotePercent:function(divPosition){var starsWidth=(this.options.starWidth+this.options.starMargin)*this.options.scale;var offset=this.options.leftMargin;var starPosition=divPosition-this.options.leftMargin;var percent=(starPosition/starsWidth*100).round(2);return percent;},getRatableId:function(id){var stars=id.match(/([^-]+)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars[1];}});
