﻿// Version 2010-07-27. Copyright © 2009-2010 Hans-Georg Michna
// hans-georg©michna.com [Replace © with @!]
// You may copy and alter this code, but not sell it. Please report any useful
// modifications to me, so I can incorporate them into the original file.
(function(){addEvent(window,"load",commentLink);function addEvent(a,b,c){try{a.addEventListener(b,c,false)}catch(ignore){try{a.attachEvent("on"+b,c)}catch(ignore){}}}function commentLink(){if(!/#comment-\d+$/.test(location.hash))return;var a;if(a=document.getElementById(location.hash.substr(1)))return;var b=location.search.substr(1).split("&");var c=+removeSearchValue("cs",b);if(c&&document.getElementById("comment-"+c))return;var d=+removeSearchValue("page",b);if(d>=99)return;var e=getFirstCommentNumber(document.body);if(e){var f=location.href.match(/.*?(?=\?|#|$)/)+"?page="+(d+1)+"&cs="+e+(b+""?"&"+b.join("&"):"")+location.hash;if(c)location.replace(f);else location=f}}function getFirstCommentNumber(a){for(var b in a.childNodes){var c=a.childNodes[b];if(c.id&&c.id.substr(0,8)==="comment-")return+c.id.substr(8);var n=getFirstCommentNumber(c);if(n)return n}}function removeSearchValue(a,b){for(var i=0;i<b.length;i++){var c=b[i].split("=");if(c[0]===a){b.splice(i,1);return(c.length>=1)?c[1]:""}}return""}}());

