$(function(){simpletooltip();f=$("#form2replace");if(f.length>0){$.ajax({type:"POST",url:__comment_form_url__,dataType:"html",success:function(a){f.html(a)}})};$("#commentform form").submit(function(b){b.preventDefault()});showError=function(c,d){var b="#id_"+c;$(b).addClass("error");$(b).prev().addClass("error");if(d){if($(b).next().hasClass("error")){$(b).next().remove()}$(b).after("<span class='error'>"+d+"</span>");$(b).next().hide().fadeIn(500)}$(b).focus(function(){$(this).removeClass("error");$(this).prev().removeClass("error")})};cleanError=function(c){var b="#id_"+c;if($(b).next().hasClass("error")){$(b).next().remove()}};showAgain=function(){$("#message").fadeOut(300,function(){$("#signup fieldset").fadeIn(300)})};$(".submit-preview").live("click",function(b){b.preventDefault();a("preview")});$(".submit-post").live("click",function(b){b.preventDefault();a("post")});var a=function(d){var b=new Array();b.name=$.trim($("#id_name").val());b.email=$.trim($("#id_email").val());b.url=$.trim($("#id_url").val());b.comment=$.trim($("#id_comment").val());b.content_type=$("#id_content_type").val();b.object_pk=$("#id_object_pk").val();b.timestamp=$("#id_timestamp").val();b.security_hash=$("#id_security_hash").val();b.honeypot=$("#id_honeypot").val();var g=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;var c=false;var e=(d=="preview")?"preview=Preview":"post=Post";for(key in b){cleanError(key);if((b[key]==""||b[key]==undefined)&&(key!="url"&&key!="honeypot")){c=true;showError(key)}else{switch(key){case"email":if(!g.test(b.email)){c=true;showError(key,"invalid email address")}break;case"url":if(b.url!=""&&b.url.indexOf("://")<1){c=true;showError(key,"Specify the protocol, es: http://, ftp://, svn://")}break;case"honeypot":if(b.honeypot!=""){c=true;showError(key)}break}}e+="&"+key+"="+encodeURIComponent(b[key])}if(c==true){return false}$("#container").prepend('<div id="loading"><h1><span>Loading...</span></h1><div id="mask"></div></div>');$("#loading h1").css("margin-top",$(window).height()/2-25);$("#loading").fadeIn(400);var f=($("#commentform form").length>0)?$("#commentform form").attr("action"):$("#previewcomment").attr("action");$.ajax({type:"POST",url:f,data:e,dataType:"html",success:function(i){var h=i.indexOf("errorlist")>0;if(h){$("#loading").fadeOut(400,0,function(){$(this).remove()});showAgain();showError("name","There was an error with your request, check your fields again");return false}if(d=="preview"){$("#commentformcontainer").hide(800,function(){$("#commentformcontainer").html("");$("#commentformcontainer").append($(i).find("#previewcomment"));$("#commentformcontainer h1").css("margin-top","20px");$("#commentformcontainer").hide().show(800,function(){$("html,body").animate({scrollTop:$(this).offset().top},"slow");$("#loading").fadeOut(500,function(){$(this).remove()});commentMaxLength()})})}else{$("#commentcontainer").hide(800,function(){var j=$(i).find("#commentid").html();$.ajax({type:"GET",url:String(document.location),dataType:"html",success:function(k){$("#commentcontainer").html("");$("#commentcontainer").append($(k).find("#commentcontainer").html());$("#c_id"+j).prepend("<p class='thankyou'>Thank you for your comment, it's lovely to hear from you.</p>");$("#commentcontainer").show(800,function(){$("html,body").animate({scrollTop:$("#c_id"+j).offset().top},"slow");$("#loading").fadeOut(500,function(){$(this).remove()});commentMaxLength()})},error:function(k){$("#loading").fadeOut(500,function(){$(this).remove();alert("There was an error during your request, please try again.\nError code: "+k.status)})}})})}},error:function(h){$("#loading").fadeOut(500,function(){$(this).remove();alert("There was an error during your request, please try again.\nError code: "+h.status)})}})};commentMaxLength=function(){$("#id_comment").maxlength({maxCharacters:3000,statusClass:"status",statusText:"of 3000 characters remaining:",notificationClass:"error"})};commentMaxLength();$("#search input").focus(function(){if(this.value==this.defaultValue){this.value=""}});$("#search input").blur(function(){if(this.value==""){this.value=this.defaultValue}});$("ul.social a").hover(function(){$(this).find(":first").fadeTo(400,1)},function(){$(this).find(":first").fadeTo(300,0.5)});if($("pre").length>0){$("head").append('<link rel="stylesheet" type="text/css" href="http://static.nemesisdesign.net/template/css/pre-syntax-colors.css" />')}});(function(a){a.fn.maxlength=function(c){var b=jQuery.extend({events:[],maxCharacters:10,status:true,statusClass:"status",statusText:"character left",notificationClass:"notification",showAlert:false,alertText:"You have typed too many characters.",slider:false},c);a.merge(b.events,["keyup"]);return this.each(function(){var g=a(this);var d=a(this).val().length;function j(){var k=b.maxCharacters-d;if(k<0){k=0}g.next("div").html(k+" "+b.statusText)}function i(){var k=true;if(d>=b.maxCharacters){k=false;g.addClass(b.notificationClass);g.val(g.val().substr(0,b.maxCharacters));e()}else{if(g.hasClass(b.notificationClass)){g.removeClass(b.notificationClass)}}if(b.status){j()}}function e(){if(b.showAlert){alert(b.alertText)}}function h(){var k=false;if(g.is("textarea")){k=true}else{if(g.filter("input[type=text]")){k=true}else{if(g.filter("input[type=password]")){k=true}}}return k}if(!h()){return false}a.each(b.events,function(l,k){g.bind(k,function(m){d=g.val().length;i()})});if(b.status){g.after(a("<div/>").addClass(b.statusClass).html("-"));j()}if(!b.status){var f=g.next("div."+b.statusClass);if(f){f.remove()}}if(b.slider){g.next().hide();g.focus(function(){g.next().slideDown("fast")});g.blur(function(){g.next().slideUp("fast")})}})}})(jQuery);(function(){window.RetweetJS={bitly_user:"nemesisd",bitly_key:"R_3d230d9d5098bde42e4cd91200659376",link_text:(/windows/i.test(navigator.userAgent)?"&#9658;":"&#9851;")+"&nbsp;Retweet",count_type:"clicks",prefix:"",styling:"a.vert { display: block; text-align: center; font-size: 16px; float: left; margin: 4px; }a.retweet strong.vert { display: block; margin-bottom: 4px; background: #F5F5F5; border: 1px solid #EEE; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; padding: 3px; }a.retweet span.vert { display: block; font-size: 12px; margin-left: 0px; }"};var e=1;if(typeof BitlyClient==="undefined"){var d=document.getElementsByTagName("head")[0]||document.documentElement;var b=document.createElement("script");b.src="http://bit.ly/javascript-api.js?version=latest&login="+RetweetJS.bitly_user+"&apiKey="+RetweetJS.bitly_key;b.charSet="utf-8";d.appendChild(b);var a=setInterval(function(){if(typeof BitlyCB!=="undefined"){clearInterval(a);d.removeChild(b);c()}},10);e=0}if(document.addEventListener){document.addEventListener("DOMContentLoaded",c,false)}else{if(window.attachEvent){window.attachEvent("onload",c)}}function c(){if(++e<2){return}var h=[],n={},p={};BitlyCB.shortenResponse=function(t){for(var r in t.results){var u=t.results[r].userHash;p[u]=r;var q=n[r];for(var s=0;s<q.length;s++){q[s].href+=u}if(RetweetJS.count_type==="clicks"){BitlyClient.stats(u,"BitlyCB.statsResponse")}}};BitlyCB.statsResponse=function(v){var u=v.results.clicks,w=v.results.userHash;var s=p[w],r=n[s];if(u>0){for(var t=0;t<r.length;t++){var q=document.createElement("strong");q.appendChild(document.createTextNode(u+" "));r[t].insertBefore(q,r[t].firstChild);if(/(^|\s)vert(\s|$)/.test(r[t].className)){r[t].firstChild.className=r[t].lastChild.className="vert"}}}p[w]=n[s]=null};if(document.getElementsByClassName){h=document.getElementsByClassName("retweet")}else{var l=document.getElementsByTagName("a");for(var m=0;m<l.length;m++){if(/(^|\s)retweet(\s|$)/.test(l[m].className)){h.push(l[m])}}}if(h.length&&RetweetJS.styling){var g=document.createElement("style");g.type="text/css";try{g.appendChild(document.createTextNode(RetweetJS.styling))}catch(o){if(g.styleSheet){g.styleSheet.cssText=RetweetJS.styling}}document.body.appendChild(g)}for(var m=0;m<h.length;m++){var j=h[m];if(/(^|\s)self(\s|$)/.test(j.className)){j.href=window.location;j.title=document.title}var k=j.title||j.textContent||j.innerText,f=j.href;j.innerHTML="<span>"+RetweetJS.link_text+"</span>";j.title="";j.href="http://twitter.com/home?status="+encodeURIComponent(RetweetJS.prefix+k+" http://bit.ly/");if(n[f]){n[f].push(j)}else{n[f]=[j];BitlyClient.shorten(f,"BitlyCB.shortenResponse")}}}})();
