
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-2])){groupsid=getNumbersFromString(pgindex[pgindex.length-2]);topicid=parseInt(pgindex[pgindex.length-1]);}
else{rewindpg=parseInt(pgindex[pgindex.length-1]);topicid=parseInt(pgindex[pgindex.length-2]);groupsid=getNumbersFromString(pgindex[pgindex.length-3]);}
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="/x-gt"+groupsid+"-"+topicid+"?at="+(replynum-1);return false;}
else{window.location="/x-gt"+groupsid+"-"+topicid+"-"+(rewindpg-1)+"?at="+(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="/x-gt"+groupsid+"-"+topicid+"-"+(rewindpg+1)+"?at="+(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="/x-gt"+groupsid+"-"+topicid+"?at=first";return false;}
if(jumpdir=="l"){if(totpages>0){window.location="/x-gt"+groupsid+"-"+topicid+"-"+totpages+"?at=last";}
else{window.location="/x-gt"+groupsid+"-"+topicid+"?at=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-2])){groupsid=getNumbersFromString(pgindex[pgindex.length-2]);if(pgindex[pgindex.length-2].indexOf("gt")!=-1){topicid=parseInt(pgindex[pgindex.length-1]);}}
else{groupsid=getNumbersFromString(pgindex[pgindex.length-3]);if(pgindex[pgindex.length-3].indexOf("gt")!=-1){rewindpg=parseInt(pgindex[pgindex.length-1]);topicid=parseInt(pgindex[pgindex.length-2]);}}
jQuery.hotkeys.add('f',function(){window.location='/x-g'+groupsid;});jQuery.hotkeys.add('r',function(){window.location='/x-g'+groupsid;});var userid=parseInt($("#userid").html());if(userid){jQuery.hotkeys.add('u',function(){window.location='/cc/groups/search_forums.php?groups_id='+groupsid+'&userid='+userid+'&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");});var forumid=parseInt($("#forumid").html());jQuery.hotkeys.add('t',function(){window.location='/x-gf'+groupsid+"-"+forumid;});}}
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('t');jQuery.hotkeys.remove('u');}
$(document).ready(function(){$("#searchpro").focus(function(){remhotkeys();});$("#searchpro").blur(function(){addhotkeys();});$("#forum_search").focus(function(){remhotkeys();});$("#forum_search").blur(function(){addhotkeys();});addhotkeys();});