/*    HTTP Host:  static.ak.fbcdn.net                                          */
/*    Generated:  February 10th 2010 2:31:29 AM PST                            */
/*      Machine:  10.16.140.110                                                */
/*       Source:  Backing Store                                                */
/*     Location:  js/6ths6p5vlj40gkwc.pkg.js r142619                           */
/*       Locale:  id_ID                                                        */
/*         Path:  js/6ths6p5vlj40gkwc.pkg.js                                   */

if (window.CavalryLogger) { CavalryLogger.start_js(["js\/6ths6p5vlj40gkwc.pkg.js"]); }


function showCamera(camera_finder,camera_found){hide(ge(camera_finder));show(ge(camera_found));}
function enable_save(){var button=ge('save_camera_picture');if(button.disabled){CSS.toggleClass(button,'inputaux_disabled');CSS.toggleClass(button,'inputaux');button.removeAttribute('disabled');}}
function disable_save(){var button=ge('save_camera_picture');if(!button.getAttribute('disabled')){CSS.toggleClass(button,'inputaux_disabled');CSS.toggleClass(button,'inputaux');button.setAttribute('disabled','disabled');}}
function saveCameraPicture(movieName,args){var camera=document[movieName]||window[movieName];camera.renderPicture(args);}
function setShowCamera(){AsyncRequest.pingURI('/ajax/camera.php',{"show_cam":true},true);}
function setHideCamera(){AsyncRequest.pingURI('/ajax/camera.php',{"hide_cam":true},true);}
function setCameraDetected(){AsyncRequest.pingURI('/ajax/camera.php',{"cam_good":true},true);}
function setCameraNotDetected(){AsyncRequest.pingURI('/ajax/camera.php',{"cam_bad":true},true);}

function gifttags_source(){this.parent.construct(this);this.tag_type='keyword';this.tag_ver=1;}
gifttags_source.extend('static_source');gifttags_source.prototype.text_noinput='';gifttags_source.prototype.text_placeholder='Enter Keyword...';gifttags_source.tags={};gifttags_source.tags_index={};gifttags_source.is_building=false;gifttags_source.set_tags=function(tag_type,tags){gifttags_source.tags[tag_type]=tags;}
gifttags_source.async_set_tags=function(tag_type,tag_ver,on_response){if(!gifttags_source.is_building&&!gifttags_source.tags[tag_type]){var async_params={t:tag_type,v:tag_ver};gifttags_source.is_building=true;new AsyncRequest().setReadOnly(true).setMethod('GET').setURI('/ajax/typeahead_gifttags.php').setData(async_params).setHandler(function(response){gifttags_source.set_tags(tag_type,response.getPayload().tags);gifttags_source.is_building=false;if(on_response){on_response();}}).send();}};gifttags_source.prototype.cache_results=true;gifttags_source.prototype.set_tags=function(){var post_process=function(){this.values=gifttags_source.tags[this.tag_type];if(!gifttags_source.tags_index[this.tag_type]){this.build_index();gifttags_source.tags_index[this.tag_type]=this.index;}else{this.index=gifttags_source.tags_index[this.tag_type];this.ready();}}.bind(this);if(!gifttags_source.tags[this.tag_type]){gifttags_source.async_set_tags(this.tag_type,this.tag_ver,post_process);}else{post_process();}}
gifttags_source.prototype.gen_html=function(tag,highlight){var text=tag.tag_name;return['<div>',typeahead_source.highlight_found(tag.t,highlight),'</div><div><small>',text,'</small></div>'].join('');}
gifttags_source.prototype.search_value=function(text){if(!this.is_ready&&!gifttags_source.is_building){this.set_tags();}
return this.parent.search_value(text);}

function token(obj,tokenizer,caret){if(obj.is&&(tokenizer.count_names(obj.is)>tokenizer.max_selections)){(new contextual_dialog).set_context(tokenizer.obj).show_prompt(_tx("Tidak dapat menambahkan daftar."),_tx("Anda hanya bisa mengirimkan pesan pada 20 orang pada satu waktu.")).fade_out(500,1500);return null;}
this.tokenizer=tokenizer;this.element=document.createElement('a');CSS.setClass(this.element,'token');this.element.href='#';this.element.tabIndex=-1;this.element.onclick=function(event){return this._onclick(event?event:window.event)}.bind(this);this.element.onmousedown=function(event){(event?event:window.event).cancelBubble=true;return false};this.render_obj(obj);this.obj=obj;this.element.token=this;this.tokenizer.hide_inline_placeholder();caret?this.tokenizer.obj.insertBefore(this.element,caret):this.tokenizer.obj.appendChild(this.element);}
token.prototype.render_obj=function(obj){var inputs='';if(obj.np){var fb_protected='';}else{var fb_protected='fb_protected="true" ';}
if(obj.e){inputs=['<input type="hidden" ',fb_protected,'name="emails[]" value="',obj.e,'" />'].join('');}else if(obj.i){inputs=['<input type="hidden" ',fb_protected,'name="',this.tokenizer.obj.id,'[]" value="',obj.i,'" />'].join('');}else if(obj.is){for(var i=0,il=obj.is.length;i<il;i++){inputs+=['<input type="hidden" ',fb_protected,'name="',this.tokenizer.obj.id,'[]" value="',obj.is[i],'" />'].join('');}
this.explodable=true;this.n=obj.n;}
this.text=obj.t;this.element.innerHTML=['<span><span><span><span>',inputs,htmlspecialchars(obj.t),'<span onclick="this.parentNode.parentNode.parentNode.parentNode.parentNode.token.remove(true); event.cancelBubble=true; return false;" ','onmouseover="CSS.setClass(this, \'x_hover\');" onmouseout="CSS.setClass(this, \'x\');" class="x">&nbsp;</span>','</span></span></span></span>'].join('');this.obj=obj;}
token.prototype._onclick=function(event){var this_select_time=(new Date()).getTime();if(this.explodable&&this.tokenizer.last_select_time&&(this_select_time-this.tokenizer.last_select_time<1400)){var to_add=this.n;this.remove();var inputs=this.tokenizer.obj.getElementsByTagName('input');var already_ids={};for(var i=0;i<inputs.length;++i){if(inputs[i].name=='ids[]'){already_ids[inputs[i].value]=true;}}
for(var id in to_add){if(!already_ids[id]){new token({'t':to_add[id],'i':id},this.tokenizer);}}}else{this.select();}
this.tokenizer.last_select_time=this_select_time;event.cancelBubble=true;return false;}
token.prototype.select=function(again){if(this.tokenizer.selected_token&&!again){this.tokenizer.selected_token.deselect();}
CSS.setClass(this.element,trim(this.element.className.replace('token_selected',''))+' token_selected');this.tokenizer.tab_stop_ignore_focus=true;if(this.tokenizer.tab_stop.disabled){this.tokenizer.tab_stop.disabled=false;}
this.tokenizer.tab_stop.focus();this.tokenizer.selected_token=this;if(again!==true){setTimeout(function(){this.select(true)}.bind(this),0);}else{setTimeout(function(){this.tab_stop_ignore_focus=false}.bind(this.tokenizer),0);}}
token.prototype.remove=function(focus){this.element.parentNode.removeChild(this.element);this.element.token=null;this.tokenizer.selected_token=null;if(focus){this.tokenizer._onmousedown();}
if(this.obj){this.tokenizer._ontokenremoved(this.obj);}}
token.prototype.deselect=function(){CSS.setClass(this.element,trim(this.element.className.replace('token_selected','')));this.tokenizer.selected_token=null;}

