var Tandoori=Class.create();Object.extend(Element,{allTextContent:function(B){var A="";$A(B.childNodes).each(function(C){if(C.nodeType==3){A+=C.data}else{A+=Element.allTextContent(C)}});return A}});Object.extend(Position,{windowEdges:function(){var B=document.createElement("div");Object.extend(B.style,{position:"absolute",width:"1px",height:"1px",bottom:"0",right:"0"});document.body.appendChild(B);var A=Position.cumulativeOffset(B);document.body.removeChild(B);return[A[0]+1,A[1]+1]}});Object.extend(Number.prototype,{px:function(){return this+"px"}});Tandoori.executeWhenAvailable=function(B,A){if($(A)){B()}else{setTimeout(Tandoori.executeWhenAvailable.bind(Tandoori,B,A),100)}};Tandoori.toggleHiddenLinks=function(B,C){var B=$(B);if(Element.hasClassName(B,"tandoori-links-visible")){Element.removeClassName(B,"tandoori-links-visible");var A=$A($(B).getElementsByTagName(C));A.each(function(D){if(Element.hasClassName(D,"hl")){D.style.display="none"}})}else{Element.addClassName(B,"tandoori-links-visible");var A=$A($(B).getElementsByTagName(C));A.each(function(D){if(Element.hasClassName(D,"hl")){jQuery(D).show("fast")}})}};Tandoori.saveBlogEntry=function(A,B){new Ajax.Updater(B,"save.do",{method:"post",parameters:Form.serialize(A),encoding:"UTF-8"})};Tandoori.deleteBlogEntry=function(A){if(confirm("Are you sure you want to whack this blog entry?")){new Ajax.Updater("blog-list-holder","delete.do",{method:"get",parameters:"id="+A})}};Tandoori.showBlogEdit=function(A){Element.hide($("blog-preview-"+A));Element.show($("blog-edit-"+A))};Tandoori.showBlogPreview=function(A){new Ajax.Updater("blog-preview-"+A,"preview.do",{method:"get",parameters:Form.serialize($("blog-form-"+A))});Element.show($("blog-preview-"+A));Element.hide($("blog-edit-"+A))};Tandoori.addNewBlogEntry=function(){var A=prompt("Enter the headline for this blog.");if(A!=null){new Ajax.Updater("blog-list-holder","save.do",{method:"get",parameters:"headline="+escape(A)+"&content=&author="})}};Tandoori.publishBlogEntry=function(B){var A=$("blog-publish-"+B);if(A.checked){if(confirm("Are you sure you want to publish this blog entry?")){new Ajax.Updater("blog-list-holder","save.do",{method:"get",parameters:"id="+B+"&action=publish"})}else{A.checked=false}}else{if(confirm("Are you sure you want to UN-publish this blog entry?")){new Ajax.Updater("blog-list-holder","save.do",{method:"get",parameters:"id="+B+"&action=unpublish"})}else{A.checked=true}}};Tandoori.validateProductKey=function(key,callback_function){new Ajax.Request("validateProductKey.do",{method:"get",parameters:"productKey="+key,onSuccess:function(transport){var data=eval(transport.responseText);callback_function(data.result)}})};