_MSG.album_is_empty="There's no doc in this album.\nIt can't be rearranged.";_MSG.album_reorder="We're rearranging your album";_MSG.album_confirm_order="Does this look any better to you?";_MSG.album_display_1="Display this album in multimedia mode?";_MSG.album_display_0="Display this album in thumbnails mode?";_MSG.album_delete="Do you really want to delete this album?";_MSG.album_delete_docs="Also delete all its related docs";_MSG.album_delete_warn="<b>Warning! The docs will be definitively deleted.</b><br/>Don't check this box if you wish to delete this album only.";_MSG.album_delete_last="You'd like to delete this album and *all* its related docs. Please confirm.";_MSG.album_deleting_all="Deletion of this album and its related docs";_MSG.album_deleting_alb="Deletion of this album only";_MSG.album_deleted_all="Done! This album and all its related docs are deleted.";_MSG.album_deleted_alb="Done! This album is deleted.";_MSG.album_deleted_back="You'll be redirected to your albums main page.";_MSG.album_deleted_nok="This album is now deleted, however its related docs still remain.";var _init_tools=function(a){var b=init_tools_menu(true);if(!b){return}var c=new Array();b.init_order=function(){if(!Data.album[a]["docs"].length){alert(_MSG.album_is_empty);return false}if(!b._docs_loaded){b.order_current=new Array();b.order_undo=new Array();var f=Data.album[a]["docs"];for(var d=0;d<f.length;d++){var e=f[d];b.order_current[d]=e.doc_id;b.order_undo[d]=e.doc_id}b._docs_loaded=true}return true};b.album_order=function(e,n){b.hide_menu();e=_pi(e);if(!b.init_order()){return}if(e){modal.say(_MSG.album_reorder+"...",{icon:"wait"})}var l=Data.album[a]["docs"];var k=new Array();if(e){for(var j=0;j<l.length;j++){var p=Data.album[a]["docs"][j];p.created__at=p.created_at.replace(/[^\d]/g,"");k.push(p)}switch(e){case 1:k.sort(function(i,d){return(i.posted_at>d.posted_at)?1:-1});break;case -1:k.sort(function(i,d){return(i.posted_at<d.posted_at)?1:-1});break;case 4:k.sort(function(i,d){return(i.created__at>d.created__at)?1:-1});break;case -4:k.sort(function(i,d){return(i.created__at<d.created__at)?1:-1
});break;case 3:k.sort(function(i,d){return(i.title.toLowerCase()>d.title.toLowerCase())?1:-1});break;case -3:k.sort(function(i,d){return(i.title.toLowerCase()<d.title.toLowerCase())?1:-1});break}b.order_current=new Array();for(var j=0;j<k.length;j++){b.order_current[j]=k[j].doc_id}}var f=$("thumbs");for(var j=0;j<b.order_current.length;j++){var g=b.order_current[j];var h=Data.album[a]["offs"][g];var m=Data.album[a]["docs"][h].div;f.removeChild(m);f.appendChild(m)}if(e){modal.say(_MSG.saving,{icon:"wait"})}IOL.API.request("album.set.order",{album_id:a,doc_list:b.order_current,_undo:n},b)};b.album_order_custom=function(){b.hide_menu();if(!b.init_order()){return}b.is_doing_order=true;b.is_working=true;window.is_doing_album_stuff=true;Effect.BlindUp($("album_infos"));Effect.BlindDown($("custom_save"));if($("album_player")){$("album_player").style.display="none"}Sortable.create("thumbs",{tag:"div",overlap:"horizontal",constraint:false})};b.album_order_custom_done=function(f){if(f){b.order_current=new Array();var g=$("thumbs");var j=0;for(var e=0;e<g.childNodes.length;e++){var h=g.childNodes[e];if(h.nodeName=="DIV"&&h.doc_id){b.order_current[j]=h.doc_id;j++}}modal.say(_MSG.saving+"...",{icon:"wait"});IOL.API.request("album.set.order",{album_id:a,doc_list:b.order_current},b)}else{b.album_order(0)}Sortable.destroy("thumbs");Effect.BlindDown($("album_infos"));$("custom_save").style.display="none";if($("album_player")){$("album_player").style.display="block"}b.is_doing_order=false;b.is_working=false;window.is_doing_album_stuff=false};b.album_set_order_onApi=function(g,e,d,f){if(g){if(!f._undo){modal.say(_MSG.album_confirm_order,{},{onclick:function(){b.order_undo=b.order_current.slice()}},{onclick:function(){b.order_current=b.order_undo.slice();b.album_order(0,true)}})}}else{modal.complain(e,{},1)}};b.album_cover=function(){b.hide_menu();b.is_working=true;b.is_doing_cover=true;window.is_doing_album_stuff=true;Effect.BlindUp($("album_infos"));Effect.BlindDown($("cover_save"));var f=$("thumbs");var h=0;for(var e=0;e<f.childNodes.length;
e++){var g=f.childNodes[e];if(g.nodeName=="DIV"&&g.doc_id){if(Data.album[a].docs[h].embed!="jpg"&&Data.album[a].docs[h].embed!="flv"){g.style.display="none"}h++}}};b.album_cover_set=function(d){modal.say(_MSG.saving,{icon:"wait"});IOL.API.request("album.set",{album_id:a,doc_id:d,callback:"album_cover_set"},b)};b.album_cover_set_onApi=function(i,e,d,h){if(i){if($("album_cover_div")){var f=$A($("album_cover_div").getElementsByTagName("div"));f.each(function(j){$("album_cover_div").removeChild(j)})}var g=$("album_cover");g.src=e.album.doc_url+".m.jpg";g.album_id=h.album_id;g.doc_id=h.doc_id;g.style.width=e.album.wh.m[0]+"px";g.style.height=e.album.wh.m[1]+"px";g.onclick=function(){document.location="/doc/"+glob_u.folder+"/"+h.doc_id+"/in/album/"+h.album_id};Reflector.reflect(g);modal.say(_MSG.saved,{icon:"ok",timeout:500})}else{modal.complain(e,{},1)}b.album_cover_end()};b.album_cover_end=function(){var f=$("thumbs");for(var e=0;e<f.childNodes.length;e++){var g=f.childNodes[e];if(g.nodeName=="DIV"&&g.doc_id){g.style.display="block"}}Effect.BlindDown($("album_infos"));$("cover_save").style.display="none";b.is_working=false;b.is_doing_cover=false;window.is_doing_album_stuff=false};b.fave_album=function(d){if(b.is_faving){return}$("fave_album").style.display="none";$("unfave_album").style.display="block";b.is_faving=true;IOL.API.request("album.set.vote",{fave:1,album_id:a},b)};b.unfave_album=function(d){if(b.is_faving){return}$("fave_album").style.display="block";$("unfave_album").style.display="none";b.is_faving=true;IOL.API.request("album.set.vote",{fave:0,album_id:a},b)};b.album_set_vote_onApi=function(g,e,d,f){b.is_faving=false;if(g){}else{if(f.fave){$("fave_album").style.display="block";$("unfave_album").style.display="none"}else{$("fave_album").style.display="none";$("unfave_album").style.display="block"}modal.complain(e,{},1)}};b.album_choose_display=function(){b.hide_menu();var d=Data.album[a];if(!_pi(d.display)){modal.say(_MSG.album_display_1,{},{label:_MSG.yes,onclick:function(){b.album_set_display(1)}},1)}else{modal.say(_MSG.album_display_0,{},{label:_MSG.yes,onclick:function(){b.album_set_display(0)
}},1)}};b.album_set_display=function(f){var e=IOL.API.request("album.set",{album_id:a,display:f,arrback:1});document.location.reload()};b.print_album=function(d){modal.say(MSG.processing,{icon:"wait"});$("print_doc_div_wait").style.display="block";$("print_doc_div_nok").style.display="none";$("print_doc_div_ok").style.display="none";IOL.API.request("cart.add",{album_id:a,callback:"print_album"},b)};b.print_album_onApi=function(h,e,d,g){$("print_doc_div_wait").style.display="none";if(h){modal.shutup();$("print_doc_div_ok").style.display="block";$("print_doc_count").innerHTML=" "+e.doc_count+" ";var f=$("print_doc_div_ok").getElementsByTagName("div")}else{this.hide_menu();modal.complain(e,{},1)}};b.delete_album=function(g,f){if(!f){b.hide_menu();var d=document.createElement("div");d.innerHTML=_MSG.album_delete+'<br/><form action="" style="padding-top:1em"><input type="checkbox" id="and_docs" onclick="$(\'and_docs_warn\').style.display=(this.checked)?\'block\':\'none\';modal.fix_table_sizes();"/><label for="and_docs">'+_MSG.album_delete_docs+'</label><div class="notice warn" id="and_docs_warn" style="margin:5px;padding:5px;display:none">'+_MSG.album_delete_warn+"</div>";modal.say(d,{icon:"warn",width:300,overlay:true},{label:_MSG.yes+", "+_MSG.suppress,onclick:function(){b.delete_album(null,true)}},{})}else{if($("and_docs").checked){if(!confirm(_MSG.album_delete_last)){return}modal.say(_MSG.album_deleting_all+"...",{width:300,icon:"wait",progress:1,overlay:true});IOL.API.request("album.del",{album_id:a,_and_doc:true},b)}else{modal.say(_MSG.album_deleting_alb+"...",{width:300,icon:"wait",overlay:true});IOL.API.request("album.del",{album_id:a,_and_doc:false},b)}}};b.album_del_onApi=function(g,e,d,f){if(g){if(f._and_doc&&Data.album[f.album_id].docs.length){return b.album_doc_del(0,0)}else{modal.say(_MSG.album_deleted_alb+"\n\n("+_MSG.album_deleted_back+")",{icon:"ok",overlay:true},{onclick:function(){document.location="/doc/"+glob_u.folder+"/album?c=1&s=album.del"}})}}else{modal.complain(e,{},1)}};b.album_doc_del=function(g,h){if(!h){h=20
}if(!g){g=0}progress=Math.ceil((g/h)*100);modal.repeat("",{progress:progress});var e=[];var f=0;while(Data.album[a].docs.length&&f<h){var j=Data.album[a].docs.pop();e.push(j.doc_id);f++}if(f){IOL.API.request("doc.del",{doc_id:e,_del_max:h,_del_count:g},b,false,1000)}else{modal.say(_MSG.album_deleted_all+"\n\n("+_MSG.album_deleted_back+")",{icon:"ok",overlay:true},{onclick:function(){document.location="/doc/"+glob_u.folder+"/album?c=1&s=album.del"}})}};b.doc_del_onApi=function(g,e,d,f){if(g){return b.album_doc_del(f._del_count,f._del_max)}else{moday.say(_MSG.album_deleted_nok,{},{onclick:function(){document.location="/doc/"+glob_u.folder+"/album?c=1&s=album.del"}})}}};init_album_ordering=function(a){var d=$("tools")?$("tools"):{};var b=$("thumbs");if(!b){return}Data.album[a].offs=[];var e=0;b.select("div.thumb75").each(function(f){if(!f.doc_id){var g=f.id.split("_")[1];f.doc_id=g}f.onclick=function(){if(d.is_doing_cover){d.album_cover_set(this.doc_id);return false}};var c=f.select("a").each(function(h){h.onmouseover=function(i){if(d.is_doing_order){this.style.cursor="move"}else{if(d.is_doing_cover){this.style.cursor="crosshair"}else{this.style.cursor="default"}}};h.onclick_old=(typeof h.onclick=="function")?h.onclick:false;h.onclick=function(i){if(d.is_doing_order||d.is_doing_cover){return false}if(this.onclick_old){return this.onclick_old()}}});f.onmouseover=function(h){if(!h){h=window.event}if(d.is_doing_order){this.style.cursor="move"}else{if(d.is_doing_cover){this.style.cursor="crosshair"}else{this.style.cursor="default"}}try{Event.stop(h)}catch(i){}};Data.album[a]["docs"][e].div=f;Data.album[a]["offs"][f.doc_id]=e;e++})};init_album_thumbs=function(){var a=$("thumbs");if(!a){return}a.select("div.thumb75").each(function(b){var e=b.id.split("_")[1];b.doc_id=e;var c=Data.doc[e];b.style.position="relative";if(c.type==2||c.type==3){var d=document.createElement("img");d.src=(c.type==2)?URL.L+"/icons/embed.mp3.png":URL.L+"/icons/embed.flv.png";d.className="pngfix";d.style.width="16px";d.style.height="16px";d.style.position="absolute";
d.style.left="58px";d.style.top="58px";d.style.border="none";b.appendChild(d)}})};