var ELP=function(){var formToSubmit=null;var partial_comment_id=["#feed_comment_","#feed_entry_","#immersive_comment_"];var experience_id;var story_id;var remove_person_id;var remove_pending_id;function getExperienceId(){if(!experience_id){loadExperienceIdAndStoryId()}return experience_id}function getStoryId(){if(!story_id){loadExperienceIdAndStoryId()}return story_id}function hideComment(commentId){var div=null;var eat_hr=false;var i;for(i=0;i<partial_comment_id.length;i++){div=$(partial_comment_id[i]+commentId);if(div.length>0){if(partial_comment_id[i]=="#feed_entry_"){eat_hr=true}break}}if(div){ELP.animating=true;if(eat_hr){$(partial_comment_id[i]+commentId+" + div").slideUp(600)}div.slideUp(600,function(){ELP.animating=false})}}function initialize(){$("#remove_story_dialog").dialog({autoOpen:false,buttons:{No:function(){$(this).dialog("close")},Yes:function(){window.location.href=$("#remove_story_dialog a")[0].getAttribute("href");$(this).dialog("close")}},modal:true});$("#remove_person_dialog").dialog({autoOpen:false,buttons:{No:function(){$(this).dialog("close")
},Yes:function(){window.location.href=$("#remove_person_dialog a")[0].getAttribute("href")+"&person_id="+ELP.remove_person_id;$(this).dialog("close")}},modal:true});$("#remove_pending_dialog").dialog({autoOpen:false,buttons:{No:function(){$(this).dialog("close")},Yes:function(){window.location.href=$("#remove_pending_dialog a")[0].getAttribute("href")+"&person_id="+ELP.remove_pending_id;$(this).dialog("close")}},modal:true});registerListeners()}function loadExperienceIdAndStoryId(){experience_id=$("#id_experience_id").attr("value");story_id=$("#id_story_id").attr("value")}function registerListeners(){$(".delete_link").click(function(event){event.preventDefault();removeComment(this.id)});$("span.remove_story").click(function(event){$("#remove_story_dialog").dialog("open")});$("span.remove_person").click(function(event){ELP.remove_person_id=this.id;$("#remove_person_dialog").dialog("open")});$("span.remove_pending").click(function(event){ELP.remove_pending_id=this.id;$("#remove_pending_dialog").dialog("open")
});$("#embed_link").click(function(event){this.select()});$(".people_involved_edit .clickable").click(function(event){ELP.removePersonMode(true)});$(".people_involved_done .clickable").click(function(event){ELP.removePersonMode(false)});$("#start-story-button").click(function(event){Pelago.Login.verifyLogin("/storyEditor/create");return false})}function removeComment(commentId,callback){if(!confirm("Are you sure you want to delete this?")){return false}var experience_id=getExperienceId();var story_id=getStoryId();var delete_url;if(story_id){delete_url="/story/remove_comment/"+story_id+"/"}else{delete_url="/experience/remove_comment/"+experience_id}$.ajax({complete:function(event,request,options){},data:{comment_id:commentId,format:"json"},error:function(request,status,error){},success:function(response,status){if(callback){callback()}else{if(response.status=="success"){if(response.commentId){hideComment(response.commentId)}}}},type:"POST",url:delete_url})}function removeNote(noteId,callback){if(!confirm("Are you sure you want to delete this?")){return false
}var experience_id=getExperienceId();var story_id=getStoryId();var delete_url;if(story_id){return}else{delete_url="/experience/remove_note/"+experience_id}$.ajax({complete:function(event,request,options){},data:{note_id:noteId,format:"json"},error:function(request,status,error){},success:function(response,status){var d=eval("("+response+")");if(d.status=="success"){if(callback){callback(d.noteId)}}},type:"POST",url:delete_url})}$(function(){initialize()});return{onInputBlur:function(input,defaultValue,size){if($(input).val().length==0){$(input).val(defaultValue).addClass("textarea_help_text");if(size){$(input).height(size)}}},showComments:function(divId){if(ELP.animating){return}$("#feed_comment_more_"+divId).hide();var div=$("#feed_comments_"+divId+":hidden");ELP.animating=true;$(div).slideDown(600,function(){ELP.animating=false})},hideComments:function(divId){if(ELP.animating){return}var div=$("#feed_comments_"+divId);if(div.is(":visible")){ELP.animating=true;$(div).slideUp(600,function(){ELP.animating=false;
$("#feed_comment_more_"+divId).show()})}},hideCommentForm:function(divId){var div=$("#feed_comment_div_"+divId);if(div){$(div).slideUp(600)}},reduceCoolPeople:function(){$("#cool_people_more").slideUp(600);$("#see_more_cool_people").slideDown(600)},reduceCurrentPeopleInvolved:function(){$("#more_current_people_involved").slideUp(600);$("#see_more_current_people_involved").slideDown(600)},reduceDepartedPeopleInvolved:function(){$("#more_departed_people_involved").slideUp(600);$("#see_more_departed_people_involved").slideDown(600)},reduceUserStories:function(){$("#more_user_stories").slideUp(100);$("#see_more_user_stories").slideDown(600)},reduceWhosCommenting:function(){$("#whos_commenting_more").slideUp(600);$("#see_more_whos_commenting").slideDown(600)},removePersonMode:function(on){if(on){$(".person_involved_name").hide();$(".people_involved_edit").hide();$(".person_involved_name_remove").show();$(".people_involved_done").show()}else{$(".people_involved_done").hide();$(".person_involved_name_remove").hide();
$(".person_involved_name").show();$(".people_involved_edit").show()}},showCommentForm:function(divId){var div=$("#feed_comment_div_"+divId);if(div&&!div.is(":visible")){$(div).slideDown(600,function(){$("#feed_comment_textarea_"+divId).focus()})}},showCoolPeople:function(){$("#see_more_cool_people").hide();$("#cool_people_more").slideDown(600)},showImage:function(href){Lightbox.show(href,null,null,"dark")},showCurrentPeopleInvolved:function(){$("#more_current_people_involved").slideDown(600);$("#see_more_current_people_involved").slideUp(600)},showDepartedPeopleInvolved:function(){$("#more_departed_people_involved").slideDown(600);$("#see_more_departed_people_involved").slideUp(600)},showUserStories:function(){$("#see_more_user_stories").hide();$("#more_user_stories").slideDown(600,function(){$(this).css("display","block")})},showWhosCommenting:function(){$("#see_more_whos_commenting").hide();$("#whos_commenting_more").slideDown(600)},validateForm:function(form,input,defaultValue){if(input.value==""){return false
}if(input.value.match(/^\s+$/)){return false}if(input.value==defaultValue){return false}$(".comment_submit_loading").show();$("#add_feed_comment_button").hide();$(".add_feed_entry_comment_button").hide();Pelago.Login.verifyLoginAndSubmit(form);return false},commentUsingFacebook:function(){Pelago.Login.verifyLogin(function(){$("#comment_using_facebook").hide();$("#add_feed_comment_form").show();$("#feed_entry_input").focus()})},removeComment:function(id,callback){removeComment(id,callback)},removeNote:function(id,callback){removeNote(id,callback)}}}();var LiveFeed=function(){return{reset:function(a,b){if(a.value==""){b.reset()}}}}();var LikeIt=function(){var b=false;var e=false;var c=false;function a(){d()}function d(){$(".cool_link").live("mouseover",function(){$(".heart_image").attr("src","/images/icons/heart.gif")});$(".cool_link").live("mouseout",function(){$(".heart_image").attr("src","/images/icons/heart_empty.gif")});$(".uncool_link").live("mouseover",function(){$(".heart_image").attr("src","/images/icons/heart_empty.gif")});$(".uncool_link").live("mouseout",function(){$(".heart_image").attr("src","/images/icons/heart.gif")});$(".cool_link a").live("click",function(g){g.preventDefault();$.ajaxUpdate($(this).attr("href"),{dataType:"text/fragment",replace:".story_footer_like",verifyLogin:true,fullRequestAfterLogin:true,data:{format:"fragment",t:new Date().getTime()}})});$(".uncool_link a").live("click",function(g){g.preventDefault();$.ajaxUpdate($(this).attr("href"),{dataType:"text/fragment",replace:".story_footer_like",verifyLogin:true,fullRequestAfterLogin:true,data:{format:"fragment",t:new Date().getTime()}})
})}function f(){if(window.Slideshow&&c){Slideshow.saveCurrentSlide();c=false}}$(function(){a()});return{closePeopleWhoLiked:function(){if(e){$(".people_who_liked").slideUp();e=false}},initToggle:function(g,h,i){$(h).die("click");$(h).live("click",function(){LikeIt.togglePeopleWhoLiked(g,i)})},togglePeopleWhoLiked:function(i,h){var j=$(h)[0];var g=$(".people_who_liked",j);if(g&&e){g.slideUp();e=false}else{c=true;$(h).load(i,null,function(){var k=$(".people_who_liked",j);if(k&&!e){k.slideDown("normal",f);e=true}})}}}}();var Embed=function(){var e={width:263,height:372};var k={width:423,height:532};var b=null;var d="small";function l(){var n=d=="small"?"Widget265_Header.png":"Widget425_Header.png";var p="http://"+location.host+"/images/mini/"+n;var o='<img src="'+p+'" alt="" style="border: none ; padding: 0;">';return'<div id="embed_story_header" style="line-height: 0;"><a href="http://whrrl.com">'+o+"</a></div>"}function g(n){return"http://"+location.host+n+"?s="+d+(b.sharer?"&sharer="+b.sharer:"")}function f(n,o){var p=$("<iframe></iframe>");var q=g(n);p.attr("frameborder",0);p.attr("style","border: 1px solid #D3D3D3;");p.attr("height",o=="large"?k.height:e.height);p.attr("marginheight",0);p.attr("marginwidth",0);p.attr("scrolling","no");p.attr("src",q);p.attr("width",o=="large"?k.width:e.width);return $("<div />").append(p).html()}function c(){var n='<a style="color: #569bb5; text-decoration: none; border: 0px; cursor: pointer;" href="';return n}function j(){var A='<div style="background: #E0EBE9 none repeat scroll 0 0;color: #818E97;font-size: 18px;font-weight: bold;border-left: 1px solid #818E97; border-right: 1px solid #818E97; border-top: 1px solid #818E97; height: 30px">';
var z=' style="border: none ; padding-right: 1px;"';var x="http://"+location.host+"/images/icons/digg.gif";var o='<img src="'+x+'" title="Digg This" alt="Digg" width="16" height="16" '+z+"/>";var B="http://digg.com/submit?url="+b.link+"&title="+b.title+"&bodytext="+b.description;var y="http://"+location.host+"/images/icons/facebook.gif";var n='<img src="'+y+'" title="Share on Facebook" alt="Facebook" width="16" height="16" '+z+"/>";var p="http://www.facebook.com/sharer.php?u="+b.link+"&t="+b.title;var q="http://"+location.host+"/images/icons/twitter.gif";var w='<img src="'+q+'" title="Share on Twitter" alt="Twitter" width="16" height="16" '+z+"/>";var v="http://twitter.com/home?status=Check out "+b.link;var t=c()+B+'">'+o+"</a>";var u=c()+p+'">'+n+"</a>";var s=c()+v+'">'+w+"</a>";var r='<div id="share_story" style="margin-top: 5px; margin-bottom: 5px;"> <span style="margin-right: 5px;  margin-left: 5px; font-family: Arial, Verdana, Geneva, Helvetica, sans-serif;">Share</span>'+t+u+s+"</div>";
return A+r+"</div>"}function a(){var p='<div style="background: #E0EBE9 none repeat scroll 0 0; color: #818E97;font-size: 14px;font-family: Arial, Verdana, Geneva, Helvetica, sans-serif; font-weight: bold;border: 1px solid #818E97; height: 40px; line-height:1;">';var n=c()+b.placeLink+'">More Stories at '+b.placeName+"</a>";var o='<div style="margin-top: 5px; margin-left: 5px;">'+n+"</div>";return p+o+"</div>"}function i(){var n=b.title.replace("'","\\'");var p="http://www.facebook.com/sharer.php?u="+b.link+"&t="+n;var o='<script type="text/javascript">$(".share_facebook").click(function(e) {e.preventDefault();window.open("'+p+"\",'sharer','toolbar=0,status=0,width=626,height=436');return false;});<\/script>";return o}function h(u){var x=(d=="small"?e.height:k.height)+"px";var n=(d=="small"?e.width:k.width);var o='<div id="embed_story" style="width:'+n+'px;">';var t=l();var s=f(b.iframeUrl,d);var q=j();var v=b.placeName.length>0?a():"";var y=i();var p=d=="small"?"500px":"600px";var r=s;
var w="<div style='font-size:11px;color:#777;background-color:#D3D3D3;font-family:arial,sans-serif;height:18px;overflow: hidden;width:"+(n+2)+"px;'>";if(b.placeId){w+="<div style='float:left;margin: 2px 8px 0px 8px;'>More check-ins at <a href=\""+b.placeLink+"\" style='color:#569bb5'>"+b.placeName+"</a></div>"}w+="<div style='float:right;padding: 2px 8px 2px 0px;'>Powered&nbsp;by&nbsp;<a href=\"http://whrrl.com\" style='color:#569bb5'>Whrrl</a></div><div style=\"clear:both;\" ></div></div>";r="<div>"+r+w+"</div>";if(u){r="<div style='width:"+p+"'> "+r+"</div>"}return r}function m(){var n=h(false);$("#embed_html").val(n)}return{initialize:function(n){b=n},selectSmall:function(){d="small";m();$("#embed_single_large").removeClass("embed_selected");$("#embed_single_small").addClass("embed_selected")},selectLarge:function(){d="large";m();$("#embed_single_small").removeClass("embed_selected");$("#embed_single_large").addClass("embed_selected")},getHtml:function(){return h(false)},getAbsHtml:function(){return h(true)
}}}();