function tokenizer_input(tokenizer,caret){if(!tokenizer_input.hacks){tokenizer_input.should_use_borderless_hack=ua.safari();tokenizer_input.should_use_shadow_hack=ua.ie()<8||ua.opera();tokenizer_input.hacks=true;}
this.tokenizer=tokenizer;tokenizer.tokenizer_input=this;this.obj=document.createElement('input');this.obj.input=this;this.obj.tabIndex=-1;this.obj.size=1;this.obj.onmousedown=function(event){(event?event:window.event).cancelBubble=true}.bind(this);this.shadow=document.createElement('span');CSS.setClass(this.shadow,'tokenizer_input_shadow');this.element=document.createElement('div');CSS.setClass(this.element,'tokenizer_input'+(tokenizer_input.should_use_borderless_hack?' tokenizer_input_borderless':''));this.element.appendChild(document.createElement('div'));this.element.firstChild.appendChild(this.obj);var root=(tokenizer_input.should_use_shadow_hack?DOM.getRootElement():this.element.firstChild);root.appendChild(this.shadow);caret?tokenizer.obj.insertBefore(this.element,caret):tokenizer.obj.appendChild(this.element);this.tokenizer.tab_stop.disabled=true;this.update_shadow();this.update_shadow=this.update_shadow.bind(this);this.tokenizer.inputs.push(this);this.parent.construct(this,this.obj,this.tokenizer.typeahead_source);if(this.focused){this.focus();this.obj.select();}
copy_properties(this,tokenizer.properties||{});setInterval(this.update_shadow.bind(this),100);}
tokenizer_input.extend('typeaheadpro');tokenizer_input.prototype.gen_nomatch=tokenizer_input.prototype.gen_loading=tokenizer_input.prototype.gen_placeholder=tokenizer_input.prototype.gen_noinput='';tokenizer_input.prototype.max_display=8;tokenizer_input.prototype.setup_anchor=function(){return this.tokenizer.obj;}
tokenizer_input.prototype.update_shadow=function(){if(this.obj===null){return;}
try{var val=this.obj.value;}catch(e){return};if(this.shadow_input!=val){this.shadow.innerHTML=htmlspecialchars((this.shadow_input=val)+'^_^');if(tokenizer_input.should_use_shadow_hack){this.obj.style.width=this.shadow.offsetWidth+'px';this.obj.value=val;}}}
tokenizer_input.prototype._onblur=function(){if(this.parent._onblur()===false){return false;}
if(this.changed&&!this.interactive){this.dirty_results();this.changed=false;return;}
if(this.changed||this.interactive){this.select_suggestion(this.selectedindex);}
setTimeout(function(){this.disabled=false}.bind(this.tokenizer.tab_stop),1000);this.tokenizer.show_inline_placeholder();tokenizerToDestroy=this;setTimeout(function(){tokenizerToDestroy.destroy();},0);}
tokenizer_input.prototype._onfocus=function(){this.tokenizer.tab_stop.disabled=true;this.parent._onfocus();this.tokenizer.hide_inline_placeholder();return true;}
tokenizer_input.prototype._onkeydown=function(event){switch(event.keyCode){case 13:break;case 37:case 8:if(this.get_selection_start()!=0||this.obj.value!=''){break;}
var prev=this.element.previousSibling;if(prev&&prev.token){setTimeout(prev.token.select.bind(prev.token),0);}
break;case 39:case 46:if(this.get_selection_start()!=this.obj.value.length){break;}
var next=this.element.nextSibling;if(next&&next.token){setTimeout(next.token.select.bind(next.token),0);}
break;case 188:this._onkeydown({keyCode:13});return false;case 9:if(this.obj.value){this.advance_focus();this._onkeydown({keyCode:13});return false;}else if(!event.shiftKey){this.advance_focus();this.parent._onkeydown(event);return false;}
break;}
return this.parent._onkeydown(event);}
tokenizer_input.prototype._onkeypress=function(event){switch(event.keyCode){case 9:return false;}
setTimeout(this.update_shadow,0);return this.parent._onkeypress(event);}
tokenizer_input.prototype.select_suggestion=function(index){if(this.suggestions&&index>=0&&this.suggestions.length>index){var inputs=this.tokenizer.obj.getElementsByTagName('input');var id=this.suggestions[index].i;for(i=0;i<inputs.length;i++){if(inputs[i].name=='ids[]'&&inputs[i].value==id){return false;}}}
return this.parent.select_suggestion(index);}
tokenizer_input.prototype.get_selection_start=function(){if(this.obj.selectionStart!=undefined){return this.obj.selectionStart;}else{return Math.abs(document.selection.createRange().moveStart('character',-1024));}}
tokenizer_input.prototype.onselect=function(obj){if(obj){var inputs=this.tokenizer.obj.getElementsByTagName('input');for(i=0;i<inputs.length;i++){if(inputs[i].name=='ids[]'&&inputs[i].value==obj.i){return false;}}
new token(obj,this.tokenizer,this.element);this.clear();if(this.tokenizer.max_selections<=this.tokenizer.count_names()){this.destroy.bind(this).defer();}}
if(obj){this.tokenizer._ontokenadded(obj);}
this.tokenizer.typeahead_source.onselect_not_found.call(this);return false;}
tokenizer_input.prototype._onsubmit=function(){return false;}
tokenizer_input.prototype.capture_submit=function(){return false;}
tokenizer_input.prototype.clear=function(){this.parent.clear();this.update_shadow();}
tokenizer_input.prototype.destroy=function(){this.parent.destroy();if(this.shadow&&tokenizer_input.should_use_shadow_hack){DOM.remove(this.shadow);}
if(this.element){DOM.remove(this.element);}
if(this.tokenizer){var index=this.tokenizer.inputs.indexOf(this);if(index!=-1){this.tokenizer.inputs.splice(index,1);}}
this.tokenizer=this.element=this.shadow=null;return null;}

function tokenizer(obj,typeahead_source,nofocus,max_selections,properties){if(ua.safari()<500){tokenizer.valid_arrow_count=0;tokenizer.valid_arrow_event=function(){return tokenizer.valid_arrow_count++%2==0};}else{tokenizer.valid_arrow_event=function(){return true};}
this.obj=obj;this.obj.tokenizer=this;this.typeahead_source=typeahead_source;while(!/\btokenizer\b/.test(this.obj.className)){this.obj=this.obj.parentNode;}
this.tab_stop=this.obj.getElementsByTagName('input')[0];this.inputs=[];this.obj.onmousedown=function(event){return this._onmousedown(event?event:window.event)}.bind(this);this.tab_stop.onfocus=function(event){return this._onfocus(event?event:window.event)}.bind(this);this.tab_stop.onblur=function(event){return this.tab_stop_onblur(event?event:window.event)}.bind(this);this.tab_stop.onkeydown=function(event){return this.tab_stop_onkeydown(event?event:window.event)}.bind(this);if(!nofocus&&elementY(this.obj)>0&&this.obj.offsetWidth){this._onfocus();}
this.max_selections=max_selections;copy_properties(this,properties||{});this.properties=properties;if(this.inline_placeholder_text){this.init_inline_placeholder();}}
tokenizer.is_empty=function(obj){if(CSS.hasClass(obj,'tokenizer_locked')){return obj.getElementsByTagName('input').length==0;}else{return(!obj.tokenizer||obj.tokenizer.count_names()==0);}}
tokenizer.prototype.get_token_values=function(){var r=[];var inputs=this.obj.getElementsByTagName('input');for(var i=0;i<inputs.length;++i){if(inputs[i].name&&inputs[i].value){r.push(inputs[i].value);}}
return r;}
tokenizer.prototype.get_token_strings=function(){var r=[];var tokens=this.obj.getElementsByTagName('a');for(var i=0;i<tokens.length;++i){if(typeof tokens[i].token!='undefined'){r.push(tokens[i].token.text);}}
return r;}
tokenizer.prototype.clear=function(){var tokens=this.obj.getElementsByTagName('a');for(var i=tokens.length-1;i>=0;--i){if(typeof tokens[i].token!='undefined'){tokens[i].token.remove();}}}
tokenizer.prototype.clear_current_input=function(){this.tokenizer_input.clear();}
tokenizer.prototype._onmousedown=function(event){if(this.onfocus){this.onfocus();}
setTimeout(function(){if(!this.inputs.length){if(this.max_selections>this.count_names()){new tokenizer_input(this);}else{var tokens=this.obj.getElementsByTagName('a');for(var i=tokens.length-1;i>=0;i--){if(typeof tokens[i].token!='undefined'){tokens[i].token.select();break;}}}}else{this.inputs[0].focus();}}.bind(this),0);event?event.cancelBubble=true:false;return false;}
tokenizer.prototype._onfocus=function(event){if(this.tab_stop_ignore_focus){this.tab_stop_ignore_focus=false;return;}
this._onmousedown();}
tokenizer.prototype.tab_stop_onblur=function(event){this.selected_token?this.selected_token.deselect():false;}
tokenizer.prototype.tab_stop_onkeydown=function(event){if(!event.keyCode||!this.selected_token){return;}
switch(event.keyCode){case 8:case 46:var tok=this.selected_token;var prev=tok.element.previousSibling;if(prev&&prev.input){prev.input.element.focus();}else{new tokenizer_input(this,tok.element);}
tok.remove();return false;case 37:if(!tokenizer.valid_arrow_event()){break;}
var tok=this.selected_token;var prev=tok.element.previousSibling;if(prev&&prev.input){prev.input.element.focus();}else if(this.max_selections>this.count_names()){new tokenizer_input(this,tok.element);}else{return false;}
tok.deselect();return false;case 39:if(!tokenizer.valid_arrow_event()){break;}
var tok=this.selected_token;var next=tok.element.nextSibling;if(next&&next.input){next.input.focus();}else if(this.max_selections>this.count_names()){new tokenizer_input(this,tok.element.nextSibling);}else{return false;}
tok.deselect();return false;}}
tokenizer.prototype.count_names=function(plus){var inputs=this.obj.getElementsByTagName('input');var uniq={};var count=0;for(var i=0;i<inputs.length;i++){if(inputs[i].type=='hidden'&&!uniq[inputs[i].value]){uniq[inputs[i].value]=true;++count;}}
if(plus){for(var j=0;j<plus.length;j++){if(!uniq[plus[j]]){uniq[plus[j]]=true;++count;}}}
return count;}
tokenizer.prototype.disable=function(){this.tab_stop.parentNode.removeChild(this.tab_stop);this.obj.className+=' tokenizer_locked';}
tokenizer.prototype._ontokenadded=function(obj){if(this.ontokenadded){this.ontokenadded.call(this,obj);}}
tokenizer.prototype._ontokenremoved=function(obj){if(this.ontokenremoved){this.ontokenremoved.call(this,obj);}}
tokenizer.prototype._ontokennotfound=function(text){if(this.ontokennotfound){this.ontokennotfound.call(this,text);}}
tokenizer.prototype.init_inline_placeholder=function(){if(this.inline_placeholder){return;}
var placeholder=$N('span',{className:'inline_placeholder'},this.inline_placeholder_text);if(!tokenizer.is_empty(this.obj)){placeholder.setStyle('display','none');}
this.obj.appendChild(placeholder);this.inline_placeholder=placeholder;}
tokenizer.prototype.show_inline_placeholder=function(){if(this.inline_placeholder&&tokenizer.is_empty(this.obj)){show(this.inline_placeholder);}}
tokenizer.prototype.hide_inline_placeholder=function(){if(this.inline_placeholder&&shown(this.inline_placeholder)){hide(this.inline_placeholder);}}

