groen.addEvent(window,"load",ShowInfo);groen.addEvent(window,"load",ChangeBackground);groen.addEvent(window,"load",CodeFilter);groen.addEvent(window,"load",Comments);function ShowInfo(){var d=groen.get("#imageinfolink");var b=groen.get("#showpage");var c=groen.get("#imageinfo");groen.preventSelection(c);groen.preventSelection(d);var a=function(){if(window.slidingimg){return}window.slidingimg=true;if(c.style.display=="none"||c.style.display==""){SlideContentOut(groen.get("#content"));MoveMenuUp(groen.get("#menu"));c.style.display="block";setTimeout(function(){c.style.opacity="0.1"},750)}else{MoveMenuDown(groen.get("#menu"));SlideContentIn(groen.get("#content"));c.style.display="none";c.style.opacity="1"}};groen.addEvent(d,"click",a);groen.addEvent(b,"click",a)}function MoveMenuUp(d){var c=groen.getPos(d).y;var a=0;var b=setInterval(function(){if(parseInt(d.style.top,10)<=-48){clearInterval(b);return}a+=12;d.style.top=(c-a)+"px"},10)}function MoveMenuDown(d){var c=groen.getPos(d).y;var a=0;var b=setInterval(function(){if(parseInt(d.style.top,10)>=12){clearInterval(b);return}a-=12;d.style.top=(c-a)+"px"},10)}function SlideContentIn(f){var e=groen.getPos(f).x;var g=0;var c=100;var b=0;var a=0;var d=setInterval(function(){if(parseInt(f.style.left,10)>=g||a>200){clearInterval(d);window.slidingimg=false;return}b+=c;f.style.left=(e+b)+"px";a+=1},20)}function SlideContentOut(e,b){var h=-900;var d=250;var j=1.70158;var g=groen.getPos(e).x;var f=0;var a=20;var c=setInterval(function(){if(parseInt(e.style.left,10)<h||f>200){clearInterval(c);e.style.left=h+"px";window.slidingimg=false;return}a=f*20;e.style.left=(h*(a/=d)*a*((j+1)*a-j)+g)+"px";f+=1},20)}function ChangeBackground(){var d=function(j){if(window.slidingimg){return}if(!j){var j=window.event}var h=groen.get("#bgimage"),k=groen.get("#selectimage span");var o=function(p,e,r,q){return r*(p/=q)*p+e};var f=groen.getEventTarget(j);var i=f.title;var g=groen.get("#selectimage .selected")[0];var l=function(){g.className="";f.className="selected";var t=groen.getWindowDims();var v=t.windowWidth-20;var e=document.createElement("img");e.alt="";e.id="newbgimage";e.src="/test/images/header/"+i;e.style.left=v+"px";document.body.insertBefore(e,h);var r=0;var q=1;h.style.left="0px";window.slidingimg=true;var u=setInterval(function(){if(q>0){q-=1;return}var w=o(r*20,0,20,15);w=(w-w*2);h.style.left=w+"px";e.style.left=v+w+"px";if(parseInt(e.style.left,10)<20||r>500){clearInterval(u);groen.removeNode(h);e.id="bgimage";e.style.left="0px";window.slidingimg=false}r+=1},20);var p="/test/getinfo.php?filename="+encodeURIComponent(i);var s=new groenAjax(function(){groen.get("#imageinfo span")[1].innerHTML=s.responseText});s.post(p,"","GET")};if(groen.browserType!=="MSIE"){var m=new groenAjax(l);m.post("/test/images/header/"+i,"","GET")}else{l()}};groen.preventSelection(groen.get("#selectimage"));var a=groen.get("#bgimage"),c=groen.get("#selectimage span");for(var b=0;b<c.length;b++){groen.addEvent(c[b],"click",d)}}function OldIE(){if(document.cookie.search("oldie_shown")!==-1){return}var c=document.createElement("div");c.style.position="absolute";c.style.left="0px";c.style.top="30%";c.style.color="#000";c.style.backgroundColor="#eee";c.style.border="4px solid #000";c.style.width="55em";c.style.padding=".5em 2em";c.innerHTML='I\'m sorry, but this site doesn\'t work very well in Internet Explorer 7 or earlier.<br />Please upgrade to <a href="http://www.beautyoftheweb.com/#/download">Internet Explorer 8 or newer</a>, or better yet, try another browser such as <a href="http://www.opera.com/">Opera</a>, <a href="http://firefox.com/">Firefox</a>, or <a href="http://google.com/chrome/">Chrome</a>.<br /><br />';var b=document.createElement("a");b.href="#";b.innerHTML="Okay, but I want to continue anyway.";groen.addEvent(b,"click",function(){var a=new Date();a.setTime(a.getTime()+24*3600*1000);document.cookie="oldie_shown=True; expires="+a.toGMTString()+"; path=/";c.style.display="none"});c.appendChild(b);document.body.appendChild(c)}function CodeFilter(){var a=groen.get("#code div.code");filter=groen.get("#code_filter");if(!a||a.length==0){return}groen.addEvent(filter,"change",function(m){if(!m){m=window.event}target=groen.getEventTarget(m);if(target.tagName.toLowerCase()!=="input"){return}var b={};var p=groen.get(".title",filter);var o,k,f,d,g,c,l;for(f=0;p.length>f;f+=1){o=p[f].innerHTML.toLowerCase();k=groen.get("input",p[f].parentNode);b[o]=[];for(d=0;k.length>d;d+=1){if(!k[d].checked){b[o].push(k[d].id.toLowerCase())}}}for(f=0;a.length>f;f+=1){l=false;for(d in b){c=groen.get("."+d,a[f])[0].innerHTML.toLowerCase();for(n=0;b[d].length>n;n+=1){if(c.search(b[d][n])!==-1){a[f].style.display="none";l=true}}}if(!l){a[f].style.display="block"}}})}function Comments(){var b=groen.get("#feedbackform");if(!b){return}var a=groen.get("input",b);for(var c=0;a.length>c;c+=1){groen.placeholder(a[c])}groen.addEvent(groen.get("#submit"),"click",function(k){var d=groen.trim(groen.get("#comment_name").value),l=groen.trim(groen.get("#comment_email").value),m=groen.trim(groen.get("#comment_text").value),o=groen.get("#comment_emailme").checked,g=groen.trim(groen.get("#turingtest").value),i=[];if(d===""){i.push("Name is mandatory")}if(m===""){i.push("You must write a comment")}if(g!=="42"){i.push("You must enter the number 42")}if(o&&l===""){i.push("You've chosen to be notified of future comments, but didn't fill in your email")}if(i.length>0){groen.preventDefault(k);var j="<strong>Oops! The following errors were encountered</strong><br />";var f=groen.get("#comment_error");if(f){groen.removeNode(f)}f=document.createElement("p");f.id="comment_error";f.innerHTML=j+i.join("<br />");b.insertBefore(f,groen.get("#feedbackform form")[0]);groenFX.show(f)}})};
