
function getNumbersFromString(src){var letterArray=src.split("");var result="";for(var i=0;i<letterArray.length;i++){if(!isNaN(letterArray[i])){result=result+letterArray[i];}}
return result;}
function forumjump(jumpdir){var pagebr=20;var replyraw=self.document.location.hash.substring(1);var replynum=parseInt(replyraw);var mypath=self.document.location.pathname;var rewindpg=0;var pgindex=mypath.split("-");if(isNaN(pgindex[pgindex.length-1])){topicid=getNumbersFromString(pgindex[pgindex.length-1]);}
else{rewindpg=parseInt(pgindex[pgindex.length-1]);topicid=getNumbersFromString(pgindex[pgindex.length-2]);}
var totposts=parseInt($("#tot_posts").html());var totpages=Math.floor(totposts/pagebr);var topicid;if(!topicid){return false;}
if(replynum<1||replynum>totposts||!replynum){replynum=rewindpg*pagebr;}
if(jumpdir=="p"){if(replyraw=="last"){replynum=totposts;}
if(replynum<=1){window.location=mypath+"#"+"first";return false;}
if(replynum==(rewindpg*pagebr+1)){if(rewindpg<=1){window.location="/forums/post/"+topicid+".html#"+(replynum-1);return false;}
else{window.location="/forums/post/page/"+(rewindpg-1)+"/"+topicid+".html#"+(replynum-1);return false;}}
window.location=mypath+"#"+(replynum-1);return false;}
if(jumpdir=="n"){if(replynum>=totposts){return false;}
if(replynum==((rewindpg+1)*pagebr)){window.location="/forums/post/page/"+(rewindpg+1)+"/"+topicid+".html#"+(replynum+1);return false;}
if(rewindpg==0&&replyraw!="first"&&!replynum){window.location=mypath+"#first";}
else{window.location=mypath+"#"+(replynum+1);}
return false;}
if(jumpdir=="h"){window.location="/forums/post/"+topicid+".html#first";return false;}
if(jumpdir=="l"){if(totpages>0){window.location="/forums/post/page/"+totpages+"/"+topicid+".html#last";}
else{window.location="/forums/post/"+topicid+".html#last";}
if(replyraw=="last"){window.location.reload();}
return false;}}
function addhotkeys(){var mypath=self.document.location.pathname;var pgindex=mypath.split("-");var topicid;if(isNaN(pgindex[pgindex.length-1])){if(pgindex[pgindex.length-1].indexOf("ft")!=-1){topicid=getNumbersFromString(pgindex[pgindex.length-1]);}}
else{if(pgindex[pgindex.length-2].indexOf("ft")!=-1){rewindpg=parseInt(pgindex[pgindex.length-1]);topicid=getNumbersFromString(pgindex[pgindex.length-2]);}}
jQuery.hotkeys.add('f',function(){window.location='/forums';});jQuery.hotkeys.add('r',function(){window.location='/forums/recent/';});jQuery.hotkeys.add('u',function(){window.location='/forums?nav=user';});if(topicid){jQuery.hotkeys.add('j',function(){forumjump("n");});jQuery.hotkeys.add('k',function(){forumjump("p");});jQuery.hotkeys.add('n',function(){forumjump("n");});jQuery.hotkeys.add('p',function(){forumjump("p");});jQuery.hotkeys.add('right',function(){forumjump("n");});jQuery.hotkeys.add('left',function(){forumjump("p");});jQuery.hotkeys.add('home',function(){forumjump("h");});jQuery.hotkeys.add('end',function(){forumjump("l");});jQuery.hotkeys.add('t',function(){window.location='/forums?toforum='+topicid;});}}
function remhotkeys(){jQuery.hotkeys.remove('j');jQuery.hotkeys.remove('k');jQuery.hotkeys.remove('n');jQuery.hotkeys.remove('p');jQuery.hotkeys.remove('right');jQuery.hotkeys.remove('left');jQuery.hotkeys.remove('home');jQuery.hotkeys.remove('end');jQuery.hotkeys.remove('f');jQuery.hotkeys.remove('r');jQuery.hotkeys.remove('u');jQuery.hotkeys.remove('t');}
$(document).ready(function(){$("#searchpro").focus(function(){remhotkeys();});$("#searchpro").blur(function(){addhotkeys();});$("#forum_search").focus(function(){remhotkeys();});$("#forum_search").blur(function(){addhotkeys();});addhotkeys();});