function ProfileComposerController(root,id,apps,this_is_me,feedwall,max_displayed_composers,endpoint){this.tabs=[];for(var i=0;i<apps.length;i++){var obj=$('composer_'+apps[i]);obj.listen('click',this.onclick.bind(this,i));obj.find('a').listen('click',this.onclick.bind(this,i));this.tabs.push(obj);var obj_menu=ge('composer_'+apps[i]+'_menu');if(obj_menu){obj_menu.listen('click',this.onclick.bind(this,i));}}
var more_menu=ge('compose_more_container');if(more_menu){dropmenu(more_menu).registerHTMLMenu('composer_dropdown').setPosition(dropmenu.ALIGN_LEFT).addHook('show',function(){CSS.addClass(more_menu,'selected');}.bind(this)).addHook('hide',function(){CSS.removeClass(more_menu,'selected');}.bind(this));}
this.id=id;this.this_is_me=this_is_me
this.canvas=$('composer_canvas');this.root=root;this.composer_tabs=DOM.find(root,'div.composer_tabs');this.endpoint=endpoint||'/ajax/profile/composer.php';var composers=[];this.tab_in_menu={};for(var i=0;i<apps.length;i++){composers.push({app_id:apps[i],node:$('composer_content_'+apps[i]),submit_button:ge(apps[i]+'_publish_button'),comment_text:ge(apps[i]+'_comment_text')});this.tab_in_menu[i]=(i>=max_displayed_composers)?true:false;}
this.composers=composers;this.feedwall=feedwall;if(composers.length>max_displayed_composers){this.last_displayed=this.replace_index=max_displayed_composers-1;}
if(composers.length){this.current=0;}else{this.current=-1;}
ProfileComposerController.instance=this;this.registerTransitionHandler();}
ProfileComposerController.prototype.getComposer=function(app_id){var i=this.getAppIndex(app_id);if(this.composers[i]){return this.composers[i].controller;}}
ProfileComposerController.prototype.showFirst=function(app_id){var i=this.getAppIndex(app_id);if(i>this.last_displayed){this.swapInMenuSelection(i);}
this._showAppAtIndex(i);}
ProfileComposerController.prototype._showAppAtIndex=function(i){hide(this.composers[this.current].node);CSS.removeClass(this.tabs[this.current],'selected');CSS.addClass(this.tabs[i],'selected');this.current=i;show(this.composers[i].node);if(this.composers[i].controller){this.composers[i].controller.onshow();}
var message={sender:this,app_id:this.composers[i].app_id};Arbiter.inform.bind(this,Arbiter.PROFILE_PUBLISHER,message).defer(100);}
ProfileComposerController.prototype.swapInMenuSelection=function(i){CSS.addClass('composer_'+this.composers[this.replace_index]['app_id'],'hidden_elem');CSS.removeClass('composer_'+this.composers[this.replace_index]['app_id']+'_menu','hidden_elem');this.tab_in_menu[this.replace_index]=true;CSS.removeClass('composer_'+this.composers[i]['app_id'],'hidden_elem');CSS.addClass('composer_'+this.composers[i]['app_id']+'_menu','hidden_elem');this.tab_in_menu[i]=false;this.replace_index=i;}
ProfileComposerController.prototype.getAppIndex=function(app_id){var index=-1;for(var i=0;i<this.composers.length;i++){if(this.composers[i].app_id==app_id){index=i;break;}}
return index;}
ProfileComposerController.prototype.handleSwap=function(uri){var query=uri.getQueryData();var app=query.pub;var i=this.getAppIndex(app);if(ProfileURIController.isDestinationURIProfilePage(uri)&&app){if(!this.this_is_me){search_log_2nd_action('Click tab:'+"application_"+app);}
var prevComposerHeight=$('profile_composer').offsetHeight;if(this.tab_in_menu[i]){this.swapInMenuSelection(i);}
this._showAppAtIndex(i);if(ge('profile_tutorial_callout_wall_filters')){var composerHeightAdjustment=$('profile_composer').offsetHeight-prevComposerHeight;$('profile_tutorial_callout_wall_filters').style.top=($('profile_tutorial_callout_wall_filters').offsetTop+composerHeightAdjustment)+'px';}
PageTransitions.transitionComplete();return true;}
return false;}
ProfileComposerController.prototype.swapComposers=function(i){if(i==this.current){return false;}
var params={pub:this.composers[i].app_id};PageTransitions.go(URI.getRequestURI().addQueryData(params),true);}
ProfileComposerController.prototype.onclick=function(i,event){this.swapComposers(i);if(event){event.kill();}
return false;}
ProfileComposerController.prototype.showComposerError=function(response){var showError=function(showMsg){(new ErrorDialog()).showError(response.getPayload().errorTitle,showMsg?(response.getPayload().errorMessage):_tx("Terjadi kesalahan aplikasi. Silakan coba beberapa saat lagi."));}
var err=response.getError();if(err){switch(err){case kError_Platform_CallbackValidationFailure:showError(true);break;case kError_Platform_ApplicationResponseInvalid:showError(response.getPayload().showDebug);break;default:ErrorDialog.showAsyncError(response);break;}}}
ProfileComposerController.prototype.onsubmitResponseOrError=function(button,response){var addFeedWallRow=true;var currentComposer=this.composers[this.current];var err=response.getError();var isWarning=response.getErrorIsWarning();if(err){this.showComposerError(response);if(!isWarning){addFeedWallRow=false;}}
if(addFeedWallRow){var newStory=null;if(currentComposer&&currentComposer.controller&&currentComposer.controller.onsubmitResponse){newStory=currentComposer.controller.onsubmitResponse(button,response);}else{newStory=response.getPayload();}
if(newStory){this.insertNewStory(newStory);}}
if(currentComposer&&!err){if(currentComposer.comment_text){currentComposer.comment_text.value='';}
if(currentComposer.controller){currentComposer.controller.reset(button);}}}
ProfileComposerController.prototype.onsubmitResponse=function(button,response){var currentComposer=this.composers[this.current];var payload=null;if(currentComposer&&currentComposer.controller&&currentComposer.controller.onsubmitResponse){payload=currentComposer.controller.onsubmitResponse(button,response);}else{payload=response.getPayload();}
this.insertNewStory(payload);if(currentComposer){if(currentComposer.comment_text){currentComposer.comment_text.value='';}
if(currentComposer.controller){currentComposer.controller.reset(button);}}}
ProfileComposerController.prototype.insertNewStory=function(payload){var today,todayDisplay,newStory,firstDivider,addDateDivider;if(payload.story){newStory=payload.story;today=payload.today;todayDisplay=payload.today_display;}else{newStory=payload;}
if(newStory){var firstStory=this.feedwall.firstChild();if(today&&todayDisplay&&(!firstStory||firstStory.story_time<today)){addDateDivider=true;var feedwallElem=this.feedwall.wall;firstDivider=DOM.scry(feedwallElem,'div.date_divider.first')[0];}
var story_html=HTML(newStory);var storyElem=story_html.getNodes()[0];var post=new FeedWallPost(this.feedwall,storyElem);this.feedwall.insertPost(post,firstStory,false,firstDivider);if(addDateDivider){var div=document.createElement('div');set_inner_html(div,todayDisplay);if(firstDivider){firstDivider.removeClass('first');}
DOM.insertBefore(div,storyElem);CSS.addClass(div,'date_divider first');}
if(!firstStory&&ge('profile_empty_wall')){CSS.addClass($('profile_empty_wall'),'hidden');}
story_html.getAction()();}}
ProfileComposerController.prototype.onafterSubmit=function(button,response){var err;if(response){err=response.getError();}
var button_state=(err!=kError_RestrictionMessage_Featureblock);this.setComposerSubmitButtonState(button_state);if(this.composers[this.current].comment_text){this.composers[this.current].comment_text.disabled=false;}
CSS.removeClass(this.root,'disabled');if(!err){this.onclick(0);}}
ProfileComposerController.prototype.onsubmit=function(button,event){var data={id:this.id,action:'post',button:button}
var currentComposer=this.composers[this.current];var comment_text=currentComposer.comment_text;data.app_id=currentComposer.app_id;data.app_data=serialize_form(currentComposer.node);data.comment_text='';if(comment_text&&comment_text.getControl){data.comment_text=trim(comment_text.getControl().getValue());}
if((data.app_id==2719290516)&&(data.comment_text==''||data.comment_text==null)){animation($('2719290516_comment_text')).from('background','#ffcccc').to('background','#fff').duration(120).go();return false;}
this.setComposerSubmitButtonState(false);currentComposer.submit_button.blur();new AsyncRequest().setURI(this.endpoint).setData(data).setContextData('clicktype',"application_"+data.app_id,!this.this_is_me).setHandler(this.onsubmitResponseOrError.bind(this,button)).setErrorHandler(this.onsubmitResponseOrError.bind(this,button)).setFinallyHandler(this.onafterSubmit.bind(this,button)).send();if(comment_text){comment_text.disabled=true;}
CSS.addClass(this.root,'disabled');}
ProfileComposerController.prototype.setComposerSubmitButtonState=function(enabled){return this._setSubmitButtonState(this.composers[this.current].submit_button,enabled);}
ProfileComposerController.prototype._setSubmitButtonState=function(button,enabled){if(!button)return;button.disabled=!enabled;CSS[enabled?'removeClass':'addClass'](button,'disabled_button');}
ProfileComposerController.getInstance=function(){return ProfileComposerController.instance;}
ProfileComposerController.prototype.registerController=function(app_id,instance){var i=this.getAppIndex(app_id);this.composers[i].controller=instance;instance.commentText=this.composers[i].comment_text;instance.publishButton=$(app_id+'_publish_button');instance.publishButton.onclick=instance.onsubmit.bind(instance,'publish_button');if(this.current==i){instance.onshow();}}
ProfileComposerController.prototype.registerTransitionHandler=function(){PageTransitions.registerHandler(bind(this,'handleSwap'));}
ProfileComposerController.prototype.blockCurrentComposerHelper=function(){var composer=this.composers[this.current];hide('composer_'+composer.app_id);this.swapComposers(0);}
ProfileComposerController.prototype.blockCurrentComposer=function(app_name){var composer=this.composers[this.current];EditAppSettings.setup(composer.app_id).killComposerDialog(app_name,composer.controller.getRemoveLink(),this.blockCurrentComposerHelper.bind(this));}
function ProfileComposer(app_id,root){this.root=root;this.app_id=app_id;this.profileComposerController=ProfileComposerController.getInstance();this.profileComposerController.registerController(app_id,this);}
ProfileComposer.prototype.onshow=bagofholding;ProfileComposer.prototype.onsubmit=function(button,event){this.profileComposerController.onsubmit(button,event);}
ProfileComposer.prototype.reset=function(button){if(this.commentText&&this.commentText.getControl){this.commentText.getControl().setValue('');}}
ProfileComposer.prototype.insertNewStory=function(storyPayload){this.profileComposerController.insertNewStory(storyPayload);}
function ProfileComposerStatus(app_id,root,profile_id){this.parent.construct(this,app_id,root);this.statusEditor=new ProfileStatusEditor(root,profile_id,this);}
ProfileComposerStatus.extend('ProfileComposer');ProfileComposerStatus.prototype.onsubmit=function(){this.statusEditor.post();}
ProfileComposerStatus.prototype.startEditFromValue=function(value){var index=this.profileComposerController.getAppIndex(2915120374);if(index<0){return false;}
this.profileComposerController.onclick(index);this.statusEditor.startEdit(value);}
function ProfileStatusEditor(root,profile_id,composer){this.parent.construct(this,root,profile_id);this.composer=composer;return this;}
ProfileStatusEditor.extend('StatusEditor');ProfileStatusEditor.clear=function(){if(profileComposerStatus){profileComposerStatus.statusEditor.clear();}}
ProfileStatusEditor.edit=function(status_text){if(profileComposerStatus){profileComposerStatus.startEditFromValue(status_text);}}
ProfileStatusEditor.prototype.onkeypress=function(event){if(event_get_keypress_keycode(event)==KEYS.RETURN){this.post({test_name:'INLINE_STATUS_EDITOR',action:'COMPOSER_UPDATE'});return $E(event).kill();}}
ProfileStatusEditor.prototype._onCleared=function(){var ps=ge('profile_status');if(ps){animation(ps).to('opacity',0).from(1).hide().duration(200).go();}}
ProfileStatusEditor.prototype._onPosted=function(payload){var feedwall=this.composer.profileComposerController.feedwall;this.composer.insertNewStory(payload);var ps=ge('profile_status');if(ps){ps.style.display='none';var status_text=$('status_text');status_text.onclick=this.startEdit.bind(this,payload.status);set_inner_html(status_text,payload.markup);set_inner_html($('status_time_inner'),_tx("beberapa saat yang lalu"));animation(ps).to('opacity',1).from(0).duration(200).go();ps.style.display='inline';if(ge('status_source')){CSS.addClass($('status_source'),'hidden_elem');}
if(ge('status_mobile_indicator')){CSS.addClass($('status_mobile_indicator'),'hidden_elem');}}}
function ProfileComposerVideo(app_id,root,tos_agreed,popup_uri){this.parent.construct(this,app_id,root);this.tabs=[];var tabAnchors=DOM.scry(root,'a');for(var i=0;i<tabAnchors.length;i++){tabAnchors[i].listen('click',this.selectTab.bind(this,i));this.tabs.push(tabAnchors[i].parentNode);}
this.tabContent=DOM.find(root,'div.well_content').childNodes;this.currentTab=0;this.popup_uri=popup_uri;this.tos_agreed=tos_agreed;this.pane='record';this.record_pane=ge('video_composer_record_pane');this.upload_pane=ge('video_composer_upload_pane');this.publish_button=root.getElementsByTagName('input')[1];divs=root.getElementsByTagName('div');this.footer=divs[divs.length-1];e=document.createElement('input');e.type='hidden';e.name='composer_video_id';e.value=null;root.appendChild(e);this.video_id_input=e;ProfileComposerVideo.activeInstance=this;}
ProfileComposerVideo.extend('ProfileComposer');ProfileComposerVideo.prototype.fvrAutoSave=function(fvr_data){this.video_id_input.value=fvr_data['video_id'];this.profileComposerController.setComposerSubmitButtonState(true);};ProfileComposerVideo.prototype.selectTab=function(tab){for(var i=0;i<this.tabs.length;i++){CSS[i==tab?'addClass':'removeClass'](this.tabs[i],'selected');(i==tab?show:hide)(this.tabContent[i]);}
this.currentTab=tab;if(this.currentTab!=0){this.video_id_input.value=null;this.profileComposerController.setComposerSubmitButtonState(false);}
return false;}
ProfileComposerVideo.prototype.doUploadValidate=function(){$('upload_button').disabled=true;this.upload_form=DOM.find(this.upload_pane,'form');var afterTosAgreed=function(){file_input=$('file_baby');if(!video_extension_is_valid(file_input.value)){video_show_extension_error(video_extensions_info);this.reset();return;}
new AsyncRequest().setURI('/ajax/motion_upload.php').setData({action:'get_id',enable_process_notification:1}).setHandler((function(response){var upload_data=response.getPayload();$('video_ptoken').value=$('video_id').value=upload_data.video_id;this.upload_form.action=URI(this.upload_form.action).addQueryData({'v':upload_data.video_id});this.doUpload();}).bind(this)).send();}.bind(this)
if(!this.tos_agreed){var tos_header=_tx("Ketentuan Layanan");var agree=_tx("Setuju");var dont_agree=_tx("Tidak Setuju");var dialog=new Dialog().setTitle(tos_header).setBody(window.video_upload_tos).setButtons([{name:'agree',label:agree,handler:function(button){new AsyncRequest().setURI('/ajax/motion_upload.php').setData({action:'obey'}).setHandler(function(response){this.tos_agreed=true;afterTosAgreed();}.bind(this)).send();}.bind(this)},{name:'dont_agree',label:dont_agree,handler:function(button){this.reset();}.bind(this)}]).show();return;}
afterTosAgreed();};ProfileComposerVideo.prototype.doUpload=function(){this.popup_uri=URI(this.popup_uri).addQueryData({'video_id':$('video_id').value});this.upload_popup=window.open(this.popup_uri,'video_upload_popup_'+gen_unique(),'directories=no,height=225,width=550,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');if(!this.upload_popup){new Dialog().setTitle(_tx("Apakah anda menggunakan pemblok pop-up?")).setBody(_tx("Untuk mengunggah video ke profil Anda, Facebook perlu menciptakan jendela pop-up. Harap matikan pemblokir pop-up Anda atau izinkan halaman ini menciptakan pop-up, lalu coba lagi.")).setButtons([Dialog.OK]).show();this.reset(true);return false;}
this.upload_popup_ready=function(iframe_name){this.upload_form.target=iframe_name;this.upload_form.submit();this.reset();this.upload_popup.start_progress_loop();}};ProfileComposerVideo.prototype.reset=function(dont_clear_file_input){this.profileComposerController.setComposerSubmitButtonState(false);this.video_id_input.value=null;if(ge('file_baby')&&!dont_clear_file_input){$('file_baby').value='';}
if(ge('upload_button')){$('upload_button').disabled=false;}};ProfileComposerVideo.prototype.onshow=function(){this.profileComposerController.setComposerSubmitButtonState(false);}
function ProfileComposerPhotos(app_id,root,tabs,camera_id){this.parent.construct(this,app_id,root);this.camera=document[camera_id]||window[camera_id];this.albumName=ge('photos_composer_album_name');if(this.albumName){this.albumName.onkeyup=this.enableSubmit.bind(this,this.albumName);}
this.albumDesc=ge('photos_composer_album_desc');this.postComment=ge('photos_composer_post_comment');if(this.postComment){this.postCommentPlaceholder=this.postComment.value;this.postCommentPlaceholder=this.postComment.value;}
this.postFile=ge('photos_composer_post_file');if(this.postFile){this.postFile.onchange=this.enableSubmit.bind(this,this.postFile);}
if(this.commentText){this.postCommentPlaceholder=this.commentText.value;}
this.currentTab=tabs[0];(new ProfileWellDisplay(DOM.find(root,'div.composer_well'))).onselect=function(tab){this.currentTab=tabs[tab];this.reset();}.bind(this);ProfileComposerPhotos.instance=this;};ProfileComposerPhotos.extend('ProfileComposer');ProfileComposerPhotos.getInstance=function(){if(!ProfileComposerPhotos.instance){console.error('No ProfileComposerPhotos exists');}else{return this.instance;}}
ProfileComposerPhotos.prototype.onshow=function(){this.profileComposerController.setComposerSubmitButtonState(false);}
ProfileComposerPhotos.prototype.onsubmit=function(){if(!this.this_is_me){search_log_2nd_action('application_'+this.app_id);}
if(this.currentTab=='webcam'){var form_data=serialize_form(DOM.find(this.root,'form.camera'));form_data['comment']=this.commentText.getControl&&this.commentText.getControl().getValue();this.camera.renderPicture(form_data);return false;}else if(this.currentTab=='album'){DOM.find(this.root,'form.createalbum').submit();}else if(this.currentTab=='post'){if(this.postComment){if(!this.postComment.getControl||this.postComment.getControl().isEmpty()){this.postComment.value='';}}
DOM.find(this.root,'form.uploadphoto').submit();}
return false;}
ProfileComposerPhotos.prototype.uploadOnerror=function(error){this.reset();}
ProfileComposerPhotos.prototype.uploadOndone=function(story){(function(){this.insertNewStory(story);}).bind(this).defer();this.reset();}
ProfileComposerPhotos.prototype.enableSubmit=function(elt){if(elt){if(elt.value){this.profileComposerController.setComposerSubmitButtonState(true);}else{this.profileComposerController.setComposerSubmitButtonState(false);}}}
ProfileComposerPhotos.prototype.reenable=function(){this.profileComposerController.setComposerSubmitButtonState(true);}
ProfileComposerPhotos.prototype.reset=function(){if(this.albumName){this.albumName.value='';}
if(this.albumDesc){this.albumDesc.value='';}
if(this.postComment){this.postComment.value=this.postCommentPlaceholder;}
if(this.postFile){this.postFile.value='';}
if(this.commentText){this.commentText.value=this.postCommentPlaceholder;}
if(this.camera&&this.camera.reset){this.camera.reset();}
this.profileComposerController.setComposerSubmitButtonState(false);}
function ProfileComposerShare(app_id,root){this.parent.construct(this,app_id,root);this.prompt=root.childNodes[0];var inputs=this.prompt.getElementsByTagName('input');this.urlInput=inputs[0];this.urlInput.onkeypress=function(event){if(event_get_keypress_keycode(event)==KEYS.RETURN){this.previewButton.onclick();return false;}}.bind(this);this.previewButton=inputs[1];this.previewButton.onclick=function(){this.previewShare.bind(this).defer();}.bind(this);this.contentArea=root.childNodes[1];this.removeLink=this.contentArea.getElementsByTagName('a')[0];this.removeLink.onclick=function(){this.reset();return false;}.bind(this);this.previewStage=this.contentArea.childNodes[1];this.commentEtc=this.publishButton.parentNode;};ProfileComposerShare.extend('ProfileComposer');ProfileComposerShare.prototype.previewShare=function(){var errorCallback=function(response){ErrorDialog.showAsyncError(response);this.reset();}.bind(this);this.attachment=ComposerAttachment.newFromURL(this.urlInput.value,errorCallback);this.urlInput.blur();hide(this.prompt);show(this.contentArea);this.attachment.containerReady(this.previewStage.firstChild,true);}
ProfileComposerShare.prototype.reset=function(){this.parent.reset();this.urlInput.value='';this.commentText.blur();show(this.prompt);hide(this.contentArea);this.attachment=null;this.previewStage.firstChild.innerHTML='';}
function ProfileComposerNotes(app_id,root){this.parent.construct(this,app_id,root);this.addPhotosLink=DOM.find(root,'a.add_photos');this.addPhotosLink.onclick=this.profileComposerController.onsubmit.bind(this.profileComposerController,'add_photos');this.title=DOM.find(root,'input.note_title');this.noteContent=DOM.find(root,'textarea.note_content');this.inThisNoteRow=DOM.find(root,'tr.in_this_note_row');this.inThisNoteTokenizer=DOM.find(this.inThisNoteRow,'div.tokenizer').tokenizer;this.privacyRow=DOM.find(root,'tr.privacy_row');this.advancedLink=DOM.find(root,'a.advanced_options');this.advancedLink.onclick=function(){hide(this.advancedLink);show(this.addPhotosLink);show(this.inThisNoteRow);show(this.privacyRow);}.bind(this);};ProfileComposerNotes.extend('ProfileComposer');ProfileComposerNotes.prototype.onsubmitResponse=function(button,response){var payload=response.getPayload();if('add_photos'==button){uri=new URI('/editnote.php?draft&note_id='+payload.note_id);if(payload.profile_id){uri.addQueryData({'id':payload.profile_id});}
goURI(uri,true);return false;}else{return payload;}}
ProfileComposerNotes.prototype.reset=function(){this.parent.reset();show(this.advancedLink);hide(this.addPhotosLink);hide(this.inThisNoteRow);this.title.value='';this.noteContent.value='';this.inThisNoteTokenizer.clear();}
function ProfileComposerGifts(app_id,tag_type,tag_ver,root){this.parent.construct(this,app_id,root);this.tag_type=tag_type;this.tag_ver=tag_ver;this.giftWall=root.getElementsByTagName('textarea')[0];this.placeHolder=this.giftWall.value;this.feedwall=this.profileComposerController.feedwall;};ProfileComposerGifts.extend('ProfileComposer');ProfileComposerGifts.prototype.onshow=function(){gifttags_source.async_set_tags(this.tag_type,this.tag_ver);Bootloader.loadComponents('gift-credits-css');new AsyncRequest('/ajax/giftcredits/balance.php').setHandler(function(response){var payload=response.getPayload();if(!payload){return;}
GiftshopController.updateNumCredits(HTML(payload.num_credits_text));}).send();}
ProfileComposerGifts.prototype.setScheduled=function(checked){if(ge('gift_scheduled_box')){$('gift_scheduled_box').checked=checked;}}
ProfileComposerGifts.prototype.isScheduled=function(){return ge('gift_scheduled_box')&&$('gift_scheduled_box').checked;}
ProfileComposerGifts.prototype.getGiftType=function(){return ge('gift_type')&&$('gift_type').value;}
ProfileComposerGifts.prototype.onsubmit=function(){var wall_message=(this.commentText.getControl&&trim(this.commentText.getControl().getValue()))||'';var orderInfo={sku:$('sku').value,message:wall_message,privacy_type:0,source:'composer',scheduled:this.isScheduled(),gift_type:this.getGiftType()};var receiver=$('gift_receiver').value;var back_url=URI.getRequestURI().toString();GiftshopController.initOrder(GiftshopController.giftsAppId,receiver,orderInfo,back_url,!this.this_is_me?'clicktype':null);};ProfileComposerGifts.prototype.reset=function(){this.parent.reset();this.setScheduled(false);this.reenable();};ProfileComposerGifts.prototype.disable=function(){this.commentText.disabled=true;this.profileComposerController.setComposerSubmitButtonState(false);CSS.addClass(this.root,'disabled');};ProfileComposerGifts.prototype.reenable=function(){this.commentText.disabled=false;this.profileComposerController.setComposerSubmitButtonState(true);CSS.removeClass(this.root,'disabled');}
function ProfileComposerPlatform(app_id,root,is_self){this.parent.construct(this,app_id,root);this.contentArea=DOM.find(root,'div.content_area');this.commentEtc=DOM.find(root,'div.comment_etc');this.extendedContent=null;this.rendered=false;this.visible=false;}
ProfileComposerPlatform.extend('ProfileComposer');ProfileComposerPlatform.prototype.onshow=function(){if(this.extendedContent===null){this.extendedContent=false;new AsyncRequest().setOption('useIframeTransport',true).setReadOnly(true).setMethod('GET').setURI(new URI('/ajax/profile/composer.php').setSubdomain('apps')).setData({action:'render',app_id:this.app_id,id:this.profileComposerController.id,iframe:true}).setHandler(function(response){var payload=response.getPayload();this.extendedContent=payload.extendedContent;if(!payload.publishEnabled){$(this.app_id+'_publish_button').disabled=true;}
if(!payload.commentEnabled){hide($(this.app_id+'_comment_text'));}
this.onshow();}.bind(this)).setErrorHandler(function(response){this.profileComposerController.showComposerError(response);this.reset();this.profileComposerController.onclick(0);}.bind(this)).send();}else if(!this.rendered){this.rendered=true;CSS.setClass(this.contentArea,'');set_inner_html(this.contentArea,this.extendedContent,true);show(this.commentEtc);}}
ProfileComposerPlatform.prototype.reset=function(){this.parent.reset();this.rendered=false;this.extendedContent=null;set_inner_html(this.contentArea,'',true);if(this.commentText){this.commentText.disabled=false;}};ProfileComposerPlatform.prototype.getRemoveLink=function(){return $('remove_composer_'+this.app_id);};function ProfileWellDisplay(root){var tabAnchors=DOM.scry(root,'div.composer_well_tabs a');this.tabs=[];for(var i=0;i<tabAnchors.length;i++){this.tabs.push(tabAnchors[i].parentNode);tabAnchors[i].onclick=this.selectTab.bind(this,i);}
this.tabContent=DOM.find(root,'div.well_content').childNodes;this.currentTab=0;}
ProfileWellDisplay.prototype.onselect=bagofholding;ProfileWellDisplay.prototype.selectTab=function(tab,event){if(this.currentTab!=tab){var result=this.onselect(this.currentTab=tab,$E(event));if(result!=false){for(var i=0;i<this.tabs.length;i++){CSS[i==tab?'addClass':'removeClass'](this.tabs[i],'selected');(i==tab?show:hide)(this.tabContent[i]);}}}
return false;}
function ProfileComposerFeedcrawl(app_id,root){this.parent.construct(this,app_id,root);this.publishButton.onclick=function(){return false;};};ProfileComposerFeedcrawl.extend('ProfileComposer');function ProfileComposerBoard(app_id,root){this.parent.construct(this,app_id,root);this.topic=DOM.find(root,'input.board_topic');this.boardPost=DOM.find(root,'textarea.board_post');};ProfileComposerBoard.extend('ProfileComposer');ProfileComposerBoard.prototype.onsubmitResponse=function(button,response){var payload=response.getPayload();location.href=payload.redirect_url;return false;}
ProfileComposerBoard.prototype.reset=function(){this.parent.reset();this.topic.value='';this.boardPost.value='';}

