var snag=1;F._group_vanisher={remove_photo:function(E,p,d,o){if(this.already_removing==undefined){this.already_removing=false;}if(this.photosA==undefined&&_ge("div_hold_photos")){this.photosA=new Array();var c=_ge("div_hold_photos");for(var O=0;O<c.childNodes.length;O++){if(c.childNodes[O].nodeType==1&&c.childNodes[O].className=="PoolList"){this.photosA.push(_pi(c.childNodes[O].id.replace("pool_","")));}}}this.new_photo_id=null;this.total_photos=null;this.photo_load_offset=0;if(!this.already_removing&&window.confirm(F.output.get("grouppool_are_you_sure"))){this.already_removing=true;this.group_id=E;this.photo_id=p;this.load_replacement_photo=d;this.photo_url=o;this.vanish_photo();}},vanish_photo:function(){var c=function(){_ge("pool_"+F._group_vanisher.photo_id).innerHTML="";};anim_do_opacity_to(_ge("pool_"+this.photo_id),50,20,0,"easeOutQuad",c);F._group_vanisher.api_remove_photo();},api_remove_photo:function(){var c={flickr_groups_pools_remove_onLoad:function(E,o,p,d){if(E){if(F._group_vanisher.load_replacement_photo==true){F._group_vanisher.load_new_photo(F._group_vanisher.photo_load_offset);}else{F._group_vanisher.photo_load_offset=0;F._group_vanisher.already_removing=false;}}else{alert(F.output.get("grouppool_sorry_not_remove"));F._group_vanisher.un_vanish_photo();}}};var O=new Object();O.photo_id=F._group_vanisher.photo_id;O.group_id=F._group_vanisher.group_id;F.API.callMethod("flickr.groups.pools.remove",O,c,null,null,0);},un_vanish_photo:function(){_ge("pool_"+this.photo_id).style.display="block";anim_do_opacity_to(_ge("pool_"+this.photo_id),50,20,100,"easeInQuad");this.photo_load_offset=0;this.already_removing=false;},load_new_photo:function(p){var c={flickr_groups_pools_getPhotos_onLoad:function(a,E,d,o){F._group_vanisher.responseXML=E;if(a){try{F._group_vanisher.total_photos=_pi(E.documentElement.getElementsByTagName("photos")[0].getAttribute("total"));if(isNaN(F._group_vanisher.total_photos)){F._group_vanisher.total_photos=0;}if(!_groups_improv){if(_ge("a_see_all")){_ge("a_see_all").innerHTML=(F._group_vanisher.total_photos>1)?F.output.get("grouppool_see_all_link_plural",F._group_vanisher.group_id,F._group_vanisher.total_photos):F.output.get("grouppool_see_all_link_single",F._group_vanisher.group_id);}else{_ge("span_see_all").innerHTML=(F._group_vanisher.total_photos>1)?F.output.get("grouppool_see_no_link_plural",F._group_vanisher.total_photos):F.output.get("grouppool_see_no_link_single");}}else{if(_ge("a_see_all")){_ge("a_see_all").innerHTML=(F._group_vanisher.total_photos!=1)?F.output.get("count_items_plural",F._group_vanisher.total_photos):F.output.get("count_items",F._group_vanisher.total_photos);}else{_ge("span_see_all").innerHTML=(F._group_vanisher.total_photos!=1)?F.output.get("count_items_plural",F._group_vanisher.total_photos):F.output.get("count_items",F._group_vanisher.total_photos);}}}catch(q){}}else{}F._group_vanisher.photo_load_offset=0;F._group_vanisher.already_removing=false;}};var O=new Object();O.group_id=F._group_vanisher.group_id;O.per_page=1;O.page=6+p;if(this.total_photos!=null&&this.total_photos<6){O.page=this.total_photos;}if(this.total_photos!=null&&this.total_photos<6&&p>2){F._group_vanisher.photo_load_offset=0;F._group_vanisher.already_removing=false;return ;}F.API.callMethod("flickr.groups.pools.getPhotos",O,c,null,null,0);},show_new_photo:function(){for(var c=0;c<this.photosA.length;c++){if(this.photosA[c]==this.new_photo_id){this.photo_load_offset++;if(this.photo_load_offset<=5){this.load_new_photo(this.photo_load_offset);}else{this.photo_load_offset=0;this.already_removing=false;}return ;}}this.photosA.push(this.new_photo_id);var O="";O+="<div id=\"pool_"+this.new_photo_id+"\" class=\"PoolList\">";O+="<a href=\""+this.photo_url.replace(this.photo_id,this.new_photo_id)+"\"><img src=\""+_get_photo_src(global_photos[this.new_photo_id],"t")+"\" /></a><br>";if(global_last_log_in!=null&&this.date_added>global_last_log_in){O+="<span class=\"New\">"+F.output.get("grouppool_new")+"</span> ";}O+=F.output.get("grouppool_from",global_photos[this.new_photo_id].owner_nsid,global_photos[this.new_photo_id].owner_name);if(global_can_remove||global_nsid==global_photos[this.new_photo_id].owner_nsid){O+=" <a href=\"#\" title=\""+F.output.get("grouppool_remove_photo")+"\" onclick=\"F._group_vanisher.remove_photo('"+this.group_id+"','"+this.new_photo_id+"', true, '"+this.photo_url.replace(this.photo_id,this.new_photo_id)+"'); return false;\" class=\"Grey\">[X]</a>";}O+="</div>";_ge("div_hold_photos").innerHTML+=O;this.photo_load_offset=0;this.already_removing=false;}};F.PhotoPicker=function(){var O=this;var c=null;var p=global_group_name.truncate_with_ellipses(40).escape_for_display();this.selectedPhotos=[];this.selectedPhotosHash=[];this.addedAPIResponses=[];this.oPhotosFound=null;this.pendingRequest=false;this.resetMode=false;this.allFailed=false;this.apiData={currentPage:1,pages:0,lastCallParams:null};this.parseCollection=function(y){var W=y.documentElement.getElementsByTagName("photo");if(W.length==0){O.showPhotosFound(0);return ;}else{var w=y.documentElement.getElementsByTagName("photos")[0];if(!w){w=y.documentElement.getElementsByTagName("photoset")[0];}O.apiData.currentPage=parseInt(w.getAttribute("page"));O.apiData.pages=parseInt(w.getAttribute("pages"));O.showPhotosFound(w.getAttribute("total"));var E=[];var h,M,k,a,q,C,m;for(var P=0;P<W.length;P++){h=W[P].getAttribute("id");M=W[P].getAttribute("secret");k=W[P].getAttribute("server");q=W[P].getAttribute("farm");C=W[P].getAttribute("media");m=W[P].getAttribute("ispublic");a=_photo_root.replace("farm","farm"+q)+k+"/"+h+"_"+M+"_s.jpg";E.push({"id":h,"src":a,"media":C,"ispublic":m});global_photos[h]=W[P];}if(E.length>0){}}return E;};this.photoItem=document.createElement("li");this.photoItem.appendChild(document.createElement("img"));this.photoItem.getElementsByTagName("img")[0].src=_images_root+"/spaceball.gif";this.photoItem.getElementsByTagName("img")[0].className="pp_thumb";this.photoItem.appendChild(document.createElement("span"));this.photoItem.getElementsByTagName("span")[0].className="pp_close";this.photoItem.appendChild(document.createElement("span"));this.photoItem.getElementsByTagName("span")[1].className="pp_status";this.photoItem.appendChild(document.createElement("img"));this.photoItem.getElementsByTagName("img")[1].src=_images_root+"/video_play_icon_small.png.v1";this.photoItem.getElementsByTagName("img")[1].className="pp_video trans_png";this.cloneItem=function(){return O.photoItem.cloneNode(true);};this.setSearchField=function(E){var a=_ge("pp-search");a.disabled=(!E);if(E!=true){a.className="pp-disabled";a.value="";}else{a.className="";}};this.enableSearchField=function(){O.setSearchField(true);};this.disableSearchField=function(){O.setSearchField(false);};this.lastSearchTypeIndex=0;this.searchType=null;this.search_handler={generic_api_onLoad:function(w,y,a,q){O.setLoading(false);O.pendingRequest=false;if(!w){alert("there was an error: "+a);return ;}var E=O.parseCollection(y);O.makePhotosList(E);}};this.doSearchAll=function(a){var E=_ge("pp-search-filter");E.selectedIndex=0;O.setSearchType(true);Y.E.stopEvent(a||event);return false;};this.setSearchType=function(y){var q=_ge("pp-search-filter");var a=q.options[q.selectedIndex].value;var E=q.options[q.selectedIndex].text;if(y){_ge("pp-search").value="";}if(a==""){q.selectedIndex=O.lastSearchTypeIndex;return ;}O.searchType=a;if(O.searchType.indexOf("photoset")>-1){O.set_id=O.searchType.replace("photoset","");O.searchType="in_set";}else{if(O.searchType.indexOf("group")>-1){O.group_id=O.searchType.replace("group","");O.searchType="in_group";}else{if(O.searchType.indexOf("upload_day")>-1){O.upload_day=F.convert_MYSQLDateTime_into_unix_time_stamp(O.searchType.replace("upload_day",""));O.searchType="in_upload_day";}else{if(O.searchType.indexOf("batch_")>-1){O.batch_id=O.searchType.replace("batch_","");O.searchType="from_batch";}}}}_ge("pp-show-all").style.display="inline";switch(O.searchType){case "all":O.enableSearchField();if(_ge("pp-search").value==""){_ge("pp-show-all").style.display="none";}O.call_API=function(h,w){F.API.callMethod("flickr.photos.search",h,O.search_handler,undefined,undefined,undefined,w);};break;case "not_tagged":O.disableSearchField();O.call_API=function(h,w){F.API.callMethod("flickr.photos.getUntagged",h,O.search_handler,undefined,undefined,undefined,w);};break;case "y_photos":O.enableSearchField();O.call_API=function(h,w){h.y_photos=1;F.API.callMethod("flickr.photos.search",h,O.search_handler,undefined,undefined,undefined,w);};break;case "not_located":O.enableSearchField();O.call_API=function(h,w){if(h.text||h.tags){h.nogeo=1;F.API.callMethod("flickr.photos.search",h,O.search_handler,undefined,undefined,undefined,w);}else{F.API.callMethod("flickr.photos.getWithoutGeodata",h,O.search_handler,undefined,undefined,undefined,w);}};break;case "located":O.disableSearchField();O.call_API=function(h,w){F.API.callMethod("flickr.photos.getWithGeodata",h,O.search_handler,undefined,undefined,undefined,w);};break;case "not_in_set":O.disableSearchField();O.call_API=function(h,w){F.API.callMethod("flickr.photos.getNotInSet",h,O.search_handler,undefined,undefined,undefined,w);};break;case "in_upload_day":O.enableSearchField();O.call_API=function(h,w){h.min_upload_date=O.upload_day;h.max_upload_date=(O.upload_day*1)+86399;F.API.callMethod("flickr.photos.search",h,O.search_handler,undefined,undefined,undefined,w);};break;case "in_set":O.disableSearchField();O.call_API=function(h,w){h.photoset_id=O.set_id;F.API.callMethod("flickr.photosets.getPhotos",h,O.search_handler,undefined,undefined,undefined,w);};break;case "from_batch":O.disableSearchField();O.call_API=function(h,w){setTimeout(function(){_ge("findr").show_self_batch(_ge("findr").batch_id);},1000);};break;case "in_group":O.disableSearchField();O.call_API=function(h,w){h.group_id=O.group_id;F.API.callMethod("flickr.groups.pools.getPhotos",h,O.search_handler,undefined,undefined,undefined,w);};break;default:return ;}O.lastSearchTypeIndex=q.selectedIndex;O.doSearch();};this.call_API=function(a,E){F.API.callMethod("flickr.photos.search",a,O,undefined,undefined,undefined,E);};this.showPhotosFound=function(E){if(E==1){O.oPhotosFound.innerHTML=F.output.get("group_photopickr_found_single",E);}else{O.oPhotosFound.innerHTML=F.output.get("group_photopickr_found_plural",E);}};this.makePhotosList=function(a){var P=_ge("pp-source");if(a&&a.length){var k=document.createElement("ul");k.className="pp-list";var M=null;var w=null;var h=null;for(var q=0;q<a.length;q++){M=O.cloneItem();w=M.getElementsByTagName("img")[0];w.id="source_"+a[q].id;w.src=a[q].src;if(O.isSelected(w.id.replace("source","target"))){M.className="pp_type_"+a[q].media+" selected";}else{M.className="pp_type_"+a[q].media;}k.appendChild(M);}P.appendChild(k);var E=P.scrollHeight-P.offsetHeight;if(P.scrollHeight&&P.scrollTop>=E){P.scrollTop=E-1;}}else{var y=_ge("pp-search");P.innerHTML="<div class=\"pp_empty\"><h3>"+F.output.get("no_photos_found")+"</h3>"+(y.value?"<div>"+F.output.get("other_than","<b>"+y.value.escape_for_display()+"</b>")+"</div>":"")+"</div>";try{y.select();y.focus();}catch(C){}}};this.flickr_photos_search_onLoad=function(w,y,a,q){O.setLoading(false);O.pendingRequest=false;if(!w){alert("there was an error: "+a);return ;}var E=O.parseCollection(y);O.makePhotosList(E);};this.setLoading=function(E,q){var a=_ge("pp-source");var y=_ge("pp-loading");if(q){a.innerHTML="";}if(E){Y.D.addClass(_ge("pp"),"pp-cursor-loading");}else{Y.D.removeClass(_ge("pp"),"pp-cursor-loading");}document.body.style.cursor=(E?"wait":"auto");y.className=(E?"active":"");};this.doSearch=function(q){if(!O.pendingRequest){var a=null;if(_ge("pp-search").value!=""){a=F.get_tags_from_input_str(_ge("pp-search").value);_ge("pp-show-all").style.display="inline";}O.setLoading(true,true);O.pendingRequest=true;var E={user_id:global_nsid,tags:a,per_page:102,extras:"media"};O.apiData.lastCallParams=E;O.call_API(E);}if(typeof q!="undefined"||typeof (event)!="undefined"){Y.E.stopEvent(q?q:event);}return false;};this.getNextPage=function(){O.setLoading(true);O.pendingRequest=true;O.apiData.lastCallParams.page=O.apiData.currentPage;O.call_API(O.apiData.lastCallParams);};this.didScroll=function(){if(this.scrollHeight&&this.scrollTop>=this.scrollHeight-this.offsetHeight){O.scrolledToBottom();}};this.scrolledToBottom=function(){if(!O.pendingRequest&&O.apiData.currentPage<O.apiData.pages){O.apiData.currentPage++;O.getNextPage();}else{}};this.isSelected=function(E){return (typeof O.selectedPhotosHash[E]!="undefined");};this.sourceClick=function(w){var h=(w?w.target||w.srcElement:event.srcElement);if(h.nodeName.toLowerCase()!=""){var E=F.find_parent_node_by_name(h,"li");}if(!Y.D.hasClass(E,"pp_type_photo")&&!Y.D.hasClass(E,"pp_type_video")){return false;}var a=(h.nodeName.toLowerCase()=="li"?h:F.find_parent_node_by_name(h,"li"));h=Y.D.getElementsByClassName("pp_thumb","img",a)[0];var q=null;var C=h.nodeName.toLowerCase();if(C=="img"&&Y.D.hasClass(h,"pp_thumb")){q=h.id;}else{return true;}if(O.resetMode){O.removeSelectedItems();}var y=q.replace("source","target");var a=_ge(y);if(a){O.removeItem(q,y);}else{O.addItem(F.find_parent_node(_ge(q)));}O.setResetMode(false);};this.targetClick=function(h){var C=(h?h.target||event.srcElement:event.srcElement);var a=(C.nodeName.toLowerCase()=="li"?C:F.find_parent_node_by_name(C,"li"));if(!a){return true;}var w=null;var q=null;C=Y.D.getElementsByClassName("pp_thumb","img",a)[0];w=C.id;q=w.replace("target","source");if(O.resetMode){O.removeSelectedItems();O.setResetMode(false);return false;}C.id="";C.src=_images_root+"/spaceball.gif";a.className="";for(var y=0;y<O.selectedPhotos.length;y++){if(O.selectedPhotos[y].srcID==q){O.selectedPhotos.splice(y,1);}}delete O.selectedPhotosHash[w];var E=_ge(q);if(E){Y.D.removeClass(F.find_parent_node(E),"selected");}O.setResetMode(false);};this.addItem=function(E){var a=O.getNextTarget();if(!a||O.selectedPhotos.length>=o){O.setModalMode(true);global_comm_div.start_comming(F.output.get("group_photopickr_limit",o),undefined,undefined,true,true,undefined,O.setModalMode,false,undefined,undefined,undefined,true,false);return false;}var y=a.getElementsByTagName("img")[0];y.id=E.getElementsByTagName("img")[0].id.replace("source","target");var q=y.id;y.src=E.getElementsByTagName("img")[0].src;Y.D.addClass(E,"selected");a.className=E.className;try{}catch(w){}O.selectedPhotos[O.selectedPhotos.length]={srcID:E.getElementsByTagName("img")[0].id,targetID:a.id,id:q.substr(7)};O.selectedPhotosHash[q]=true;};this.removeItem=function(h){var E=F.find_parent_node(_ge(h));var q=h.replace("source","target");var a=F.find_parent_node(_ge(q));var w=a.getElementsByTagName("img")[0];w.src=_images_root+"/spaceball.gif";w.id="";Y.D.removeClass(E,"selected");a.className="";for(var y=0;y<O.selectedPhotos.length;y++){if(O.selectedPhotos[y].srcID==h){O.selectedPhotos.splice(y,1);}}delete O.selectedPhotosHash[q];};this.getNextTarget=function(){var q=_ge("pp-target").getElementsByTagName("li");var a=null;for(var E=0;E<q.length;E++){a=q[E].getElementsByTagName("img")[0];if(!a.id||a.id==""){return q[E];}}return null;};this.createTargetList=function(){var q=_ge("pp-target");if(!q){return false;}q.innerHTML="";var E=document.createElement("ul");E.className="pp-list";for(var a=o;a--;){E.appendChild(O.cloneItem());}q.appendChild(E);};this.flickr_groups_pools_add_onLoad=function(y,q,E,a){O.setLoading(false);O.addedAPIResponses[O.addedAPIResponses.length]={success:y,responseXML:q,responseText:E,params:a};if(O.addedAPIResponses.length>=O.selectedPhotos.length){O.handleAddAPIResponses();}};this.isQueued=function(E){return (E.responseText.indexOf("Your Photo has been added to the Pending Queue for this Pool")!=-1);};this.handleAddAPIResponses=function(){var k=0;var h=0;var E=0;var a=O.addedAPIResponses.length;var y=null;for(var w=0;w<a;w++){if(O.addedAPIResponses[w].success){k++;}else{if(O.isQueued(O.addedAPIResponses[w])){k++;E++;}else{h++;}}}var P=(E==0?"add_to_group_added":"batch_end_pending_adding_to_group");if(!h){if(k==1){y=F.output.get(P,p);}else{y=F.output.get(P+"_plural",parseInt(k),p);}}else{if(h<a){if(k==1){y=F.output.get(P,p);}else{y=F.output.get(P+"_plural",parseInt(k),p);}y+="\n";if(h==1){y+=F.output.get("add_to_group_not_added",p);}else{y+=F.output.get("add_to_group_not_added_plural",h,p);}}else{y=F.output.get(h==1?"add_to_group_all_not_added":"add_to_group_all_not_added_plural",p);}}O.results={"ok":k,"queued":E,"failed":h,"allFailed":(h&&h==a)};var C=null;for(var w=0;w<O.addedAPIResponses.length;w++){C=F.find_parent_node(_ge("target_"+O.addedAPIResponses[w].params.photo_id));Y.D.addClass(C,(O.addedAPIResponses[w].success||O.isQueued(O.addedAPIResponses[w])?"pp_ok":"pp_error"));}var q=_ge("pp-limit-remaining");if(q){var M=parseInt(global_group_limit_remaining);if(!isNaN(M)&&M!=101){M-=k;o=M;q.innerHTML=F.output.get("group_photopickr_can_add",M);}}y=y.replace("<b>","");y=y.replace("</b>","");setTimeout(function(){if(h||E){O.setModalMode(true);global_comm_div.start_comming(y,undefined,undefined,true,true,undefined,O.onFinish,false,undefined,undefined,undefined,true,false);}else{O.onFinish();}},250);};this.onFinish=function(){O.setResetMode(true);O.setModalMode(false);O.addedAPIResponses=[];if(!O.results.allFailed){window.location.href=("/groups/"+global_group_nsid+"/?added="+O.results.ok);}};this.setModalMode=function(E){var a=_ge("pp-source");a.style.overflow=(E?"hidden":"auto");};this.setResetMode=function(E){if(O.resetMode==E){return false;}var a=_ge("pp-add-photos");if(E){a.value=F.output.get("clear_selection");}else{a.value=F.output.get("group_photopickr_add");}O.resetMode=E;};this.removeAddedItems=function(){for(i=0;i<O.addedAPIResponses.length;i++){if(O.addedAPIResponses[i].success){O.removeItem("source_"+O.addedAPIResponses[i].params.photo_id);}}};this.removeSelectedItems=function(){if(O.resetMode==true){for(var E=0;E<O.selectedPhotos.length;E++){O.removeItem(O.selectedPhotos[E].srcID);E--;}}};this.doAddPhotos=function(){if(O.resetMode==true){O.removeSelectedItems();O.setResetMode(false);return false;}var a=0;for(var E=O.selectedPhotos.length;E--;){if(global_photos[O.selectedPhotos[E].id].getAttribute("ispublic")==0){a++;}}if(a==0){O.doAddPhotosAPICall();}else{O.setModalMode(true);global_comm_div.start_comming(F.output.get((a>1?"batch_confirm_adding_to_group_plural":"batch_confirm_adding_to_group"),p),undefined,undefined,true,true,undefined,O.doAddPhotosAPICall,true,undefined,O.setModalMode,undefined,true,false);}};this.doAddPhotosAPICall=function(){var E=[];var q=null;for(var a=0;a<O.selectedPhotos.length;a++){q={photo_id:O.selectedPhotos[a].id,group_id:global_group_nsid};O.setModalMode(true);global_comm_div.start_comming(F.output.get(O.selectedPhotos.length>1?"mat_one_adding_plural":"mat_one_adding_single"),undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,true,false);F.API.callMethod("flickr.groups.pools.add",q,O,null,null,0);}};this.updateRemainingCount=function(){var a=_ge("pp-limit-remaining");if(a){var E=parseInt(global_group_limit_remaining);if(!isNaN(E)&&E!=101){a.innerHTML=F.output.get("group_photopickr_can_add",E);}}};this.attachEvents=function(){Y.E.addListener(_ge("pp-search-filter"),"change",function(){O.setSearchType(true);});Y.E.addListener(_ge("emptyform"),"submit",O.doSearch);Y.E.addListener(_ge("pp-add-photos"),"click",O.doAddPhotos);Y.E.addListener(_ge("pp-target"),"mousedown",O.targetClick);Y.E.addListener(_ge("pp-source"),"mousedown",O.sourceClick);Y.E.addListener(_ge("pp-source"),"scroll",O.didScroll);Y.E.addListener(_ge("pp-show-all"),"click",O.doSearchAll);};this.init=function(E){if(!global_comm_div){_make_comm_div("10001");}O.oPhotosFound=_ge("pp-photos-found");if(!O.oPhotosFound){return false;}O.createTargetList();O.attachEvents();O.updateRemainingCount();O.setSearchType();};var d=6;var o=Math.max(0,(Math.min(d,parseInt(global_group_limit_remaining))));};Y.E.addListener(window,"load",function(){if(_ge("pp")){F.photopickr=new F.PhotoPicker();F.photopickr.init();}});