
var box={'signup_fields':{'public_name':1,'email':1,'password':1},'shared_file_menu_timout_id':null,'add_to_shared_menu':function(action)
{var menu=$j('#shared_file_menu').find('.menu');var menu_item=$j('<a></a>').attr('href','').attr('id',action.name).appendTo(menu);if(action.favicon_url!='undefined'&&action.favicon_url)
{menu_item.html('<img src="'+action.favicon_url+'">'+$j.text(action.name)).show();}
menu_item.unbind().click(function()
{action.execute();return false;}).show();},'adjust_long_strings_for_display':function()
{var font_size=24;var width=575;var subtitle_width=320;while(true)
{var showing_complete_string=false;$j('#file_name').css('visiblity','hidden');$j('#file_name').css('font-size',font_size+'px');$j('#file_name').text(item.name);if($('file_name').offsetWidth>=width)
{font_size--;}
else
{showing_complete_string=true;$('file_name').style.visibility='visible';break;}
if(font_size<19)
{$('file_name').style.visibility='visible';break;}}
if(!showing_complete_string)
{setText($('file_name'),get_short_string(item.name,width,$('file_name')));$j('#file_name').attr('title',item.name);}
setText($('title_text'),get_short_string(item.name,subtitle_width,$('title_text')));},'collaborate_user':function()
{var url=site_root+'ajaxcollaborateuser';var query={file_id:item.id};var retval=false;$j.ajax({async:false,url:url,data:query,type:'POST',dataType:'json',success:function(json)
{retval=json.result;if(retval)
{single_item_collection[item.id].permissions.upload=true;}}});return retval;},'load':function()
{window.location.href=site_root+'shared/'+shared_name;},'shared_file_menu_hide':function()
{if(typeof(box_gallery)!='undefined'&&box_gallery)
{box_gallery.set_player_active(true);}
$j('#shared_file_menu').css('visibility','hidden');box.folder_menu_timout_id=null;},'shared_file_menu_out':function()
{if(!box.shared_file_menu_timout_id)box.shared_file_menu_timout_id=setTimeout(box.shared_file_menu_hide,50);},'shared_file_menu_over':function()
{if(!box.shared_file_menu_timout_id)return;clearTimeout(box.shared_file_menu_timout_id);box.shared_file_menu_timout_id=null;},'shared_file_menu_show':function(p)
{var oPos=system.get_object_position($('shared_file_options_button'));$j('#shared_file_menu').css({top:oPos.y+$('shared_file_options_button').offsetHeight,left:oPos.x-$j('#shared_file_menu_background').width()+$('shared_file_options_button').offsetWidth,visibility:'visible'});if(typeof(box_gallery)!='undefined'&&box_gallery)
{box_gallery.set_player_active(false);}
$j(p).hover(function(){box.shared_file_menu_over();},function(){box.shared_file_menu_out();});$j('#shared_file_menu').hover(function(){box.shared_file_menu_over();},function(){box.shared_file_menu_out();});},'show_file_logo_and_information':function()
{$j('.gallery_pseudo_container').show();$j('.gallery_pseudo_bottom_bar').show();if(!has_flash_for_preview())
{$j('.bottom_bar_text').show();}},'upload_callback':function()
{Upload_Process.progressPopup.destroy();$j.popup.form('Upload Successful',[{type:'text',data:'You have successfully uploaded this file. Would you like to go to your Box account to collaborate with other users?'},{type:'buttons',items:{upgrade:['Take me there',function(values,form)
{$j.popup.close();window.location.href=site_root+'files';}],cancel:['No thanks',function()
{box.load();}]}}],{help:{hide:true}});},'upload_or_login_or_register':function(item,item_name,user_name,user_pic)
{if(!root_folder_id)
{box_login_or_register_popup.show({after_login_action:'upload_new_version',file_name:item_name,user_name:user_name,item:item,user_pic:user_pic});}
else
{if(!collab_access)box.collaborate_user();uploader.show_upload({file:single_item_collection[item.id],callback:box.upload_callback});}}}
$j(function()
{if(!waiting_on_password)
{box.adjust_long_strings_for_display();var actions=item.get_actions({type:'openbox'});for(var i=0;i<actions.length;i++)
{box.add_to_shared_menu(actions[i]);}
if(allow_shared_upload)
{box_event=new BoxEventTracker();var login_cookie_vals=getCookie('https_login_values');if(login_cookie_vals)
{login_cookie_vals=login_cookie_vals.split(':');deleteCookie('https_login_values');if(login_cookie_vals[0]=='upload_new_version')
{box_login_or_register_popup.show({after_login_action:login_cookie_vals[0],item_id:login_cookie_vals[1],user_name:login_cookie_vals[2],file_name:login_cookie_vals[3],user_pic:user_pic});}
else
{box_login_or_register_popup.show();}}
var should_upload=getCookie('post_login_upload');if(should_upload)
{deleteCookie('post_login_upload');if(box.collaborate_user())
{uploader.show_upload({file:item,callback:box.upload_callback});}
else
{alert('Upload attempt failed because this file could not be collaborated. Please contact the owner of the folder to change collaboration settings.');deleteCookie('post_login_upload');}}}
if(enable_shared_file_preview&&item.permissions.preview)
{box_gallery.init_shared_file_preview(item);}
else
{box.show_file_logo_and_information();}}});