function FeedWall(id,viewer,root,pagerInfo,tabsetId){if(!root){return;}
this.wall=root;this.id=id;this.viewer=viewer;FeedWall.instance=this;onunloadRegister(function(){FeedWall.instance=null;});this.storiesData={};this.rebuildFeedWallPosts();this.maxTime=null;this.currentFilter=null;this.pagerExtended=false;this.tabsetId=tabsetId;this.pagerPrev=$(pagerInfo['pager_prev']);this.pagerNext=$(pagerInfo['pager_next']);DOM.find(this.pagerPrev,'a').listen('click',this.navigatePage.bind(this,-1));;DOM.find(this.pagerNext,'a').listen('click',this.navigatePage.bind(this,1));FeedWall.initializeFilterStoryTypes();}
FeedWall.initializeFilterStoryTypes=function(){FeedWall.filterStoryTypes={all_posts:[],posts_by_owner:[FeedWall.MINISTORY_CHANGE_RELATIONSHIP_STATUS,FeedWall.MINISTORY_CREATE_GROUP,FeedWall.MINISTORY_CREATE_EVENT,FeedWall.MINISTORY_CREATE_PHOTO_ALBUM,FeedWall.MINISTORY_ADD_PHOTOS,FeedWall.MINISTORY_CREATE_NOTE,FeedWall.MINISTORY_NOTE_ADD_POST,FeedWall.MINISTORY_SHARE_SAVE,FeedWall.MINISTORY_CHANGE_STATUS,FeedWall.MINISTORY_ADD_VIDEO,FeedWall.MINISTORY_PHOTO_COMMENT,FeedWall.MINISTORY_FAN_FBPAGE,FeedWall.MINISTORY_PLATFORM_APP_USER_ACTION,FeedWall.MINISTORY_COMPOSER_PHOTO,FeedWall.MINISTORY_WALL_POST_INCOMING],posts_by_others:[FeedWall.MINISTORY_SHARE_SAVE,FeedWall.MINISTORY_TAGGED_IN_PHOTOS,FeedWall.MINISTORY_ADD_VIDEO,FeedWall.MINISTORY_PLATFORM_APP_USER_ACTION,FeedWall.MINISTORY_COMPOSER_PHOTO,FeedWall.MINISTORY_WALL_POST_INCOMING]};}
FeedWall.animationDuration=300;FeedWall.isWallPost=function(storyType){return storyType==FeedWall.MINISTORY_WALL_POST_INCOMING;}
FeedWall.isBlockableAppStory=function(storyType){switch(storyType){case FeedWall.MINISTORY_PLATFORM_APP:case FeedWall.MINISTORY_PLATFORM_APP_TEMPLATIZED:return true;default:return false;}}
FeedWall.getInstance=function(){return FeedWall.instance;}
FeedWall.prototype.rebuildFeedWallPosts=function(){this.posts=[];for(var i=0;i<this.wall.childNodes.length;++i){if(CSS.hasClass(this.wall.childNodes[i],'hidden_app_stories')){var hidden_stories=this.wall.childNodes[i];for(var j=0;j<hidden_stories.childNodes.length;++j){if(CSS.hasClass(hidden_stories.childNodes[j],'story')){this.posts.push(new FeedWallPost(this,hidden_stories.childNodes[j]));}}}
if(CSS.hasClass(this.wall.childNodes[i],'story')){this.posts.push(new FeedWallPost(this,this.wall.childNodes[i]));}}}
FeedWall.prototype.findHiddenPosts=function(story_type,app_id,story_date){var hiddenPosts=[];for(var i=0;i<this.posts.length;i++){if(this.posts[i].isSecondary){var post=this.posts[i];if(post.story_type==story_type&&post.app_id==app_id&&post.story_date==story_date){hiddenPosts.push(post);}}}
return hiddenPosts;}
FeedWall.prototype.removeChildren=function(primary,secondaries){secondaries.forEach(function(p){this.removeChild(p,true);},this);this.removeChild(primary,false);}
FeedWall.prototype.removeChild=function(post,immediate){var i=this.posts.indexOf(post);this.posts=this.posts.filter(function(a){return a.obj!=post.story_obj});var nextDate=null;var postRightBelowDivider=post.story_obj.previousSibling&&CSS.hasClass(post.story_obj.previousSibling,'date_divider');if(this.posts[i]){this.setBorder(this.posts[i]);}
if(postRightBelowDivider){if(!post.story_obj.nextSibling||CSS.hasClass(nextDate=post.story_obj.nextSibling,'date_divider')){if(CSS.hasClass(post.story_obj.previousSibling,'first')){CSS.addClass(nextDate,'first');}
post.story_obj.parentNode.removeChild(post.story_obj.previousSibling);}}
if(immediate){this.wall.removeChild(post.story_obj);}else{post.story_obj.style.overflow='hidden';animation(post.story_obj).to('height',0).duration(FeedWall.animationDuration).ondone(function(){this.wall.removeChild(post.story_obj);}.bind(this)).go();}}
FeedWall.prototype.setBorder=function(post){var needBorder=false;var postRightBelowDivider=post.story_obj.previousSibling&&CSS.hasClass(post.story_obj.previousSibling,'date_divider');if(!postRightBelowDivider){var isSmall=(post.size==FeedWallPost.SIZE_SMALL);if(isSmall){var i=this.posts.indexOf(post);if(i>0){if(this.posts[i-1].size!=FeedWallPost.SIZE_SMALL){needBorder=true;}}}else{needBorder=true;}}
if(needBorder){CSS.addClass(post.story_obj,'border');CSS.removeClass(post.story_obj,'no_border');}else{CSS.addClass(post.story_obj,'no_border');CSS.removeClass(post.story_obj,'border');}}
FeedWall.prototype.insertPost=function(post,caret,immediate,dividerToInsertBefore){var i=caret?this.posts.indexOf(caret):0;this.posts.splice(i,0,post);var tabset=Tabset.getInstance(this.tabsetId);var singleStory=tabset&&tabset.hasTabElem('single_story');if(singleStory&&!CSS.hasClass(singleStory,'hidden_elem')){return;}
if(this.currentFilter&&FeedWall.filterStoryTypes[this.currentFilter].length&&FeedWall.filterStoryTypes[this.currentFilter].indexOf(post.story_type)==-1){return;}
if(dividerToInsertBefore){DOM.insertBefore(post.story_obj,dividerToInsertBefore);}else{if(caret){DOM.insertBefore(post.story_obj,caret.story_obj);}else{DOM.prependContent(this.wall,post.story_obj);}
this.setBorder(post);if(caret){this.setBorder(caret);}}
if(!immediate){animation(post.story_obj).to('height','auto').from(0).duration(FeedWall.animationDuration).go();}}
FeedWall.prototype.firstChild=function(){return this.posts[0];}
FeedWall.prototype.regenerateStories=function(auto_scroll){if(this.waitingForAjax){return;}
var filterStoryTypes;if(!this.currentFilter){filterStoryTypes=[];}else{filterStoryTypes=FeedWall.filterStoryTypes[this.currentFilter];}
this.waitingForAjax=true;CSS.addClass(this.pagerNext,'page_loading');CSS.addClass(this.pagerPrev,'page_loading');new AsyncRequest().setURI('/ajax/profile/minifeed.php').setData({action:'stories',id:this.id,viewas:this.viewer,max_time:this.maxTime,filter_type:this.currentFilter,filter_story_types:filterStoryTypes,extended:this.pagerExtended}).setContextData('clicktype','Filter Stories or Pagination',this.viewer!=this.id).setHandler(function(response){var payload=response.getPayload();if(auto_scroll){var scroll=Vector2.getScrollPosition();var pivots=[];var oldest_story_key=null;if(this.posts.length){pivots=[this.posts[0],this.posts[this.posts.length-1]].map(function(a){return{key:a.story_key,scrollTop:elementY(a.story_obj)-scroll.y};});}
oldest_story_key=pivots[1].key;}
set_inner_html(this.wall,payload.html);this.rebuildFeedWallPosts();(payload.next?show:hide)(this.pagerNext);(payload.prev?show:hide)(this.pagerPrev);if(auto_scroll){var fixed=false;scroll=Vector2.getScrollPosition();this.posts.each(function(a){pivots.each(function(b){if(!fixed&&a.story_key==b.key){fixed=true;scroll.y-=b.scrollTop-(elementY(a.story_obj)-scroll.y);DOMScroll.scrollTo(scroll);}});});}
if(oldest_story_key&&this.posts.length>0&&this.posts[this.posts.length-1].story_key==oldest_story_key){hide(this.pagerNext);}}.bind(this)).setFinallyHandler(function(){this.waitingForAjax=false;CSS.removeClass(this.pagerPrev,'page_loading');CSS.removeClass(this.pagerNext,'page_loading');}.bind(this)).setStatusElement().send();}
FeedWall.prototype.initSettingsView=function(){Tabset.getInstance(this.tabsetId).selectTab(this.tabsetId+'_settings',this.selectSettings.bind(this));}
FeedWall.prototype.selectControl=function(control){if((this.currentFilter==control)||this.waitingForAjax){return false;}
if(control=='all_posts'){var tabset=Tabset.getInstance(this.tabsetId);var singleStory=tabset&&tabset.getTabElem('single_story');if(singleStory&&!CSS.hasClass(singleStory,'hidden_elem')){CSS.addClass(singleStory,'hidden_elem');var tabs=['posts_by_owner','posts_by_others','settings'];for(var i=0;i<tabs.length;++i){var tab=tabset.getTabElem(tabs[i]);if(tab){CSS.removeClass(tab,'hidden_elem');}}}}
this.currentFilter=control;return true;}
FeedWall.prototype.selectFilter=function(filter){if(FeedWall.filterStoryTypes[filter].length){to_remove=new Array();for(var i=0;i<this.posts.length;i++){if(FeedWall.filterStoryTypes[filter].indexOf(this.posts[i].story_type)==-1){to_remove.push(this.posts[i]);}}
for(var i=0;i<to_remove.length;i++){this.removeChild(to_remove[i],true);}}
var placeholder=document.createElement('div');CSS.setClass(placeholder,'loading_placeholder');this.wall.appendChild(placeholder);this.regenerateStories(false);hide('profile_settings');show('profile_minifeed');this.currentFilter=filter;return false;}
FeedWall.prototype.selectSettings=function(){show('profile_settings');hide('profile_minifeed');hide(this.pagerPrev);hide(this.pagerNext);return false;}
FeedWall.prototype.navigatePage=function(direction){if(!this.pagerExtended){this.pagerExtended=true;this.regenerateStories(true);}else if(direction>0){this.maxTime=this.posts[Math.floor(this.posts.length*0.80)].story_time-1;this.regenerateStories(true);}else if(direction<0){this.maxTime=-this.posts[Math.floor(this.posts.length*0.20)].story_time+1;this.regenerateStories(true);}
return false;}
FeedWall.prototype.saveComments=function(){var data={'friend_mf_comments':1,'value':$('profile_settings_comments').checked?1:0};this._saveSettings(data);}
FeedWall.prototype.saveExpandComments=function(){var data={'wall_expand_comments':1,'value':$('profile_settings_expand_comments').checked?1:0};this._saveSettings(data);}
FeedWall.prototype.saveCombinedPosts=function(){var data={'combined_posts':1,'value':$('profile_settings_grouping_combined').checked?1:0};this._saveSettings(data);}
FeedWall.prototype.saveFriendsWall=function(){var checked=$('profile_settings_connections_post').checked?1:0;var data={'connections_can_post':1,'value':checked};var handler=function(){var privacy_divs=$$('#profile_settings div.privacy');var privacy_div=privacy_divs[0];if(checked){show(privacy_div);}else{hide(privacy_div);}};this._saveSettings(data,handler);}
FeedWall.prototype.savePrivacy=function(privacy_data){this._saveSettings(privacy_data);}
FeedWall.prototype._saveSettings=function(data,callback){var handler=callback||bagofholding;CSS.removeClass('profile_settings_bar_loading','invisible_elem');new AsyncRequest().setData(data).setURI('/ajax/profile/settings.php').setHandler(handler).setFinallyHandler(function(){setTimeout(CSS.addClass.bind(CSS,'profile_settings_bar_loading','invisible_elem'),500);}).send();}
FeedWall.prototype.setStoryDatum=function(story_key,key,value){if(!this.storiesData[story_key]){this.storiesData[story_key]={};}
this.storiesData[story_key][key]=value;}
FeedWall.prototype.getStoryDatum=function(story_key,key){if(!this.storiesData[story_key]){return null;}
return this.storiesData[story_key][key];}
function FeedWallPost(feedwall,obj){this.feedwall=feedwall;this.obj=obj;this.isPrimary=CSS.hasClass(obj,'aggregate_primary');this.isSecondary=CSS.hasClass(obj,'aggregate_secondary');if(this.isPrimary){var showMoreLink=DOM.find(obj,'a.show_hidden_stories_link');showMoreLink.listen('click',this.exposeHiddenStories.bind(this));}
var storyOptionsArr=DOM.scry(obj,'div.story_options');if(storyOptionsArr.length){var storyOptions=storyOptionsArr[0];this.storyOptions=storyOptions;for(var j=0;j<storyOptions.childNodes.length;++j){if(CSS.hasClass(storyOptions.childNodes[j],'story_options_content')){for(var k=0;k<storyOptions.childNodes[j].childNodes.length;++k){var cur=$(storyOptions.childNodes[j].childNodes[k]);if(CSS.hasClass(cur,'story_hide')){cur.listen('click',this.removeStory.bind(this));}else if(CSS.hasClass(cur,'story_change_size')){cur.listen('click',this.changeSize.bind(this,cur.getAttribute('fbsize')));}else if(CSS.hasClass(cur,'story_privacy')){cur.listen('click',this.editPrivacy.bind(this));}}
break;}}
var storyOptionsContent=DOM.scry(obj,'div.story_options_content')[0];if(storyOptionsContent){storyOptionsContent.parentNode.removeChild(storyOptionsContent);storyOptionsContent.style.display='block';this.edit_menu=flyout_menu(storyOptions).setMarkupContent(storyOptions.id,'flyout_menu_18 link_menu feedwall_menu',_tx("Opsi Berita"),storyOptionsContent).setPosition(dropmenu.ALIGN_RIGHT).addHook('show',function(storyOptions){CSS.addClass(storyOptions,'selected');}.bind(null,storyOptions)).addHook('hide',function(storyOptions){CSS.removeClass(storyOptions,'selected');}.bind(null,storyOptions));}}
for(var i=0;i<obj.childNodes.length;++i){if(CSS.hasClass(obj.childNodes[i],'size_2')||CSS.hasClass(obj.childNodes[i],'medium')){this.size=FeedWallPost.SIZE_MEDIUM;}else if(CSS.hasClass(obj.childNodes[i],'size_4')){this.size=FeedWallPost.SIZE_LARGE;}else if(CSS.hasClass(obj.childNodes[i],'size_1')){this.size=FeedWallPost.SIZE_SMALL;}}
obj.onmouseover=function(){CSS.addClass(this,'hover');};obj.onmouseout=function(){CSS.removeClass(this,'hover');};var info=/minifeed(_wall)?_([0-9]*)/.exec(obj.id);this.wall=!!info[1];this.story_type=parseInt((/story_type_([0-9]+)/.exec(obj.className)||[]).pop(),10);this.story_key=info[2];this.story_time=parseInt(obj.getAttribute('time'),10);this.story_obj=obj;if(this.isPrimary||this.isSecondary){var agg_info=/agg_story_shell_([0-9]+)_([0-9_]+)/.exec(obj.className);this.app_id=agg_info[1];this.story_date=agg_info[2];}}
FeedWallPost.prototype.exposeHiddenStories=function(){var key=this.app_id+'_'+this.story_date;var feedWall=FeedWall.getInstance();var storyDivs=DOM.scry(feedWall.wall,'div.agg_story_shell_'+key);storyDivs.forEach(function(storyDiv){CSS.removeClass(storyDiv,'aggregate_primary');CSS.removeClass(storyDiv,'aggregate_secondary');CSS.addClass(storyDiv,'aggregate_none');});DOM.remove('show_hidden_stories_span_'+key);feedWall.rebuildFeedWallPosts();return false;}
FeedWallPost.prototype.removeStory=function(){var show_confirm_dialog=FeedWall.isBlockableAppStory(this.story_type)&&this.size==FeedWallPost.SIZE_SMALL&&!this.getDatum('never_publish');var data={'ministory_key':this.story_key,'profile_fbid':this.feedwall.id,'story_type':this.story_type};var hiddenStoryPosts=[];if(this.isPrimary){hiddenStoryPosts=this.feedwall.findHiddenPosts(this.story_type,this.app_id,this.story_date);var hiddenStoryKeys=hiddenStoryPosts.map(function(p){return p.story_key;});data['extra_hide_story_keys']=hiddenStoryKeys.join(':');}
if(!show_confirm_dialog){new AsyncRequest().setURI('/ajax/minifeed.php').setData(data).setContextData('clicktype','Delete Wall Story').setHandler(this.feedwall.removeChildren.bind(this.feedwall,this,hiddenStoryPosts)).send()
return false;}
var minifeed_dialog_handle=new contextual_dialog();minifeed_dialog_handle.modal=true;minifeed_dialog_handle.set_context(this.storyOptions);CSS.addClass(this.obj,'hover');var checkbox_id='block_checkbox_'+this.story_key;var closeDialog=function(){CSS.removeClass(this.obj,'hover');minifeed_dialog_handle.hide(false);}.bind(this);var hideStory=function(){var block_stories=$(checkbox_id).checked;data['block_stories']=block_stories;new AsyncRequest().setURI('/ajax/minifeed.php').setData(data).setHandler(function(resp){closeDialog();this.feedwall.removeChild(this,false);if(block_stories){var story_app_id=this.getDatum('app_id');for(var i=0;i<this.feedwall.posts.length;++i){var post=this.feedwall.posts[i];var post_app_id=this.feedwall.getStoryDatum(post.story_key,'app_id');if(post_app_id&&post_app_id==story_app_id){post.setDatum('never_publish',true);}}}}.bind(this)).send();}.bind(this);var body=_tx("Anda tidak akan bisa membatalkan ini.")
+'<br />'
+sprintf('<input type="checkbox" name="%s" id="%s" /> ',htmlize(checkbox_id),htmlize(checkbox_id))
+_tx("Jangan pernah mengizinkan aplikasi ini menerbitkan ke profil saya.");minifeed_dialog_handle.show_choice(_tx("Anda yakin ingin menghapus berita ini?"),body,_tx("Hapus Berita"),hideStory,_tx("Batalkan"),closeDialog);return false;}
FeedWallPost.SIZE_SMALL=1;FeedWallPost.SIZE_MEDIUM=2;FeedWallPost.SIZE_LARGE=4;FeedWallPost.prototype.changeSize=function(size){if(size==this.size){this.edit_menu.hide();return false;}
var loading=document.createElement('div');CSS.setClass(loading,'loading_layer');loading.style.height=this.story_obj.offsetHeight+'px';loading.style.width=this.story_obj.offsetWidth+'px';this.story_obj.insertBefore(loading,this.story_obj.firstChild);var is_primary=this.story_obj.hasClass('aggregate_primary');var hidden_stories=this.feedwall.findHiddenPosts(this.story_type,this.app_id,this.story_date);new AsyncRequest().setURI('/ajax/profile/composer.php').setData({action:'resize',id:this.feedwall.id,key:this.story_key,size:size,is_primary:is_primary,num_hidden:hidden_stories.length}).setHandler(function(response){var div=document.createElement('div');set_inner_html(div,response.getPayload());this.edit_menu.destroy();var newFeedPost=new FeedWallPost(this.feedwall,div.firstChild);this.feedwall.insertPost(newFeedPost,this);this.feedwall.removeChild(this);}.bind(this)).send();return false;}
FeedWallPost.prototype.editPrivacy=function(){new AsyncRequest().setURI('/ajax/minifeed/fetch_privacy_markup.php').setMethod('GET').setReadOnly(true).setData({profile_id:this.feedwall.id,story_key:this.story_key}).setHandler(function(response){var payload=response.getPayload();new Dialog().setTitle(_tx("Siapa yang bisa melihat ini?")).setBody(payload['widget_markup']).setButtons([Dialog.SAVE,Dialog.CANCEL]).setStackable(true).setModal(true).setContentWidth(260).setHandler(this.savePrivacy.bind(this,payload.form_id)).show();}.bind(this)).send();return false;}
FeedWallPost.prototype.savePrivacy=function(form_id){var form_elem=$(form_id);var form_data=serialize_form(form_elem);new AsyncRequest().setURI('/ajax/minifeed/save_privacy.php').setData(form_data).setHandler(bagofholding).send();}
FeedWallPost.prototype.getDatum=function(key){return this.feedwall.getStoryDatum(this.story_key,key);}
FeedWallPost.prototype.setDatum=function(key,value){this.feedwall.setStoryDatum(this.story_key,key,value);}

if (window.Bootloader) { Bootloader.done(["js\/6ths6p5vlj40gkwc.pkg.js"]); }