window.plaxoCookieName="Plaxo";window.res={};if(typeof(dojo)!='undefined'){var $=dojo.byId;if(typeof djConfig=='undefined')var djConfig={};djConfig.usePlainJson=true;}
function hide(e){if(e&&e.style)e.style.display='none';}
function show(e,displayType){if(!e||!e.style)return;if(typeof(displayType)=='undefined')displayType='';if(displayType=='table-row'&&dojo.isIE)displayType='block';e.style.display=displayType;}
function setDisplay(e,_show){_show?show(e):hide(e);}
function isDisplayed(e){return e.style.display!='none';}
function setVisibility(e,visible){e.style.visibility=visible?"":"hidden";}
function toggleById(id){var e=$(id);if(!e)return;if(e.style.display=='none'){show(e);}
else{hide(e);}}
function deleteElement(elem){elem.parentNode.removeChild(elem);}
function getCookie(c_name){var ret='';if(document.cookie.length>0){c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1){c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;ret=unescape(document.cookie.substring(c_start,c_end));}}
return ret;}
function setCookie(c_name,value,domain,path,expiredays){var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=c_name+"="+escape(value)+
((expiredays==null)?"":";expires="+exdate.toGMTString())+
((path==null)?"":";path="+path)+
((domain==null)?"":";domain="+domain);}
function setPlaxoCookie(c_name,value){return setCookie(c_name,value,'.plaxo.com','/');}
function escapeXML(str,noSingleQuotes){if(!str||!str.replace||!str.length){return str;}
str=str.replace(/&/gm,"&").replace(//gm,">").replace(/"/gm,""");if(!noSingleQuotes){str=str.replace(/'/gm,"'");}
return str;}
function unescapeHtml(html){var node=document.createElement("DIV");node.innerHTML=html;return node.innerText||node.textContent||html;}
function setCaretPos(ctrl,pos){if(ctrl.setSelectionRange){ctrl.focus();ctrl.setSelectionRange(pos,pos);}
else if(ctrl.createTextRange){var range=ctrl.createTextRange();range.collapse(true);range.moveEnd('character',pos);range.moveStart('character',pos);range.select();}}
function getCaretPos(ctrl){if(typeof ctrl.selectionStart!='undefined')
return ctrl.selectionStart;if(document.selection){if(ctrl.nodeName=='INPUT')return Math.abs(document.selection.createRange().moveStart("character",-1000000));var sel=document.selection.createRange();var sel2=sel.duplicate();sel2.moveToElementText(ctrl);sel2.setEndPoint('EndToEnd',sel);return sel2.text.length-sel.text.length;}
return 0;}
function getRadioValue(ctrl){if(!ctrl)return"";var len=ctrl.length;if(len==undefined){if(ctrl.checked)return ctrl.value;else return"";}
for(var i=0;i=url.length)return'';return url.substring(qpos);}
function getQueryObject(url){return dojo.queryToObject(getQueryString(url));}
function scrollIntoInnerView(elem,list){var elemTop=elem.offsetTop;var elemBottom=elemTop+elem.offsetHeight;if(elemTop(list.scrollTop+list.clientHeight)){list.scrollTop=elemBottom-list.clientHeight;}}
function i18n_text(string,vars){for(key in vars){string=string.replace('{$'+key+'}',vars[key],'g');}
return string;}
function i18n_plural(strings,number,vars){vars=vars||{};vars.num=number;string=strings[number==1?0:1];return i18n_text(string,vars);}
var heart={redirect:function(controller,action,vars,getVars,anchor,protocol,source){url=this.makeUrl(controller,action,vars,getVars,anchor,protocol,source);window.location=url;},makeUrl:function(controller,action,vars,getVars,anchor,protocol,source){var url="/pulse/";url+=controller;url+="/";url+=action;if(vars){url+="/";if(vars.join){url+=vars.join("/");}else{url+=vars;}}
url+="/";if(source){if(!getVars)getVars={};getVars["ps"]=source;}
if(getVars){var q=dojo.objectToQuery(getVars);if(q){url+="?";url+=q;}}
if(anchor){url+="#";url+=anchor;}
return url;},makeSubclass:function(subClass,baseClass){function inheritance(){}
inheritance.prototype=baseClass.prototype;subClass.prototype=new inheritance();subClass.prototype.constructor=subClass;subClass.prototype.base=baseClass.prototype;},round:function(value,places,multiple){var pieces=String(value).split(".");var length=(pieces[1]&&pieces[1].length)||0;if(length>places){var factor=Math.pow(10,places);if(multiple>0){factor*=10/multiple;places++;}
value=Math.round(value*factor)/factor;pieces=String(value).split(".");length=(pieces[1]&&pieces[1].length)||0;if(length>places){pieces[1]=pieces[1].substr(0,places);value=Number(pieces.join("."));}}
return value;},indexOfKey:function(array,keyName,keyValue,fromIndex){for(var i=fromIndex||0;ix';if(flash){flash.className=type;flash.innerHTML=closeLink+text;fadeIn(flash);}}
function setFlashCookie(text,type){setPlaxoCookie('flash',dojo.toJson({'text':text,'type':type}));}
function fadeIn(elem,duration,onEndFunc){if(!duration)duration=1000;elem=dojo.byId(elem);elem.style.opacity=0;elem.style['-moz-opacity']=0;elem.style.filter='alpha(opacity=0)';show(elem);var opts={node:elem,duration:duration};if(onEndFunc)opts.onEnd=onEndFunc;dojo.fadeIn(opts).play();}
function fadeOut(elem,duration,hideOnEnd,onEndFunc){if(!duration)duration=1000;elem=dojo.byId(elem);elem.style.opacity=1;elem.style['-moz-opacity']=1;elem.style.filter='alpha(opacity=100)';var opts={node:elem,duration:duration};if(hideOnEnd||onEndFunc)opts.onEnd=function(){if(hideOnEnd)hide(elem);if(onEndFunc)onEndFunc();};dojo.fadeOut(opts).play();}
function showSuccessMessage(text){showFlash(text,'success');}
function showErrorMessage(text){showFlash(text,'error');}
function showNoticeMessage(text){showFlash(text,'notice');}
function hideFlash(type){var flash=$('flash');if(!flash)return;if(typeof type=='undefined'||flash.className==type)
hide(flash);}
function focusFirstInput(startElem){var inputElements=(startElem?startElem.getElementsByTagName('input'):document.getElementsByTagName('input'));var i,el;try{for(i=0;i0&&(el.type=="text"||el.type=="password")&&(el.getAttribute('autofocus')!='false')&&(el.value==''||el.value==el.getAttribute('defaultText'))){el.focus();return;}}}catch(e){}
inputElements=(startElem?startElem.getElementsByTagName('textarea'):document.getElementsByTagName('textarea'));try{for(i=0;i0&&(el.value==''||el.value==el.getAttribute('defaultText')||el.innerHTML==el.getAttribute('defaultText'))){el.focus();return;}}}catch(e){}}
var g_openedMenu=null;function menuToggle(menu,event){var secondClick=(menu==g_openedMenu);menuClose(g_openedMenu);if(!secondClick){menuOpen(menu);stopPropagation(event);}}
function menuOpen(menu,useIFrame){if(!menu)return;var dropdown=menu.getElementsByTagName('div')[0];menu.style.zIndex=1;show(dropdown);g_openedMenu=menu;if(useIFrame&&dojo.isIE&&dojo.isIE<7)enableIFrame(dropdown);}
function menuClose(menu,useIFrame){if(!menu)return;var dropdown=menu.getElementsByTagName('div')[0];menu.style.zIndex=0;hide(dropdown);g_openedMenu=null;if(useIFrame&&dojo.isIE&&dojo.isIE<7)hideIFrame(dropdown);}
dojo.connect(document,'click',function(e){e=e||window.event;if(dojo.isFF&&e.button)return;menuClose(g_openedMenu);});function validateYear(){var values=affiliationsForm["affiliationsIds"];var ids=values.value.split(" ");var errors=false;for(var i=0;i0)){errors=true;break;}}}}
if(errors){alert('Please enter appropriate "From:" and "To:" years');return false;}
return true;}
function enableIFrame(el,width,height){var iframeId=el.id+'_iframe';var iframe=$(iframeId);if(!iframe){iframe=document.createElement("iframe");iframe.src='about:blank';iframe.name=el.id+'_iframe';iframe.id=el.id+'_iframe';iframe.className='bgFrame';}
var parent=el.parentNode;if(parent){parent.appendChild(iframe);}else{document.body.appendChild(iframe);}
iframe.style.zIndex=el.style.zIndex-1;iframe.style.display=el.style.display;var coords=dojo.coords(el,true);iframe.style.top=coords.t+'px';iframe.style.left=coords.l+'px';if(!width)width=el.clientWidth;if(!height)height=el.clientHeight;iframe.style.width=((width+4)+"px");iframe.style.height=((height+4)+"px");return iframe;}
function hideIFrame(el){var iframeId=el.id+'_iframe';var iframe=$(iframeId);if(iframe)hide(iframe);}
function validate_sharing_options(shareform){var with_groups=shareform.elements.with_groups;var with_individuals=shareform.elements.share_individuals;var with_public=shareform.elements.with_public;var blankRE=/^\s*$/;var groupSelected=false;for(var i=0;i=g_pollBars_curStep*g_pollBars_pxPerStep){barEle.width=maxWidth*(g_pollBars_curStep/numSteps);}else if(resultEle.style.display=='none'){show(resultEle);}}
g_pollBars_curStep++;setTimeout(function(){animatePollBars(pollId,widths,maxWidth);},g_pollBars_duration*1.0/numSteps);}else{for(i=0;iLoading...';},_updatePosition:function(){var de=document.documentElement;var scrollTop=de.scrollTop?de.scrollTop:document.body.scrollTop;var box=dojo.contentBox(this._wrapper);var visibleHeight=document.documentElement.clientHeight;var top=130;if(box.h>visibleHeight){top=5;}else if(box.h+top>visibleHeight){top=(visibleHeight-box.h)/2;}
this._wrapper.style.top=(scrollTop+top)+'px';},_updateOverlay:function(){var box=dojo.contentBox(dojo.body());var windowHeight=dojo.isIE?document.documentElement.clientHeight:window.innerHeight;this._overlay.style.height=Math.max(box.h,windowHeight)+'px';},show:function(){this._open=true;show(this._overlay);this._updateOverlay();if(this._args.contentUrl){this._showLoading();show(this._wrapper);this._loadRemoteContent();}else{this._contentDiv=$(this._args.contentId);this._wrapper.appendChild(this._contentDiv);this._hideSelects();show(this._wrapper);show(this._contentDiv);focusFirstInput(this._wrapper);this._updatePosition();this.onOpen();}},showError:function(str){var errorDiv=dojo.query('.error',this._wrapper)[0];if(errorDiv){errorDiv.innerHTML=str;show(errorDiv);fadeIn(errorDiv,750);}else{alert(unescapeHtml(str));}},submit:function(form){var self=this;var throbber=dojo.query('img.throbber',this._wrapper)[0];var submit=dojo.query('input[type=submit]',this._wrapper)[0];if(submit)submit.disabled='disabled';if(throbber)show(throbber);var successFunc=function(){if(submit)submit.disabled=false;if(throbber)hide(throbber);};var errorFunc=function(){alert('Error submitting... please try again in a few minutes.');if(submit)submit.disabled=false;if(throbber)hide(throbber);};sendXhrForm(form,successFunc,errorFunc);},close:function(){hide(this._wrapper);hide(this._overlay);this._open=false;if(this._args.contentUrl){this._wrapper.removeChild(this._contentDiv);}else{document.body.appendChild(this._contentDiv);hide(this._contentDiv);}
this._restoreSelects();this.onClose();},_hideSelects:function(){if(!dojo.isIE||dojo.isIE>=7)return;this._selectElems=dojo.query('select',$('contentContainer'));for(var i=0;i=7)return;for(var i=0;i a',fakeTextDiv);for(var i=0;i'+name+'';fakeTextDiv.appendChild(link);}}
currentSharingOptions.groups=newSharingOptions;}
function getSharedWithGroups(){var data={};var fakeTextDiv=$('sharebar_fake_text');var sharingRE=/(with_group_|with_business|with_friends|with_family|with_public)/;var checks=fastFindElems(fakeTextDiv,'input','checkbox',false);for(var c in checks){var check=checks[c];if(sharingRE.test(check.name)&&check.checked){data[check.name]=getGroupNameFromInput(check);}}
return data;}
function getGroupNameFromInput(input){return input.parentNode.getElementsByTagName('label')[0].innerHTML;}
function getAlbumSharedWithText(album,form){var names=[];var groups=album.groups;for(var i=0;i'+email+'';fakeTextDiv.appendChild(link);}}
currentSharingOptions.individuals=emails.join(', ');}
function sbox_changeType(type,firstTime){if(!pulse._domLoaded)return;if(!firstTime)hide_fields();sb_init();var shareform=document.forms.sharebox;var elem_type=shareform.elements.shareType;var elem_desc=shareform.elements.desc;var elem_url=shareform.elements.url;var elem_reviewTitle=shareform.elements.review_title;var elem_header_msg=$('share_message');var elem_header_link=$('share_link');var elem_header_video=$('share_video');var elem_header_review=$('share_review');var elem_linkRow=$('sharebar-linkRow');var elem_reviewRow=$('sharebar-reviewRow');var elem_reviewRating=$('sharebar-reviewRating');var elem_reviewType=$('sharebar-reviewType');var focusElem=null;unsetDefaultText(elem_desc,shareboxDefaultText[elem_type.value]);setDefaultText(elem_desc,shareboxDefaultText[type]);setDefaultText(elem_reviewRow,'What are you reviewing?');switch(type){case'message':show(elem_desc);show(elem_header_msg);focusElem=elem_desc;break;case'link':show(elem_linkRow);show(elem_url);show(elem_desc);show(elem_header_link);if(elem_url.value==shareboxDefaultText.url)focusElem=elem_url;else focusElem=elem_desc;break;case'video':show(elem_linkRow);show(elem_url);show(elem_desc);show(elem_header_video);if(elem_url.value==shareboxDefaultText.url)focusElem=elem_url;else focusElem=elem_desc;break;case'review':show(elem_reviewRow);show(elem_reviewType);show(elem_reviewRating);show(elem_url);show(elem_desc);show(elem_header_review);focusElem=elem_reviewTitle;break;default:return;}
elem_type.value=type;pulse.openLightbox('sharebox');if(focusElem)focusElem.focus();}
function sb_create(form,doAjax,validator){if(!validator)validator=sb_validate;var elem_submit=form.elements.share;var throbber=dojo.query('.ajaxStatus',form)[0];elem_submit.style.disabled='disabled';var callback=function(){hide(throbber);form.elements.share.disabled=false;};if(validator(form)){if(doAjax){show(throbber);sendXhrForm(form,callback,callback);}else{return true;}}else{elem_submit.style.disabled='';}
return false;}
function sb_validate(form){var errors=false;var shareform=(form&&typeof form!='undefined')?form:document.forms.sharebox;var elem_desc=shareform.elements.desc;var type=shareform.elements.shareType.value;var formSelect=shareform.elements.review_type;var sharingValidated=validate_sharing_options(shareform);if(!sharingValidated){errors=true;}else if((type=='link'||type=='video')&&(shareform.elements.url.value=='http://')){alert('Please enter a url');errors=true;}else if(type=='review'&&shareform.elements.review_title.value=='What are you reviewing?'){alert('Please enter what it is you are reviewing.');errors=true;}else if(type=='review'&&formSelect.options[formSelect.selectedIndex].value=='pick'){alert('Please select a review category');errors=true;}else if(formSelect.options[formSelect.selectedIndex].value=='other'&&shareform.elements.review_other.value.length==0){alert('Please type in a review category or select one that is appropriate');errors=true;}
else if(elem_desc&&((type=='message'&&elem_desc.value.length==0)||(type=='message'&&elem_desc.value==shareboxDefaultText[type]))){alert('Please enter a message');errors=true;}
else if(elem_desc.value.length>10000){alert('Message must be less than 10,000 characters. Yours is '+elem_desc.value.length+' characters.');errors=true;}
else if(elem_desc&&elem_desc.value==shareboxDefaultText[type]){elem_desc.value='';}
if(type=='message'){shareform.elements.url.value='';}
if(errors){return false;}
return true;}
function poll_validate(form){var errors=false;var shareform=(form&&typeof form!='undefined')?form:document.forms.polls;var elem_submit=shareform.elements.share;shareform.elements.shareType.value='poll';elem_submit.disabled='disabled';var answers=0;for(var i=1;i<=10;i++){if(shareform['answer_'+i].value)answers++;}
var sharingValidated=validate_sharing_options(shareform);if(!sharingValidated){errors=true;}else if(shareform.elements.question.value=='e.g. What is your favorite food?'){alert('Please enter a poll question');errors=true;}
else if(answers<=1){alert('Please enter more than 1 answer');errors=true;}
if(errors){elem_submit.disabled='';return false;}
return true;}
function sb_set_stars(num){var shareform=document.forms.sharebox;for(var i=1;i<=5;i++){var elem=$('star_'+i);if(elem){elem.src=(i<=num)?"/pulse/img/star_filled.gif":"/pulse/img/star_empty.gif";}}
shareform.elements.stars.value=''+num;}
function sb_hover_cancel(){var elem=$("no_star");elem.src="/pulse/img/cancel_full.gif";}
function sb_off_cancel(){var elem=$("no_star");elem.src="/pulse/img/cancel_empty.gif";}
function check_review(formSelect){var selected=formSelect.options[formSelect.selectedIndex].value;var form=document.forms.sharebox;if(selected=='other'){show(form['review_other']);}else{hide(form['review_other']);}}
function show_next_answer(num){var elem_answerRow=$('sharebar-answerRow'+num);show(elem_answerRow);}
function sb_photo_cancel(){var uploaderStats=uploader.core.getStats();if(uploaderStats&&uploaderStats.in_progress){if(!confirm("An upload is currently in progress. Are you sure you want to stop it?"))return;}
uploader.cancelAll();pulse.closeCurrentLightbox();}
function sb_photo_page(num){if(num==2){if(isDisplayed($('new_album'))){if(!validateAlbumProperties('sb_create_album_form')){return;}}else if(isDisplayed($('existing_album'))){var albumId=window.curAlbumNode.getAttribute("albumId");setSharingOptions(albumArr[albumId]);if(!validate_sharing_options($("existingalbum_form")))
return;}else{alert("You need to select either 'Create a new album' or 'Choose an existing album'.");return;}}
setDisplay($('photo_sharebox1'),num==1);setDisplay($('photo_sharebox2'),num==2);if(num==1){if(window.scrollAlbumIntoView){window.scrollAlbumIntoView=false;scrollIntoInnerView(window.curAlbumNode,$('albumItems'));}}}
function sb_photo_upload_validate(){if(uploader.numFiles<1){alert("Please add some files by clicking '"+$('upload_add_files').innerHTML+"'.");return false;}
return true;}
function sb_photo_upload(){if(!sb_photo_upload_validate())return;if(isDisplayed($('new_album'))){createAlbum();return;}
var albumId=window.curAlbumNode.getAttribute("albumId");if(albumId==-1){createDefaultAlbum();return;}
if(albumArr[albumId].dirty){editAlbumPerms(albumId);return;}
sb_photo_upload_helper(albumId);}
function sb_photo_upload_impl(albumId){setPhotoUiEnabled(false);var params=new Object();params["album"]=albumId;params["session"]=getCookie(window.plaxoCookieName);uploader.core.setPostParams(params);uploader.startUpload();}
function sb_photo_upload_helper(albumId){var form=$('sb_photo_finalize');form.album_id.value=albumId;form.send_email.value=albumArr[albumId].notify?"1":"0";sb_photo_upload_impl(albumId);}
function sb_photo_add_files(){uploader.core.selectFiles();}
function sb_photo_reset(noUploader){if(!noUploader){uploader.init();$('photo_list').innerHTML='';$('upload_add_files').innerHTML=res.photo.addPhotos;uploader.intro=true;$('upload_box').style.visibility="hidden";}
setPhotoUiWaiting(false);$('album_name').value='';$('album_desc').value='';window.scrollAlbumIntoView=false;window.newAlbumPerms={groups:[],individuals:''};sb_photo_page(1);album_tab(-1);}
function sb_photo_open_newalbum(){if(!sb_photo_open())return;sb_photo_show_newalbum();}
function sb_photo_open(){if(!pulse._domLoaded)return false;sb_photo_reset();pulse.openLightbox('sharebox_photos');return true;}
function sb_photo_show_newalbum(){$('albumOptNew').click();}
function sb_photo_hide_newalbum(){$('albumOptExisting').click();}
function showEditAlbumFakeText(form){var fakeTextContainer=fastFindElems(form,'div','editalbum_fake_text',true);var fakeTextDiv=$('sharebar_fake_text');fakeTextContainer.appendChild(fakeTextDiv);show(fakeTextDiv);}
function album_tab(which){if(which==0){show($('existing_album'));hide($('new_album'));newAlbumPerms=dojo.clone(currentSharingOptions);var fakeTextContainer=$('existingalbum_fake_text');var fakeTextDiv=$('sharebar_fake_text');fakeTextContainer.appendChild(fakeTextDiv);hide(fakeTextDiv);if(!window.curAlbumNode){for(var id in albumArr){onAlbumItemClick($('albumItem'+id));break;}}}else if(which==1){hide($('existing_album'));show($('new_album'));showEditAlbumFakeText($('sb_create_album_form'));setSharingOptions(newAlbumPerms);setSharedWithData();if(isDisplayed($('photo_sharebox'))){try{$('album_name').focus();}catch(e){}}}else{hide($('existing_album'));hide($('new_album'));$('albumOptNew').checked=false;$('albumOptExisting').checked=false;}}
function sb_photo_enable_album_form(form_id,enable){var shareform=$(form_id);var numEls=shareform.elements.length;for(var i=0;i255){alert('Your name is '+(name.length-255)+' characters too long.');return false;}
if(!isEdit){var a1=name.toLowerCase();for(var i=0;i255){alert('Your album description is '+(desc.length-255)+' characters too long.');return false;}
return validate_sharing_options($(form_id));}
function setPhotoUiEnabled(enabled){$('upload_button').disabled=!enabled;setVisibility($('photo_upload_back'),enabled);sb_photo_enable_album_form('sb_create_album_form',enabled);}
function setPhotoUiWaiting(waiting){var throbber=$('album_throbber_div');if(waiting)
$('upload_footer_content').appendChild(throbber);setDisplay(throbber,waiting);setDisplay($('file_count'),!waiting);setPhotoUiEnabled(!waiting);}
function editAlbumPerms(albumId){var editForm=$('existingalbum_form');editForm.action="/pulse/photos/editDeleteAlbum";var onError=function(resp){alert(resp.error||'Sorry, there was an error updating the album. Please try again later.');setPhotoUiWaiting(false);};var onSuccess=function(resp){setPhotoUiWaiting(false);sb_photo_upload_helper(albumId);};var onResponse=function(resp){return resp.error?onError(resp):onSuccess(resp);}
sendXhrForm(editForm,onResponse,onError,'json',{"album_id":albumId});setPhotoUiWaiting(true);}
function onCreateAlbumSuccess(response){setPhotoUiWaiting(false);eval(response);}
function createDefaultAlbum(){var shareform=$('existingalbum_form');shareform.action=$('sb_create_album_form').action;$('sb_create_default').value=1;var errorCallback=function(){alert('Could not create default album, please try again in a minute.');setPhotoUiWaiting(false);};sendXhrForm(shareform,onCreateAlbumSuccess,errorCallback,'text');setPhotoUiWaiting(true);}
function createAlbum(){$('sb_create_default').value=0;var shareform=$('sb_create_album_form');var errorCallback=function(response){alert('Error creating album. Please try again in a minute.');setPhotoUiWaiting(false);};sendXhrForm(shareform,onCreateAlbumSuccess,errorCallback,'text');setPhotoUiWaiting(true);return true;}
function sb_polls_open(){if(!pulse._domLoaded)return;poll_init();clearSharingOptions();pulse.openLightbox('sharebox_poll');}
function updateAlbumPermsUI(){var albumId=window.curAlbumNode.getAttribute("albumId");$('album_perms').innerHTML=getAlbumSharedWithText(albumArr[albumId],$('existingalbum_form'));$('album_notify').innerHTML=albumArr[albumId].notify?'on':'off';}
function onAlbumItemClick(node){if(!node)return;if(window.curAlbumNode){window.curAlbumNode.style.backgroundColor="";}
node.style.backgroundColor="#c3d9ff";window.curAlbumNode=node;updateAlbumPermsUI();}
function albumItemsEqual(album1,album2){return dojo.toJson(album1)==dojo.toJson(album2);}
function editAlbumSharing(event){var albumId=window.curAlbumNode.getAttribute("albumId");setSharingOptions(albumArr[albumId]);show($('sharebar_fake_text'));showShareWith(event,function(canceled){hide($('sharebar_fake_text'));if(!canceled){if(!albumItemsEqual(albumArr[albumId],currentSharingOptions)){albumArr[albumId]=dojo.clone(currentSharingOptions);albumArr[albumId].dirty=true;updateAlbumPermsUI();}}});}
var uploader={init:function(){uploader.numFiles=0;uploader.cancelFlag=false;uploader.maxTotalPct=.95;uploader.maxFakePct=.25;uploader.maxSendPct=uploader.maxTotalPct-uploader.maxFakePct;setVisibility($('upload_add_files'),true);var flashVer=deconcept.SWFObjectUtil.getPlayerVersion();if(flashVer.major<8){$("albums").style.display="none";$("flashRequired").style.display="";}
if(!uploader.core)uploader.core=new SWFUpload({upload_url:"/pulse/photos/upload/",file_size_limit:"10240",file_types:"*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG;*.gif;*.GIF;*.bmp;*.BMP",file_types_description:"Images",file_upload_limit:"0",file_queue_limit:"100",file_post_name:"Filedata",file_queued_handler:uploader.fileQueued,file_queue_error_handler:uploader.fileQueueError,file_dialog_complete_handler:uploader.fileDialogComplete,upload_start_handler:uploader.uploadStart,upload_progress_handler:uploader.uploadProgress,upload_error_handler:uploader.uploadError,upload_success_handler:uploader.uploadSuccess,upload_complete_handler:uploader.uploadComplete,flash_url:'/pulse/swf/swfupload_f8.swf',debug:false});},getStats:function(){return uploader.core.getStats()||{};},startUpload:function(){uploader.cancelFlag=false;setVisibility($('upload_add_files'),false);uploader.core.startUpload();},cancelAll:function(){if(uploader.getStats().in_progress>0){uploader.cancelFlag=true;}
while(uploader.getStats().files_queued>0){uploader.core.cancelUpload();}},fakeServerProgress:function(updateInterval,divProg,pct,step){function doProgress(){if(divProg._done)
return;pct+=step;if(pct>uploader.maxTotalPct)
pct=uploader.maxTotalPct;uploader.setProgress(divProg,pct);if(pct";var divProg=document.createElement('div');divProg.className="progress progress_fill";divProg.id="fileprog_"+fileObj.id;var divBg=document.createElement('div');divBg.className="progress progress_bg";var divItem=document.createElement('div');divItem.className="upload_item";divItem.appendChild(tblItem);divContainer.appendChild(divBg);divContainer.appendChild(divProg);divContainer.appendChild(divItem);$('photo_list').appendChild(divContainer);},fileDialogComplete:function(numFilesSelected){uploader.updateFileCount();if(numFilesSelected){if(uploader.intro){uploader.intro=false;$('upload_box').style.visibility="";$('upload_add_files').innerHTML=res.photo.addMorePhotos;}else{var nodList=$('photo_list');nodList.scrollTop=nodList.scrollHeight;}
$('upload_button').focus();}
if(uploader.queueMsg){alert(uploader.queueMsg);uploader.queueMsg="";}},uploadComplete:function(fileObj){if(uploader.cancelFlag){uploader.cancelFlag=false;return;}
if(this.getStats().files_queued>0){this.startUpload();}else{$('sb_photo_finalize').submit();}},fileQueueError:function(fileObj,errCode,errMsg){if(errCode==SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){alert("Cannot add files. There is a limit of "+this.getSetting("file_queue_limit")+" files per upload.");return;}
if(!uploader.queueMsg){uploader.queueMsg="Could not add the following files:\n";}
uploader.queueMsg+=fileObj.name+": "+errMsg+"\n";},uploadError:function(fileObj,errCode,errMsg){if(errCode==SWFUpload.UPLOAD_ERROR.FILE_CANCELLED)
return;uploader.cancelFlag=true;var msg="Error uploading "+fileObj.name+": "+errMsg+"\n";var cont=true;if(this.getStats().files_queued>0){msg+="Continue uploading the remaining files?";cont=confirm(msg);}else{alert(msg);}
if(cont){uploader.uploadComplete.call(this,fileObj);}else{uploader.cancelAll();sb_photo_reset();}}};var SWFUpload=function(init_settings){this.initSWFUpload(init_settings);};SWFUpload.prototype.initSWFUpload=function(init_settings){try{document.execCommand('BackgroundImageCache',false,true);}catch(ex1){}
try{this.customSettings={};this.settings={};this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings(init_settings);this.loadFlash();this.displayDebugInfo();}catch(ex2){this.debug(ex2);}}
SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.prototype.initSettings=function(init_settings){this.addSetting("upload_url",init_settings.upload_url,"");this.addSetting("file_post_name",init_settings.file_post_name,"Filedata");this.addSetting("post_params",init_settings.post_params,{});this.addSetting("file_types",init_settings.file_types,"*.*");this.addSetting("file_types_description",init_settings.file_types_description,"All Files");this.addSetting("file_size_limit",init_settings.file_size_limit,"1024");this.addSetting("file_upload_limit",init_settings.file_upload_limit,"0");this.addSetting("file_queue_limit",init_settings.file_queue_limit,"0");this.addSetting("flash_url",init_settings.flash_url,"swfupload.swf");this.addSetting("flash_width",init_settings.flash_width,"1px");this.addSetting("flash_height",init_settings.flash_height,"1px");this.addSetting("flash_color",init_settings.flash_color,"#FFFFFF");this.addSetting("debug_enabled",init_settings.debug,false);this.flashReady_handler=SWFUpload.flashReady;this.swfUploadLoaded_handler=this.retrieveSetting(init_settings.swfupload_loaded_handler,SWFUpload.swfUploadLoaded);this.fileDialogStart_handler=this.retrieveSetting(init_settings.file_dialog_start_handler,SWFUpload.fileDialogStart);this.fileQueued_handler=this.retrieveSetting(init_settings.file_queued_handler,SWFUpload.fileQueued);this.fileQueueError_handler=this.retrieveSetting(init_settings.file_queue_error_handler,SWFUpload.fileQueueError);this.fileDialogComplete_handler=this.retrieveSetting(init_settings.file_dialog_complete_handler,SWFUpload.fileDialogComplete);this.uploadStart_handler=this.retrieveSetting(init_settings.upload_start_handler,SWFUpload.uploadStart);this.uploadProgress_handler=this.retrieveSetting(init_settings.upload_progress_handler,SWFUpload.uploadProgress);this.uploadError_handler=this.retrieveSetting(init_settings.upload_error_handler,SWFUpload.uploadError);this.uploadSuccess_handler=this.retrieveSetting(init_settings.upload_success_handler,SWFUpload.uploadSuccess);this.uploadComplete_handler=this.retrieveSetting(init_settings.upload_complete_handler,SWFUpload.uploadComplete);this.debug_handler=this.retrieveSetting(init_settings.debug_handler,SWFUpload.debug);this.customSettings=this.retrieveSetting(init_settings.custom_settings,{});};SWFUpload.prototype.loadFlash=function(){var html,target_element,container;if(document.getElementById(this.movieName)!==null){return false;}
try{target_element=document.getElementsByTagName("body")[0];if(typeof(target_element)==="undefined"||target_element===null){this.debug('Could not find the BODY element. SWFUpload failed to load.');return false;}}catch(ex){return false;}
container=document.createElement("div");container.style.width=this.getSetting("flash_width");container.style.height=this.getSetting("flash_height");target_element.appendChild(container);container.innerHTML=this.getFlashHTML();};SWFUpload.prototype.getFlashHTML=function(){var html="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){html='';}else{html='';}
return html;};SWFUpload.prototype.getFlashVars=function(){var param_string=this.buildParamString();var html="";html+="movieName="+encodeURIComponent(this.movieName);html+="&uploadURL="+encodeURIComponent(this.getSetting("upload_url"));html+="¶ms="+encodeURIComponent(param_string);html+="&filePostName="+encodeURIComponent(this.getSetting("file_post_name"));html+="&fileTypes="+encodeURIComponent(this.getSetting("file_types"));html+="&fileTypesDescription="+encodeURIComponent(this.getSetting("file_types_description"));html+="&fileSizeLimit="+encodeURIComponent(this.getSetting("file_size_limit"));html+="&fileUploadLimit="+encodeURIComponent(this.getSetting("file_upload_limit"));html+="&fileQueueLimit="+encodeURIComponent(this.getSetting("file_queue_limit"));html+="&debugEnabled="+encodeURIComponent(this.getSetting("debug_enabled"));return html;};SWFUpload.prototype.getMovieElement=function(){if(typeof(this.movieElement)==="undefined"||this.movieElement===null){this.movieElement=document.getElementById(this.movieName);}
return this.movieElement;};SWFUpload.prototype.buildParamString=function(){var post_params=this.getSetting("post_params");var param_string_pairs=[];var i,value,name;if(typeof(post_params)==="object"){for(name in post_params){if(post_params.hasOwnProperty(name)){if(typeof(post_params[name])==="string"){param_string_pairs.push(encodeURIComponent(name)+"="+encodeURIComponent(post_params[name]));}}}}
return param_string_pairs.join("&");};SWFUpload.prototype.addSetting=function(name,value,default_value){if(typeof(value)==="undefined"||value===null){this.settings[name]=default_value;}else{this.settings[name]=value;}
return this.settings[name];};SWFUpload.prototype.getSetting=function(name){if(typeof(this.settings[name])==="undefined"){return"";}else{return this.settings[name];}};SWFUpload.prototype.retrieveSetting=function(value,default_value){if(typeof(value)==="undefined"||value===null){return default_value;}else{return value;}};SWFUpload.prototype.displayDebugInfo=function(){var key,debug_message="";debug_message+="----- SWFUPLOAD SETTINGS ----\nID: "+this.movieName+"\n";debug_message+=this.outputObject(this.settings);debug_message+="----- SWFUPLOAD SETTINGS END ----\n";debug_message+="\n";this.debug(debug_message);};SWFUpload.prototype.outputObject=function(object,prefix){var output="",key;if(typeof(prefix)!=="string"){prefix="";}
if(typeof(object)!=="object"){return"";}
for(key in object){if(object.hasOwnProperty(key)){if(typeof(object[key])==="object"){output+=(prefix+key+": { \n"+this.outputObject(object[key],"\t"+prefix)+prefix+"}"+"\n");}else{output+=(prefix+key+": "+object[key]+"\n");}}}
return output;};SWFUpload.prototype.selectFile=function(){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SelectFile)==="function"){try{movie_element.SelectFile();}
catch(ex){this.debug("Could not call SelectFile: "+ex);}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.selectFiles=function(){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SelectFiles)==="function"){try{movie_element.SelectFiles();}
catch(ex){this.debug("Could not call SelectFiles: "+ex);}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.startUpload=function(file_id){var self=this;var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.StartUpload)==="function"){setTimeout(function(){try{movie_element.StartUpload(file_id);}
catch(ex){self.debug("Could not call StartUpload: "+ex);}},0);}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.cancelUpload=function(file_id){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.CancelUpload)==="function"){try{movie_element.CancelUpload(file_id);}
catch(ex){this.debug("Could not call CancelUpload: "+ex);}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.stopUpload=function(){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.StopUpload)==="function"){try{movie_element.StopUpload();}
catch(ex){this.debug("Could not call StopUpload: "+ex);}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.getStats=function(){var self=this;var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.GetStats)==="function"){try{return movie_element.GetStats();}
catch(ex){self.debug("Could not call GetStats");}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.setStats=function(stats_object){var self=this;var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetStats)==="function"){try{movie_element.SetStats(stats_object);}
catch(ex){self.debug("Could not call SetStats");}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.getFile=function(file_id){var self=this;var movie_element=this.getMovieElement();if(typeof(file_id)==="number"){if(movie_element!==null&&typeof(movie_element.GetFileByIndex)==="function"){try{return movie_element.GetFileByIndex(file_id);}
catch(ex){self.debug("Could not call GetFileByIndex");}}else{this.debug("Could not find Flash element");}}else{if(movie_element!==null&&typeof(movie_element.GetFile)==="function"){try{return movie_element.GetFile(file_id);}
catch(ex){self.debug("Could not call GetFile");}}else{this.debug("Could not find Flash element");}}};SWFUpload.prototype.addFileParam=function(file_id,name,value){var self=this;var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.AddFileParam)==="function"){try{return movie_element.AddFileParam(file_id,name,value);}
catch(ex){self.debug("Could not call AddFileParam");}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.removeFileParam=function(file_id,name){var self=this;var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.RemoveFileParam)==="function"){try{return movie_element.RemoveFileParam(file_id,name);}
catch(ex){self.debug("Could not call AddFileParam");}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.setUploadURL=function(url){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetUploadURL)==="function"){try{this.addSetting("upload_url",url);movie_element.SetUploadURL(this.getSetting("upload_url"));}
catch(ex){this.debug("Could not call SetUploadURL");}}else{this.debug("Could not find Flash element in setUploadURL");}};SWFUpload.prototype.setPostParams=function(param_object){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetPostParams)==="function"){try{this.addSetting("post_params",param_object);movie_element.SetPostParams(this.getSetting("post_params"));}
catch(ex){this.debug("Could not call SetPostParams");}}else{this.debug("Could not find Flash element in SetPostParams");}};SWFUpload.prototype.setFileTypes=function(types,description){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetFileTypes)==="function"){try{this.addSetting("file_types",types);this.addSetting("file_types_description",description);movie_element.SetFileTypes(this.getSetting("file_types"),this.getSetting("file_types_description"));}
catch(ex){this.debug("Could not call SetFileTypes");}}else{this.debug("Could not find Flash element in SetFileTypes");}};SWFUpload.prototype.setFileSizeLimit=function(file_size_limit){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetFileSizeLimit)==="function"){try{this.addSetting("file_size_limit",file_size_limit);movie_element.SetFileSizeLimit(this.getSetting("file_size_limit"));}
catch(ex){this.debug("Could not call SetFileSizeLimit");}}else{this.debug("Could not find Flash element in SetFileSizeLimit");}};SWFUpload.prototype.setFileUploadLimit=function(file_upload_limit){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetFileUploadLimit)==="function"){try{this.addSetting("file_upload_limit",file_upload_limit);movie_element.SetFileUploadLimit(this.getSetting("file_upload_limit"));}
catch(ex){this.debug("Could not call SetFileUploadLimit");}}else{this.debug("Could not find Flash element in SetFileUploadLimit");}};SWFUpload.prototype.setFileQueueLimit=function(file_queue_limit){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetFileQueueLimit)==="function"){try{this.addSetting("file_queue_limit",file_queue_limit);movie_element.SetFileQueueLimit(this.getSetting("file_queue_limit"));}
catch(ex){this.debug("Could not call SetFileQueueLimit");}}else{this.debug("Could not find Flash element in SetFileQueueLimit");}};SWFUpload.prototype.setFilePostName=function(file_post_name){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetFilePostName)==="function"){try{this.addSetting("file_post_name",file_post_name);movie_element.SetFilePostName(this.getSetting("file_post_name"));}
catch(ex){this.debug("Could not call SetFilePostName");}}else{this.debug("Could not find Flash element in SetFilePostName");}};SWFUpload.prototype.setDebugEnabled=function(debug_enabled){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetDebugEnabled)==="function"){try{this.addSetting("debug_enabled",debug_enabled);movie_element.SetDebugEnabled(this.getSetting("debug_enabled"));}
catch(ex){this.debug("Could not call SetDebugEnabled");}}else{this.debug("Could not find Flash element in SetDebugEnabled");}};SWFUpload.prototype.flashReady=function(){var self=this;if(typeof(self.fileDialogStart_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.flashReady_handler();};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("fileDialogStart event not defined");}};SWFUpload.prototype.executeNextEvent=function(){var f=this.eventQueue.shift();if(typeof(f)==="function"){f();}}
SWFUpload.prototype.fileDialogStart=function(){var self=this;if(typeof(self.fileDialogStart_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.fileDialogStart_handler();};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("fileDialogStart event not defined");}};SWFUpload.prototype.fileQueued=function(file){var self=this;if(typeof(self.fileQueued_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.fileQueued_handler(file);};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("fileQueued event not defined");}};SWFUpload.prototype.fileQueueError=function(file,error_code,message){var self=this;if(typeof(self.fileQueueError_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.fileQueueError_handler(file,error_code,message);};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("fileQueueError event not defined");}};SWFUpload.prototype.fileDialogComplete=function(num_files_selected){var self=this;if(typeof(self.fileDialogComplete_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.fileDialogComplete_handler(num_files_selected);};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("fileDialogComplete event not defined");}};SWFUpload.prototype.uploadStart=function(file){var self=this;if(typeof(self.fileDialogComplete_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.returnUploadStart(self.uploadStart_handler(file));};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("uploadStart event not defined");}};SWFUpload.prototype.returnUploadStart=function(return_value){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.ReturnUploadStart)==="function"){try{movie_element.ReturnUploadStart(return_value);}
catch(ex){this.debug("Could not call ReturnUploadStart");}}else{this.debug("Could not find Flash element in returnUploadStart");}};SWFUpload.prototype.uploadProgress=function(file,bytes_complete,bytes_total){var self=this;if(typeof(self.uploadProgress_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.uploadProgress_handler(file,bytes_complete,bytes_total);};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("uploadProgress event not defined");}};SWFUpload.prototype.uploadError=function(file,error_code,message){var self=this;if(typeof(this.uploadError_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.uploadError_handler(file,error_code,message);};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("uploadError event not defined");}};SWFUpload.prototype.uploadSuccess=function(file,server_data){var self=this;if(typeof(self.uploadSuccess_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.uploadSuccess_handler(file,server_data);};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("uploadSuccess event not defined");}};SWFUpload.prototype.uploadComplete=function(file){var self=this;if(typeof(self.uploadComplete_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.uploadComplete_handler(file);};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("uploadComplete event not defined");}};SWFUpload.prototype.debug=function(message){var self=this;if(typeof(self.debug_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.debug_handler(message);};setTimeout(function(){self.executeNextEvent();},0);}else{this.eventQueue[this.eventQueue.length]=function(){self.debugMessage(message);};setTimeout(function(){self.executeNextEvent();},0);}};SWFUpload.flashReady=function(){try{this.debug("Flash called back and is ready.");if(typeof(this.swfUploadLoaded_handler)==="function"){this.swfUploadLoaded_handler();}}catch(ex){this.debug(ex);}};SWFUpload.swfUploadLoaded=function(){};SWFUpload.fileDialogStart=function(){};SWFUpload.fileQueued=function(file){};SWFUpload.fileQueueError=function(file,error_code,message){try{switch(error_code){case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:this.debug("Error Code: File too big, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:this.debug("Error Code: Zero Byte File, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:this.debug("Error Code: Upload limit reached, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:this.debug("Error Code: File extension is not allowed, Message: "+message);break;default:this.debug("Error Code: Unhandled error occured. Errorcode: "+error_code);}}catch(ex){this.debug(ex);}};SWFUpload.fileDialogComplete=function(num_files_selected){};SWFUpload.uploadStart=function(file){return true;};SWFUpload.uploadProgress=function(file,bytes_complete,bytes_total){this.debug("File Progress: "+file.id+", Bytes: "+bytes_complete+". Total: "+bytes_total);};SWFUpload.uploadSuccess=function(file,server_data){};SWFUpload.uploadComplete=function(file){};SWFUpload.debug=function(message){if(this.getSetting("debug_enabled")){this.debugMessage(message);}};SWFUpload.uploadError=function(file,error_code,message){try{switch(errcode){case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:this.debug("Error Code: File ID specified for upload was not found, Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:this.debug("Error Code: HTTP Error, File name: "+file.name+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:this.debug("Error Code: No backend file, File name: "+file.name+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:this.debug("Error Code: IO Error, File name: "+file.name+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:this.debug("Error Code: Security Error, File name: "+file.name+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:this.debug("Error Code: Upload limit reached, File name: "+file.name+", File size: "+file.size+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:this.debug("Error Code: Upload Initialization exception, File name: "+file.name+", File size: "+file.size+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:this.debug("Error Code: uploadStart callback returned false, File name: "+file.name+", File size: "+file.size+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:this.debug("Error Code: The file upload was cancelled, File name: "+file.name+", File size: "+file.size+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:this.debug("Error Code: The file upload was stopped, File name: "+file.name+", File size: "+file.size+", Message: "+msg);break;default:this.debug("Error Code: Unhandled error occured. Errorcode: "+errcode);}}catch(ex){this.debug(ex);}};SWFUpload.prototype.debugMessage=function(message){var exception_message,exception_values;if(typeof(message)==="object"&&typeof(message.name)==="string"&&typeof(message.message)==="string"){exception_message="";exception_values=[];for(var key in message){exception_values.push(key+": "+message[key]);}
exception_message=exception_values.join("\n");exception_values=exception_message.split("\n");exception_message="EXCEPTION: "+exception_values.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(exception_message);}else{SWFUpload.Console.writeLine(message);}};SWFUpload.Console={};SWFUpload.Console.writeLine=function(message){var console,documentForm;try{console=document.getElementById("SWFUpload_Console");if(!console){documentForm=document.createElement("form");document.getElementsByTagName("body")[0].appendChild(documentForm);console=document.createElement("textarea");console.id="SWFUpload_Console";console.style.fontFamily="monospace";console.setAttribute("wrap","off");console.wrap="off";console.style.overflow="auto";console.style.width="700px";console.style.height="350px";console.style.margin="5px";documentForm.appendChild(console);}
console.value+=message+"\n";console.scrollTop=console.scrollHeight-console.clientHeight;}catch(ex){alert("Exception: "+ex.name+" Message: "+ex.message);}};if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="
');contentArr.push('');count++;}
commentDiv.innerHTML=contentArr.join(' ');}
else{commentDiv.innerHTML="";}}}
function pb_show_nav(){var cap=$('pb_cap_num');var cap_edit=$('pb_cap_num_edit');var text_box=$('pb_counter');text_box.value=cap.innerHTML;hide(cap);show(cap_edit);text_box.focus();text_box.select();}
function pb_update_and_hide_nav(){var cap=$('pb_cap_num');var cap_edit=$('pb_cap_num_edit');var text_box=$('pb_counter');var curPic=parseInt(text_box.value)-1;hide(cap_edit);show(cap);gotoSlide(curPic);}
function pb_nav_keydown(e){dojo.fixEvent(e);var key=e.keyCode;if(key==dojo.keys.ENTER){pb_update_and_hide_nav();}
stopPropagation(e);return true;}
function gotoSlide(slideNum){if(!inRange(slideNum))return;var editCapBox=$('editCapBox_1');var editCapStatus=$('capStatus_1');if((editCapBox&&editCapBox.style.display=='')||(editCapStatus&&editCapStatus.style.display=='')){return;}
if(tagger)tagger.remove();curIdx=slideNum;loadpic();pulse.trackPageview("pulse/profile/photoViewer/?ps=photo");}
function setupDeleteParams(){var formEle=$('deletePhotoForm');if(formEle){var nextPhoto=-1;if(curIdx+1==imageArr.length){if(imageArr.length>1){nextPhoto=imageArr[0].id;}}
else{nextPhoto=imageArr[curIdx+1].id;}
formEle.elements.photo_id.value=imageArr[curIdx].id;formEle.elements.next_photo_id.value=nextPhoto;}}
function loadpic(){var caption=document.getElementById(caption_id);var title=document.getElementById(title_id);var len=imageArr.length;if(len==0){if(tagger&&(tagger.currentView==0||tagger.currentView==3)&&albumId)
heart.redirect("profile","viewPhotosInAlbum",curUhid,{"album_id":albumId},null,null,"photo");else if(tagger&&(tagger.currentView==0||tagger.currentView==3))
heart.redirect("profile","showPhotoAlbums",curUhid,null,null,null,"photo");else
heart.redirect("profile","taggedPhotos",curUhid,null,null,null,"photo");return;}
if(title){title.innerHTML=imageArr[curIdx].title;title.setAttribute("plainValue",imageArr[curIdx].plainTitle);var fakeCap=$('fakecap_1');if(fakeCap){if(imageArr[curIdx].title==null||imageArr[curIdx].title==""){hide($('cap_1'));show($('fakecap_1'));}
else{hide($('fakecap_1'));show($('cap_1'));}}}
caption.innerHTML=String(curIdx+1);hideButtons();setupDeleteParams();var formEle=$('setAlbumPhotoForm');if(formEle)formEle.elements.photo_id.value=imageArr[curIdx].id;drawComments(curIdx);updateAlbumInfo(curIdx);if(window.hideTagFrame){hideTagFrame();}
if(window.drawTags){drawTags(imageArr[curIdx]);}
preloadSurrounding(curIdx);drawImage();}
function nextslide(direction,jump){var dir=1;if(direction<0)
dir=-1;var newIdx;if(jump){if(dir==1)newIdx=imageArr.length-1;else newIdx=0;}else{newIdx=curIdx+dir;}
gotoSlide(newIdx);}
function addPhotoComment(){var curPhoto=imageArr[curIdx].id;var formEle=$('photoCommentForm');var comment=$('photoCommentForm_comment').value;$('photoCommentForm_photoId').value=curPhoto;$('photoCommentForm_photoOwner').value=imageArr[curIdx].photo_owner;if(comment.length===0){return false;}
else if(comment.length>1500){alert('Your comment is '+(comment.length-1500)+' characters too long.');return false;}
$('photoCommentForm_status').style.display='';$('photoCommentForm_submit').disabled='disabled';var successCallback=function(response){$('photoCommentForm_status').style.display='none';$('photoCommentForm_submit').disabled='';formEle.elements.comment.value='';};var errorCallback=function(response){$('photoCommentForm_status').style.display='none';$('photoCommentForm_submit').disabled='';alert('Error posting comment. Please try again in a minute.');};var pk=getQueryObject(imageArr[curIdx].img).pk;sendXhrForm(formEle,successCallback,errorCallback,null,{'pk':pk});return false;}
function deletePhotoComment(actionUrl,comment_id,owner_uhid,spanId){if(!confirm("Are you sure you want to delete this comment?"))return;var spinner='editPhotoCommentForm_status';if(spanId)spinner+=spanId;$(spinner).style.display='';var successCallback=function(response){var statusElem=$(spinner);if(statusElem)statusElem.style.display='none';};var errorCallback=function(response){var statusElem=$(spinner);if(statusElem)statusElem.style.display='none';alert('Error deleting comment. Please try again in a minute.');};var postData={'comment_id':comment_id,'photo_owner_uhid':owner_uhid};sendXhrJs(actionUrl,postData,successCallback,errorCallback);}
function modifyPhotoComment(formEle){var commentText=formEle.comment.value;if(!commentText||commentText.length===0){alert("You cannot make a comment empty, please delete it instead");return false;}
$('editPhotoCommentForm_status').style.display='';$('editPhotoCommentForm_submit').disabled='disabled';var successCallback=function(response){$('editPhotoCommentForm_status').style.display='none';$('editPhotoCommentForm_submit').disabled='';};var errorCallback=function(response){$('editPhotoCommentForm_status').style.display='none';$('editPhotoCommentForm_submit').disabled='';alert('Error posting comment. Please try again in a minute.');};sendXhrForm(formEle,successCallback,errorCallback);return false;}
function deletePhoto(){if(!confirm('Are you sure you want to delete this photo?'))
return false;document.forms.deletePhotoForm.submit();return true;}
function setAlbumPhoto(){document.forms.setAlbumPhotoForm.submit();}
function rotatePhoto(controlElem,photoElemId,dir,size){var successCallback=function(response){imageArr[curIdx].img=response.url;imageArr[curIdx].tags=response.tags;loadpic();};photo_rotate(controlElem,imageArr[curIdx].id,dir,size,successCallback);}
function hideAutoDiscoveredFeed(actionUrl,toHide){hideMe=document.getElementById(toHide);hideMe.parentNode.removeChild(hideMe);feedList=document.getElementById("potential_feeds_list");feedContainer=document.getElementById("potential_feeds_container");hasValue=false;for(i=0;icap){alert('Your comment is '+(comment.length-cap)+' characters too long.');return false;}
$('commentForm_status').style.display='';$('commentForm_submit').disabled='disabled';var successCallback=function(response){$('commentForm_status').style.display='none';$('commentForm_submit').disabled='';formEle.elements.comment.value='';};var errorCallback=function(response){$('commentForm_status').style.display='none';$('commentForm_submit').disabled='';alert('Error posting comment. Please try again in a minute.');};sendXhrForm(formEle,successCallback,errorCallback);return false;}
function validateComment(comment){var textArea=$('commentForm_comment');if(textArea.value==comment){alert('Please insert a comment.');return false;}else{addComment(500);}
return true;}
function modifyComment(formEle,commentId){$('editCommentForm_status_'+commentId).style.display='';$('editCommentForm_submit_'+commentId).disabled='disabled';var successCallback=function(response){$('editCommentForm_status_'+commentId).style.display='none';$('editCommentForm_submit_'+commentId).disabled='';};var errorCallback=function(response){$('editCommentForm_status_'+commentId).style.display='none';$('editCommentForm_submit_'+commentId).disabled='';alert('Error posting comment. Please try again in a minute.');};sendXhrForm(formEle,successCallback,errorCallback);return false;}
function deleteComment(actionUrl,comment_id,pageNum,perPage,span){if(!confirm("Are you sure you want to delete this comment?"))return;if(!span)span='';$('editCommentForm_status_'+comment_id+span).style.display='';var successCallback=function(response){statusElem=$('editCommentForm_status_'+comment_id+span);if(statusElem)statusElem.style.display='none';};var errorCallback=function(response){statusElem=$('editCommentForm_status_'+comment_id);if(statusElem)statusElem.style.display='none';alert('Error deleting comment. Please try again in a minute.');};var postData={'comment_id':comment_id};if(pageNum){postData.pageNum=pageNum;}
if(perPage){postData.perPage=perPage;}
sendXhrJs(actionUrl,postData,successCallback,errorCallback);}
function commentSuccess(commentContent){$('comments').innerHTML=commentContent;}
function addEventSuccess(content){var pulseStream=$('pulse_stream');if(pulseStream){var div=document.createElement('div');div.innerHTML=content;var eventDiv=div.getElementsByTagName('div')[0];pulseStream.insertBefore(eventDiv,pulseStream.firstChild);}
pulse.closeCurrentLightbox();}
function deleteEvent(eventId,deleteUrl,doRedirect){var args={event_id:eventId};if(doRedirect)args.do_redirect=doRedirect;sendXhrJs(deleteUrl,args);}
function deleteEventSuccess(eventId,redirectUrl){var eventDiv=$('event_'+eventId);if(eventDiv)eventDiv.parentNode.removeChild(eventDiv);if(redirectUrl)location.href=redirectUrl;}
function toggleEdit(hide,show){$(hide).style.display='none';$(show).style.display='';}
function toggleQuote(comment,author){var content=document.getElementById(comment);var commentBox=document.getElementById("commentForm_comment");var text=comment;var endQuote='[/quote]';var endLen=text.lastIndexOf(endQuote);if(endLen==-1){endQuote='';}
var endText=text.substring(endLen+endQuote.length);commentBox.value="[quote="+author+"]"+endText+"[/quote]"+commentBox.value;}
function toggleShowQuote(comment){if(document.getElementById(comment).style.display=='none'){document.getElementById(comment).style.display='block';}else{document.getElementById(comment).style.display='none';}}
var requestInProgress=false;function toggleStar(actionUrl,div,eventId){if(requestInProgress)return;var state=div.getAttribute("state");var errorCallback=function(){requestInProgress=false;};var newState=state==1?0:1;var callback=function(data){requestInProgress=false;if(data.success==false){errorCallback();return;}};var postData={'event_id':eventId,'state':newState};requestInProgress=true;sendXhrJson(actionUrl,postData,callback,errorCallback);if(newState==1){dojo.addClass(div,'starred');div.setAttribute('state',1);div.setAttribute('title','Remove Star');div.setAttribute('alt','Remove Star');div.innerHTML='Remove Star';}else{dojo.removeClass(div,'starred');div.setAttribute('state',0);div.setAttribute('title','Star Event');div.setAttribute('alt','Star Event');div.innerHTML='Star';}}
function voteValidate(form){var found=false;for(var i=0;iAds by Google '+'';}else if(google_ads[0].type=="image"){s+='Ads by Google '+'';}else if(google_ads[0].type=="html"){s+=google_ads[0].snippet;}else{if(!orientation_vertical)
s+='
';}
document.write(s);return;}
google_ad_client='ca-pub-7124377129200155';google_ad_output='js';google_encoding='utf8';google_max_num_ads='5';google_ad_type='image+html+text';google_image_size='160x600';google_feedback='on';google_kw_type='broad';var statusPrefix="is ";var statusCanceled=false;var statusBlurCanceled=false;var statusCleared=false;var characterLimit=140;function status_hideEntry(){$('statusEntry').style.display='none';show($('statusUpdateLink'));hide($('statusDivider'));}
function status_setValue(txt){$('txtStatus').value=txt;status_updateCharCount();}
function status_postClear(){$('txtStatus').value='';status_post();}
function status_clear(){status_setValue("");hide($('mystatus_current'));$('mystatus').innerHTML="";hide($('statusDivider'));hide($('statusSecondaryActions'));mystatus_onclick();}
function txtstatus_initfocus(){$('txtStatus').focus();setCaretPos($('txtStatus'),statusPrefix.length);}
function mystatus_onclick(focus,showCancel){show($('statusEntry'));hide($('statusUpdateLink'));if($('mystatus').innerHTML.length){show($('statusDivider'));show($('statusSecondaryActions'));}
status_setValue(statusPrefix);if(focus)setTimeout(txtstatus_initfocus,0);}
function txtStatus_onkeypress(e){dojo.fixEvent(e);var inputElem=e.currentTarget;setTimeout(status_updateCharCount,0);var key=e.keyCode;if(key==dojo.keys.ESCAPE){status_hideEntry();return false;}
return true;}
function status_updateCharCount(){var len=$('txtStatus').value.length;var elem=$('status_charCount');if(elem)elem.innerHTML=characterLimit-len;}
function status_post(){g_plx_closeInstructionArrow();sendXhrForm($('frmStatus'),status_onSuccess,status_onError,'json');}
function status_onSuccess(postData){var status=postData['status'];if(status){var nameElem=$('firstName');$('mystatus').innerHTML=nameElem.value+' '+status;fadeIn($('mystatus_current'),500);status_hideEntry();}else{status_clear();}
$('mystatus_current').style.display=status?'block':'none';$('mystatus_ts').innerHTML="a moment ago";if(postData.statusUpdateError){showErrorMessage('An error occurred updating your status.
Please ensure that your password is correct here.');}}
function status_onError(){alert('Sorry, there was an error setting your status. Please try again later.');status_setValue("");status_onSuccess();}
function showConnectBox(boxName,i,center){var box=$(boxName+i);var btn=$('connectBtn'+i);btn.style.visibility="hidden";document.body.appendChild(box);if(!isDisplayed(box)){show(box);pulse.trackPageview('/pulse/chooseLevel/?type=ajax&ps='+box.getAttribute('ps'));}
var btnPos=dojo.coords(btn,true);box.style.top=btnPos.y+"px";if(center)
box.style.left=(btnPos.x+(btn.offsetWidth-box.offsetWidth)/2)+"px";else
box.style.left=btnPos.x+"px";}
function removeConnectBoxesForUhid(uhid,fadeTime){var boxes=dojo.query('.connectStatus'+uhid+', .connectAs'+uhid);for(var i=0;i