/* Copyright (C) 2007 - 2010 YOOtheme GmbH, YOOtheme License (http://www.yootheme.com/license) */

var Zoo={};
Zoo.Comment=new Class({initialize:function(c){this.setOptions({cookiePrefix:"zoo-comment_",cookieLifetime:15552E3},c);var a=$("respond"),d=this;if(a){a.getElement(".actions .cancel").addEvent("click",function(b){(new Event(b)).stop();a.injectInside($("comments").getElement(".comments"));a.getElement("input[name=parent_id]").setProperty("value",0)});a.getElement("form").addEvent("submit",function(){this.getElement("span.submit-message").addClass("submitting")});$$("#comments .comment").each(function(b){b.getElement(".reply a").addEvent("click",function(e){(new Event(e)).stop();
a.injectInside(b);a.getElement("input[name=parent_id]").setProperty("value",b.getProperty("id").replace(/comment-/i,""))})});a.getElement("a.twitter-connect")&&a.getElement("a.twitter-connect").addEvent("click",function(){d.setLoginCookie("twitter")});a.getElement("a.fb-logout")&&a.getElement("a.fb-logout").addEvent("click",function(){d.facebookLogout()});a.getElement("a.twitter-logout")&&a.getElement("a.twitter-logout").addEvent("click",function(){d.setLoginCookie("")})}},onFacebookLogin:function(){this.setLoginCookie("facebook");
this.refreshPage()},facebookLogout:function(){this.setLoginCookie("");FB.Connect.logout(function(){this.refreshPage()}.bind(this))},setLoginCookie:function(c){Cookie.set(this.options.cookiePrefix+"login",c,{duration:this.options.cookiePrefix/86400})},refreshPage:function(){window.location.reload(true)}});Zoo.Comment.implement(new Options);

