
var REMOVE_BOX_ONLY=1;var REMOVE_ENTIRE_APP=2;var al_dialog;function removeActionLink(obj,application_name,app_id){var dialog=new contextual_dialog();dialog.set_context(obj);buttons='<div class="dialog_buttons">'+'<input class="inputsubmit" type="button" value="Hide Link" /><input class="inputsubmit" type="button" value="Cancel" />'+'</div>';var prompt='If you hide it, it will no longer appear on any profile that you view. You can re-enable the link later on the My Applications page.';add_css_class_name(obj,'box_remove_selected');dialog.show_prompt('Do you want to hide this link provided by '+application_name+'?',prompt+buttons);al_dialog=true;dialog_options=dialog.obj.getElementsByTagName('input');dialog_options[0].onclick=function(){remove_link(obj.parentNode,app_id);dialog.hide();}
dialog_options[1].onclick=function(){dialog.hide();remove_css_class_name(obj,'box_remove_selected');al_dialog=false;}
return false;}
function remove_link(link_obj,app_id){link_obj.style.display='none';var error_message='Sorry, removing this link failed.';var ajax=new Ajax(function(obj,text){eval(text);if(!success){aiert(error_message);}});ajax.onFail=function(){aiert(error_message);}
var post={'app_id':app_id};ajax.post('/ajax/profile_link.php',post);}
function removeBox(obj,application_name,app_id){var dialog=new contextual_dialog();dialog.set_context(obj);buttons='<div class="dialog_buttons"><input class="inputsubmit" type="button" value="Remove Box" />'+'<input class="inputsubmit" type="button" value="Remove Application" /><input class="inputsubmit" type="button" value="Cancel" />'+'</div>';dialog.show_prompt('Do you want to remove '+application_name+'?',dialog.content_to_markup(get_remove_prompt())+buttons);add_css_class_name(obj,'box_remove_selected');dialog_options=dialog.obj.getElementsByTagName('input');dialog_options[0].onclick=function(){remove_app('',REMOVE_BOX_ONLY,app_id);dialog.hide();}
dialog_options[1].onclick=function(){remove_app('',REMOVE_ENTIRE_APP,app_id);dialog.hide();}
dialog_options[2].onclick=function(){dialog.hide();remove_css_class_name(obj,'box_remove_selected');}
return false;}
function get_remove_prompt(application_name,app_id){return'You can remove this application box from your profile or remove this application from your account entirely.';}
function remove_app(e,remove_type,app_id){ge(app_id).style.display='none';var error_message='Sorry, removing this profile box failed.';var ajax=new Ajax(function(obj,text){eval(text);if(!success){aiert(error_message);}});ajax.onFail=function(){aiert(error_message);}
var post={'app_id':app_id,'remove_type':remove_type};ajax.post('/ajax/profile_boxes.php',post);}
function flexToggle(el){if(el.className=='flex_open'){el.className='flex_shut';profileFlexAjax(el.id,1);}else{el.className='flex_open';profileFlexAjax(el.id,0);}}
var all_boxes_open=true;function allBoxesFlexToggle(){all_boxes_open=!all_boxes_open;var text_el=ge('profile_view_button_text');var userprofile=ge('userprofile');if(all_boxes_open){text_el.innerHTML='Minimize Profile';remove_css_class_name(userprofile,'collapsed_mode');}else{text_el.innerHTML='Expand Profile';add_css_class_name(userprofile,'collapsed_mode');}
return false;}
function boxFlexSet(el,open){if(open==true&&has_css_class_name(el,'flex_shut')){remove_css_class_name(el,'flex_shut');add_css_class_name(el,'flex_open');}else if(open==false&&has_css_class_name(el,'flex_open')){remove_css_class_name(el,'flex_open');add_css_class_name(el,'flex_shut');}}
function boxFlexToggle(el){var userprofile=ge('userprofile');if(has_css_class_name(userprofile,'collapsed_mode')){remove_css_class_name(userprofile,'collapsed_mode');remove_css_class_name(el,'flex_shut');add_css_class_name(el,'flex_open');animate_scroll_to_id(el.id,5);profileBoxFlexAjax(el.id,0);return;}
if(has_css_class_name(el,'flex_open')){remove_css_class_name(el,'flex_open');add_css_class_name(el,'flex_shut');profileBoxFlexAjax(el.id,1);}else{remove_css_class_name(el,'flex_shut');add_css_class_name(el,'flex_open');profileBoxFlexAjax(el.id,0);}
el.blur();return false;}
profileFlexAjax=function(elId,val){var ajax=new Ajax()
ajax.onDone=function(){}
ajax.onFail=function(){}
ajax.post('ajax/profile_flex_ajax.php',elId+'='+val);}
profileBoxFlexAjax=function(elId,val){var ajax=new Ajax()
ajax.onDone=function(){}
ajax.onFail=function(){}
ajax.post('ajax/profile_box_flex_ajax.php',{'app_id':elId,'value':val});}
function minifeed_hide(clickedElement,story_id)
{var minifeed_dialog_handle=new contextual_dialog();minifeed_dialog_handle.set_context(clickedElement);minifeed_dialog_handle.show_choice('Are you sure you want to hide this mini-feed story?','Hiding will remove the story from your Mini-Feed and prevent anyone from seeing it.','Hide Story','','Cancel','');var minifeed_inputs=minifeed_dialog_handle.obj.getElementsByTagName('input');minifeed_inputs[0].onclick=function(){minifeed_hide_click(story_id);generic_dialog.get_dialog(this).fade_out(100);};minifeed_inputs[1].onclick=function(){generic_dialog.get_dialog(this).hide();};return false;}
function minifeed_hide_click(hide_id)
{ajax=new Ajax();ajax.onDone=function(){}
ajax.onFail=function(){aiert("Sorry, hiding this story failed");}
story=ge('story_'+hide_id);if(story.previousSibling.className=='date_divider'&&story.nextSibling.className.indexOf('story')==-1){remove_node(story.previousSibling);}
else if(story.previousSibling.className=='date_divider'){story.nextSibling.className+=' no_border';}
remove_node(story);minifeed_decrement_story_count();ajax.post('minifeed.php',{'hide_ministory_key':hide_id});}
function minifeed_decrement_story_count(){var text;var mf_story_count_string_array=new Array();var count_el=ge('mf_story_count_string');if(!count_el)return;var count=parseInt(count_el.innerHTML.split(' ')[0]);count=count-1;if(count==1){text='story';}else{text='stories';}
count_el.innerHTML=(count)+' '+text;}
function show_profile_layout_dialog(){var dialog=new pop_dialog();dialog.show_message('Profile Layout','You can edit the layout of your profile at any time. Simply use your mouse to drag and drop boxes anywhere on your profile.'
+'<br/><br/>'
+'Please note that you cannot move your Mini-Feed or Friends box. Also, some boxes may be restricted to either the right or left column of the profile.');}
function show_public_profile_dialog(url){var dialog=new pop_dialog();dialog.show_message('Public Listing','Your public listing contains some information about you that may be viewed by people outside of Facebook.'
+'<br/><br/>'
+'If you allow people to view your public listing, people not logged in to Facebook can view it at this URL:'
+'<br/><br/>'
+'<span style="color: #3b5998; border: 1px solid #ccc; padding: 5px; margin: 5px;">'
+url
+'</span>'
+'<br/><br/>'
+'You can control who can see your public listing on your '
+'<a href="/privacy.php?view=search">search privacy</a> page.');}
function is_left_click(e){if(e.which==null){if(e.button<2)return true;}else{if(e.which<2)return true;}
return false;}
function profile_icon_hover(icon_link){var icon=icon_link.childNodes[1];var tooltip=icon_link.childNodes[0];if(has_css_class_name(tooltip,'loaded_tooltip')){return;}
tooltip.style.display='block';var offsetWidth=tooltip.childNodes[0].offsetWidth;tooltip.style.width=offsetWidth+'px';tooltip.style.left=-((offsetWidth-20)/2)+'px';tooltip.style.top=-26+'px';add_css_class_name(tooltip,'loaded_tooltip');tooltip.style.display='';}
function clear_tooltip(icon_link){var icon=icon_link.childNodes[1];var tooltip=icon_link.childNodes[0];tooltip.style.display='none';tooltip.style.display='';icon.style.top='0px';icon.style.top='';}
function profile_app_switcher_select(scroll_element_id,app_id){make_header_blue(app_id);boxFlexSet(ge('box_head_'+app_id).parentNode,1);animate_scroll_to_id(scroll_element_id,20,app_id,getPageScrollHeight(),'fade_header');return false;}
var ANI_SCROLL_STEP_AMOUNT=250;var ANI_SCROLL_SLOWING_WINDOW=750;var ANI_SCROLL_STOP_WINDOW=13;var ANI_MAX_SLOWDOWN_AMOUNT=120;var ANI_CALLBACK_PAUSE_TIME=200;function animate_scroll_to_id(scroll_element_id,scroll_speed,app_id,scroll_height,scroll_complete_callback){var target_height=elementY(ge(scroll_element_id));var page_scroll_height=getPageScrollHeight();var scroll_dir=1;if(target_height<page_scroll_height){scroll_dir=-1;}
var scroll_amount=0;if(scroll_height!=getPageScrollHeight()){if(scroll_complete_callback){setTimeout(scroll_complete_callback+"("+app_id+")",ANI_CALLBACK_PAUSE_TIME);}
return;}
if(!(page_scroll_height>target_height-ANI_SCROLL_SLOWING_WINDOW&&page_scroll_height<target_height+ANI_SCROLL_SLOWING_WINDOW)){scroll_amount=ANI_SCROLL_STEP_AMOUNT;}else if(!(page_scroll_height>target_height-ANI_SCROLL_STOP_WINDOW&&page_scroll_height<target_height+ANI_SCROLL_STOP_WINDOW)){scroll_amount=Math.abs(page_scroll_height-target_height)/ANI_SCROLL_SLOWING_WINDOW*ANI_MAX_SLOWDOWN_AMOUNT;}
if(scroll_amount!=0){window.scrollBy(0,scroll_dir*scroll_amount);setTimeout("animate_scroll_to_id('"+
scroll_element_id+"',"+
scroll_speed+","+
app_id+","+
getPageScrollHeight()+",'"+
scroll_complete_callback+"')",scroll_speed);}else{window.scrollTo(0,target_height-ANI_SCROLL_STOP_WINDOW);if(scroll_complete_callback){setTimeout(scroll_complete_callback+"("+app_id+")",ANI_CALLBACK_PAUSE_TIME);}}}
function fade_header(id){var box_header=ge('box_head_'+id);remove_css_class_name(box_header,'box_head_highlight');var box=ge('box_head_'+id).parentNode;remove_css_class_name(box,'box_outline');var old_border=ge('scroll_highlight_border');old_border.parentNode.removeChild(old_border);}
function make_header_blue(id){var newBorder=document.createElement('div');newBorder.id='scroll_highlight_border';newBorder.className="box_highlight_outline";var box=ge('box_head_'+id).parentNode;newBorder.style.top=elementY(ge('box_head_'+id))-10+'px';newBorder.style.left=elementX(ge('box_head_'+id))-10+'px';newBorder.style.width=box.offsetWidth+15+'px';newBorder.style.height=box.offsetHeight+5+'px';document.body.appendChild(newBorder);var box_header=ge('box_head_'+id);}
