window.debug=(function(){var r=this,y=Array.prototype.slice,w=r.console,s={},u,t,n=9,x=["error","warn","info","debug","log"],o="assert clear count dir dirxml exception group groupCollapsed groupEnd profile profileEnd table time timeEnd trace".split(" "),q=o.length,z=[];while(--q>=0){(function(a){s[a]=function(){n!==0&&w&&w[a]&&w[a].apply(w,arguments)}})(o[q])}q=x.length;while(--q>=0){(function(b,a){s[a]=function(){var c=y.call(arguments),d=[a].concat(c);z.push(d);v(d);if(!w||!p(b)){return}w.firebug?w[a].apply(r,c):w[a]?w[a](c):w.log(c)}})(q,x[q])}function v(a){if(u&&(t||!w||!w.log)){u.apply(r,a)}}s.setLevel=function(a){n=typeof a==="number"?a:9};function p(a){return n>0?n>a:x.length+n<=a}s.setCallback=function(){var b=y.call(arguments),c=z.length,a=c;u=b.shift()||null;t=typeof b[0]==="boolean"?b.shift():false;a-=typeof b[0]==="number"?b.shift():c;while(a<c){v(z[a++])}};return s})();$(document).ready(function(){$('a[href="#/login/"]').click(function(){return popup_login()});$('a[href="#/logout/"]').click(function(){return popup_logout()})});hashChange();$(function(){$(window).bind("hashchange",function(a){hashChange()})});function hashChange(){var b=window.location.href;var d=b.replace(/^[^#]*#?(.*)$/,"$1");if(d[0]!="/"){d="/"+d}if(window.location.pathname!=""&&window.location.pathname!="/"){if(d=="/"){return false}else{window.location.assign("/#"+d)}}if(d=="/"){d="/home/"}debug.log('hash:"'+d+'"');$.ajax({url:d,data:{noFrames:true},success:function(f,g,e){a(f)},error:function(e,g,f){c(g,f)}});var a=function(e){$(document).ready(function(){if((typeof e)=="object"){console.log("is object");if(e.status!="ok"){debug.log('AJAX Good response, Bad Data - Message:"'+e.message+'"');return}else{var g=$('<div id="content_area"></div>');var f=$('<div id="home"></div>').append('<h2 class="pageheading">'+e.header+"</h2>");f.css("text-align","left");f.append('<div class="lastupdate">Last edited by '+e.editby_name+" on "+e.editdate+"</div>");f.append(e.content);g.append(f);$("#content_area").replaceWith(g);$("#menu").find(".menuactive").removeClass("menuactive");$('a[href="#'+d+'"]').parents("li").children("a").addClass("menuactive")}}else{$("#content_area").html(e);$("#menu").find(".menuactive").removeClass("menuactive");$('a[href="#'+d+'"]').parents("li").children("a").addClass("menuactive")}})};var c=function(f,e){debug.log("ajax Error")}}function popup_login(){$(".pop_content").load("/ajax/session/login_popup/",function(a){$(".popup_error").hide();$("#bad_password_ajax").hide();$(".generic_dialog").fadeIn("slow")});return false}function popup_logout(){$(".pop_content").load("/ajax/session/logout_popup/",function(a){$(".popup_error").hide();$("#bad_password_ajax").hide();$(".generic_dialog").fadeIn("slow")});return false}function login_submit(){var b=/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;$(".popup_error").hide();var a=false;var c=$("#login_email").val();if(c==""){$("#login_email").after('<span class="popup_error"><br />You forgot to enter your email address.</span>');a=true}else{if(!b.test(c)){$("#login_email").after('<span class="popup_error"><br />Enter a valid email address.</span>');a=true}}if($("#login_password").val()==""){$("#login_password").after('<span class="popup_error"><br />You forgot to enter your password.</span>');a=true}if(a==false){$.getJSON("/ajax/session/submit_login/",$("#login_popup").serialize(),function(d){if(d.success){$(".pop_content").html("<h3>Welcome "+d.userDisplayName+"!</h3><br />Thank you for visiting, your page will refresh shortly.");setTimeout("location.reload();",1250)}else{if(d.reason=="wrong"){$("#bad_password_ajax").fadeIn()}else{alert("An unknown error has occurred, please reload the page.")}}})}return false}function logout_submit(){$.getJSON("/ajax/session/submit_logout/",$("#logout_popup").serialize(),function(a){if(a.success){$(".pop_content").html("<h3>"+a.userDisplayName+"</h3><br/>Thank you for visiting, your page will refresh shortly.");setTimeout("location.reload();",1250)}else{alert("An unknown error has occurred, please reload the page.")}});return false}function login_popup_cancel(){$(".generic_dialog").fadeOut("slow",function(){$(".generic_dialog").hide();$(".pop_content").html("Loading...")});return false}function reset_password_popup(){$(".pop_content").load("/ajax/session/forgot_password_popup/",function(a){$(".popup_error").hide();$("#error").hide();$.getScript("http://api.recaptcha.net/js/recaptcha_ajax.js",function(){Recaptcha.create(recaptcha_public_key,"recaptcha_div",{theme:"white",callback:Recaptcha.focus_response_field})});$(".generic_dialog").fadeIn("slow")});return false}function submit_reset_password(){var b=/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;$(".popup_error").hide();var a=false;var c=$("#login_email").val();if(c==""){$("#login_email").after('<span class="popup_error"><br />You forgot to enter your email address.</span>');a=true}else{if(!b.test(c)){$("#login_email").after('<span class="popup_error"><br />Enter a valid email address.</span>');a=true}}if($("#recaptcha_response_field").val()==""){$("#recaptcha_div").after('<span class="popup_error"><br />You forgot to enter a reCaptcha response.</span>');a=true}if(a==false){$.getJSON("/ajax/session/password_reset/",$("#login_popup").serialize(),function(d){if(d.success){$(".pop_content").html("<h3>Password Reset Sent</h3><br />"+d.userDisplayName+" we have sent and email to "+d.email+' please click the link in the body of that email to reset your password.<br /><input id="cancel_login" name="Close" type="submit" value="Cancel" onclick="return close_popup()"/>')}else{$("#error").fadeIn();$(".login_email").val("");Recaptcha.create(recaptcha_public_key,"recaptcha_div",{theme:"white",callback:Recaptcha.focus_response_field})}})}return false}function close_popup(){$(".generic_dialog").fadeOut("slow",function(){$(".generic_dialog").hide();$(".pop_content").html("Loading...")});return false}(function($,h,b){var i;var d=100;var e=$.browser;var f=document.documentMode;var g=e.msie&&(f===b||f<8);var c="onhashchange" in h&&!g;function a(j){j=j||h.location.href;return j.replace(/^[^#]*#?(.*)$/,"$1")}$.event.special.hashchange=$.extend($.event.special.hashchange,{setup:function(){if(c){return false}$(i.start)},teardown:function(){if(c){return false}$(i.stop)}});i=(function(){var j={};var o;var k;var l;var n;function m(){l=n=function(p){return p};if(g){k=$('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;n=function(){return a(k.document.location.href)};l=function(r,p){if(r!==p){var q=k.document;q.open().close();q.location.hash="#"+r}};l(a())}}j.start=function(){if(o){return}var q=a();l||m();(function p(){var s=a();var r=n(q);if(s!==q){l(q=s,r);$(h).trigger("hashchange")}else{if(r!==q){h.location["href"]=h.location.href.replace(/#.*/,"")+"#"+r}}o=setTimeout(p,d)})()};j.stop=function(){if(!k){o&&clearTimeout(o);o=0}};return j})()})(jQuery,this);