function organize(a,b){if(a.innerHTML.match(/this$/i)){$(a).set("oldhtml",a.innerHTML).set("html","Hide filer");$("o"+b).setStyle("display","")}else{$("o"+b).setStyle("display","none");$(a).set("html",a.get("oldhtml"))}return false}function check_submit(){var a;if(a=$("new-label"))if(a=a.value.match(RegExp(a.getProperty("reserved"),"gi"))){alert("Sorry, "+a+" is a reserved word and may not be used as a label.");return false}return true}
function toggleAbout(a){if(a.innerHTML=="Read more"){$("moreabout").setStyle("display","");$("hellip").setStyle("display","none");a.innerHTML="Collapse"}else{$("moreabout").setStyle("display","none");$("hellip").setStyle("display","");a.innerHTML="Read more"}return false}function ajaxsearch(a){if($type(a)=="element"){$("currenttab").set("id","");a.id="currenttab";a=a.href}else a=a;(new Request({url:a,onComplete:function(b){$("items").set("html",b)}})).post({action:"getlabel"});return false}
function renameFolder(){var a=$("currenttab").firstChild.nodeValue.replace(/ \([\d]+\)$/,""),b=prompt('Rename "'+a+'" folder to:',"").trim();if(b==""||b==a)return false;return doFolder(a,b)}function deleteFolder(){if(confirm("Are you sure you want to delete this folder?")){var a=$("currenttab").firstChild.nodeValue.replace(/ \([\d]+\)$/,"");return doFolder(a,"")}return false}
function doFolder(a,b){(new Request({url:window.location.toString().split("#")[0],onComplete:function(){window.location.reload(true)}})).post({action:"doFolder",oldname:a,newname:b});return false}function newFolder(){var a=prompt("Name of your new folder:","");if(!a)return false;a=a.trim();if(a=="")return false;return doFolder("",a)}
function seeFavorites(a){var b=$("favoritesbar");if(a.innerHTML.match(/^See all/)){b.set("oldwidth",b.offsetWidth-10);b.set("oldheight",b.offsetHeight-10);b.setStyle("width","");b.setStyle("height","auto");a.innerHTML="Collapse favorites"}else{b.setStyle("width",b.get("oldwidth")+"px");b.setStyle("height",b.get("oldheight")+"px");a.innerHTML="See all my favorites &raquo;"}return false}
function mailThisCollector(a,b){return buildForm("\t<h3>Email this collector ("+b+")</h3>\t\t<h5><label for='yourname'>Your name:</label> <input type='text' id='yourname' value=\"\" /><br /></h5>\t<h5><label for='youremail'>Your email:</label> <input type='text' id='youremail' value=\"\" /><br /></h5>\t<h5><label for='themessage'>Message:</label> <textarea rows='4' cols='30' id='themessage'></textarea></h5>\t\t<p>*Collectors Weekly will send your email to this collector. We won&rsquo;t use your email address for any other purpose.<br /><br /></p>\t\t<input type='submit' id='sendButton' value='Send' /> <input type='submit' id='tellFriendCancel' onclick='return closeBox()' value='Cancel' />\t",a,
sendMail.bind(b))}
function tellAFriend(a){var b=(x=Cookie.read("your_name"))?x:"",c=(x=Cookie.read("your_email"))?x:"";return buildForm("\t<h3>Forward this page to a friend*</h3>\t"+("\t<h5><label for='yourname'>Your name:</label> <input type='text' id='yourname' value=\""+b+"\" /><br /></h5>\t<h5><label for='youremail'>Your email:</label> <input type='text' id='youremail' value=\""+c+"\" /><br /></h5>\t<h5><label for='theiremail'>Your friend's email:</label> <input type='text' id='theiremail' /><br /></h5>\t<h5><label for='themessage'>Message: (optional)</label> <textarea rows='4' cols='30' id='themessage'></textarea></h5>\t")+"\t<p>*Collectors Weekly will send a short email to your friend with a link to this page. We won&rsquo;t use your email (or your friend&rsquo;s) for any other purpose.<br /><br /></p>\t\t<input type='submit' id='sendButton' value='Send' /> <input type='submit' id='tellFriendCancel' onclick='return closeBox()' value='Cancel' />\t",
a,sendToFriend)}function buildForm(a,b,c){var d;if(d=$("friendBox"))d.destroy();d=(new Element("form")).setProperty("id","friendBox").setStyle("top","-1000px").set("html",a).inject(document.body).addEvent("submit",c);(function(){$("yourname").focus()}).delay(400);a=$(b).getPosition();if(a.x>575){a.x=160;a.y=140}(new Fx.Morph(d)).start({top:[a.y+10,a.y+30],left:[a.x,a.x+20],opacity:[0,0.9999]});return false}
function closeBox(){var a=$("friendBox"),b=a.getStyle("top").replace(/px/,"").toInt(),c=a.getStyle("left").replace(/px/,"").toInt();(new Fx.Morph(a)).start({top:[b,b+20],left:[c,c+20],opacity:[0.9999,0]});return false}
function sendToFriend(a){var b=$("yourname").value,c=$("youremail").value,d=$("theiremail").value,e=$("themessage").value;Cookie.write("your_name",b,{path:"/"});Cookie.write("your_email",c,{path:"/"});b={action:"sendToFriend",y_name:b,y_email:c,t_email:d,message:e};b.page=window.location.toString();c=$("page-title");b.page_title=c?(c.getFirst()||c).innerHTML:document.title.split(" | ")[0];(new Request({url:"/ajax/tellafriend.php",onComplete:function(f){$("friendBox").set("html",f);closeBox.delay(1700)}})).post(b);
(new Event(a)).stop();return false}
function sendMail(a){var b=$("yourname").value,c=$("youremail").value,d=$("themessage").value;Cookie.write("your_name",b,{path:"/"});Cookie.write("your_email",c,{path:"/"});b={action:"mailThisCollector",y_name:b,y_email:c,message:d,to:this};b.page=window.location.toString();c=$("page-title");b.page_title=c?(c.getFirst()||c).innerHTML:document.title.split(" | ")[0];(new Request({url:"/ajax/tellafriend.php",onComplete:function(e){$("friendBox").set("html",e);closeBox.delay(1700)}})).post(b);(new Event(a)).stop();
return false};

