var currentPage=1;var currentPageFeed=1;var currentMinePage=1;var currentPageLatest=1;var lastPage=40;var lastPageFeed=40;var lastMinePage=40;var lastPageLatest=40;var pageSize=15;var latestFirstPageHtml="";var LiveArticleFirstPageHtml="";var pageLoad=true;var tb_pathToImage="http://s3.gold-speculator.com/images/loadingAnimation.gif";var timeout=250;var closetimer=0;var ddmenuitem=0;var FeedId=0;var TimeFrame="day";$(document).ready(function(){$("#navbartop").load("/menubar/dev/menubar.html",function(){$("ul.jd_menu").jdMenu()});imgLoader=new Image();imgLoader.src=tb_pathToImage;DisplayRSSTable(1);DisplayMineTable(1);$("#ViewMore").attr("href","#");$("#ViewMore").click(NextPageLatest);$("#commentstab").attr("href","#");$("#commentstab").click(ViewComments);$("#mostviews").attr("href","#");$("#mostviews").click(ViewMostViews);$("#LatestTable tr:odd").css("background-color","#F9F9F9");Scroll();$("#LAIinfo").click(LAIinfo);var a=$("#quotes-ticker");a.serialScroll({items:"div",duration:500,force:true,axis:"y",easing:"linear",lazy:true,interval:5000,step:1})});function LAIinfo(a){a.preventDefault();var b='<div id="LAIinfopane"><div class="toggleLAItab"><h4>What is Live Article Inbox?</h4><span></span></div><div id="IP_container"><div id="LAI_IPheader" class="insert"><h3>News from 20+ sites all in one place!</h3><div><p>Live article inbox automatically receives news from over 20 handpicked financial sites and consolidates it in one place! This helps us to stay on top of all important resource investment publications.</p></div><a href="#" id="LAIcloseIP" class="button">Close</a></div></div></div>';$("#LAItitle").append(b);$("#LAIcloseIP").click(function(c){c.preventDefault();$("#LAIinfopane").remove()})}function DisplayRSSTable(a){$.ajax({type:"GET",url:"http://www.goldreads.com/services/service.aspx",data:"PageSize="+pageSize+"&Page="+a,contentType:"application/json; charset=utf-8",dataType:"jsonp",jsonp:"jsonp",success:function(b){ApplyTemplate(b);$("#RSSTable tr:even").css("background-color","#F9F9F9");UpdatePaging()},error:function(b,d,c){}})}function DisplayRSSTableFeed(b,a){$.ajax({type:"GET",url:"http://www.goldreads.com/services/service.aspx",data:"PageSize="+pageSize+"&Page="+b+"&FeedId="+a,contentType:"application/json; charset=utf-8",dataType:"jsonp",jsonp:"jsonp",success:function(c){ApplyTemplateFeed(c);$("#RSSTable tr:even").css("background-color","#F9F9F9");UpdatePagingFeed();tb_init("a.rssLink")},error:function(c,e,d){}})}function DisplayMineTable(a){$.ajax({type:"GET",url:"/custom/RPCjmineRss.php",data:"PageSize="+pageSize+"&Page="+a,contentType:"application/json; charset=utf-8",dataType:"json",success:function(b){ApplyMineTemplate(b);UpdateMinePaging();tb_init("a.rssLink");$("#minerssnews tr:odd").css("background-color","#F9F9F9");$("#mineRssSearch").bind("click",clearbox)},error:function(b,d,c){}})}function clearbox(){var a=$("#mineRssSearch").val();if(a==="Filter by company symbol"){$("#mineRssSearch").val("")}}function DisplayMineTableFilter(a,b){$.ajax({type:"GET",url:"/custom/RPCjmineRssFilter.php",data:"PageSize="+pageSize+"&Page="+a+"&Symbol="+b,contentType:"application/json; charset=utf-8",dataType:"json",success:function(c){ApplyMineTemplate(c);UpdateMinePaging();tb_init("a.rssLink");$("#minerssnews tr:odd").css("background-color","#F9F9F9")},error:function(c,e,d){}})}function lookupPR(){var a=$("#mineRssSearch").val();DisplayMineTableFilter(1,a)}function DisplayLatestTable(b){var a=pageSize+2;$.ajax({type:"GET",url:"/index/serv_Latest.php",data:"PageSize="+a+"&Page="+b,contentType:"application/json; charset=utf-8",dataType:"json",success:function(c){ApplyLatestTemplate(c);UpdatePagingLatest()},error:function(c,e,d){}})}function DisplayLatestComments(b){var a=pageSize+2;$.ajax({type:"GET",url:"/index/serv_Latest_Comment.php",data:"PageSize="+a+"&Page="+b,contentType:"application/json; charset=utf-8",dataType:"json",success:function(c){ApplyLatestCommentsTemplate(c)},error:function(c,e,d){}})}function DisplayMostViews(c,b){var a=pageSize+2;$.ajax({type:"GET",url:"/index/serv_Most_Views.php",data:"PageSize="+a+"&Page="+c+"&TimeFrame="+b,contentType:"application/json; charset=utf-8",dataType:"json",success:function(d){ApplyMostViewsTemplate(d);$(".mvtimeframe").click(MostViewTimeFrameSet)},error:function(d,f,e){alert(d.status);alert(f);alert(e)}})}function DisplayProgressIndication(){var a=$("#latestcontent").height();$("#latestcontent").html('<table id="LatestTable"><tr><td id="loadingRss">Loading Articles...<br/><br/><img src="http://s3.gold-speculator.com/images/loadingAnimation.gif" /></td></tr></table>');$("#latestcontent tbody td").height(a-4)}function DisplayProgressIndicationRss(){var a=$("#RSSTable").height();var b=$("#pagingRss").height();$("#contentRss").html('<table id="RSSTable"><tr><td id="loadingRss">Loading Articles...<br/><br/><img src="http://s3.gold-speculator.com/images/loadingAnimation.gif" /></td></tr></table><div class="pagingRss"></div>');$("#contentRss tbody td").height(a)}function DisplayProgressIndicationMine(){var a=$("#mineRssTable").height();$("#contentMineRss").html('<table id="mineRssTable"><tr><td id="loadingRss">Loading Mining Press Releases...<br/><br/><img src="http://s3.gold-speculator.com/images/loadingAnimation.gif" /></td></tr></table><div class="pagingRss"></div>');$("#contentMineRss tbody td").height-6}function ApplyTemplate(a){$("#contentRss").setTemplateURL("/index/rssnewstemp.tpl",null,{filter_data:false});$("#contentRss").processTemplate(a);if(pageLoad===true){$(".grid").css("height","auto");pageLoad=false}}function ApplyTemplateFeed(a){$("#contentRss").setTemplateURL("/index/rssfeednewstemp.tpl",null,{filter_data:false});$("#contentRss").processTemplate(a);if(pageLoad===true){$(".grid").css("height","auto");pageLoad=false}}function ApplyMineTemplate(a){$("#contentMineRss").setTemplateURL("/dev/index/minersstemp.tpl",null,{filter_data:false});if(pageLoad===true){$("#contentMineRss").hide()}$("#contentMineRss").processTemplate(a);if(pageLoad===true){$("#contentMineRss").customFadeIn("slow");$(".grid").css("height","auto");pageLoad=false}}function ApplyLatestTemplate(a){$("#latestcontent").setTemplateURL("/index/latesttemp.tpl",null,{filter_data:false});$("#latestcontent").processTemplate(a)}function ApplyLatestCommentsTemplate(a){$("#latestcontent").setTemplateURL("/index/latestcommentstemp.tpl",null,{filter_data:false});$("#latestcontent").processTemplate(a)}function ApplyMostViewsTemplate(a){$("#latestcontent").setTemplateURL("/index/mostviewstemp.tpl",null,{filter_data:false});$("#latestcontent").processTemplate(a)}function UpdatePagingLatest(){if(currentPageLatest!=1){$("#PrevPageLatest").attr("href","#");$("#PrevPageLatest").click(PrevPageLatest)}if(currentPageLatest!=lastPage){$("#NextPageLatest").attr("href","#");$("#NextPageLatest").click(NextPageLatest)}}function ViewComments(a){a.preventDefault();var b=$("#articlestab").attr("class");if(b==="youarehere"){latestFirstPageHtml=$("#latestcontent").html()}DisplayProgressIndication();setTimeout("DisplayLatestComments(1)",1000);$("#mostviews").removeClass("youarehere");$("#articlestab").removeClass("youarehere").click(function(c){c.preventDefault();DisplayProgressIndication();setTimeout("$('#latestcontent').html(latestFirstPageHtml);",1000);$("#commentstab").removeClass("youarehere");$("#articlestab").addClass("youarehere");$("#mostviews").removeClass("youarehere")});$("#commentstab").addClass("youarehere")}function ViewMostViews(a){a.preventDefault();var b=$("#articlestab").attr("class");if(b==="youarehere"){latestFirstPageHtml=$("#latestcontent").html()}DisplayProgressIndication();setTimeout("DisplayMostViews(1, TimeFrame)",1000);$("#articlestab").removeClass("youarehere").click(function(c){c.preventDefault();DisplayProgressIndication();setTimeout("$('#latestcontent').html(latestFirstPageHtml);",1000);$("#commentstab").removeClass("youarehere");$("#articlestab").addClass("youarehere");$("#mostviews").removeClass("youarehere")});$("#commentstab").removeClass("youarehere");$("#mostviews").addClass("youarehere")}function MostViewTimeFrameSet(b){b.preventDefault();var a=$(this).attr("id");DisplayMostViews(1,a)}function NextPageLatest(a){a.preventDefault();if(currentPageLatest===1){latestFirstPageHtml=$("#latestcontent").html()}DisplayProgressIndication();setTimeout("DisplayLatestTable(++currentPageLatest)",1200)}function PrevPageLatest(a){a.preventDefault();DisplayProgressIndication();if(currentPageLatest===2){setTimeout("FirstPageLatest()",1200)}else{setTimeout("DisplayLatestTable(--currentPageLatest)",1200)}}function FirstPageLatest(){$("#latestcontent").html(latestFirstPageHtml);--currentPageLatest;$("#ViewMore").attr("href","#");$("#ViewMore").click(NextPageLatest)}function ReturnLiveArticlePage(){$("#contentRss").html(LiveArticleFirstPageHtml);UpdatePaging();tb_init("a.rssLink")}function UpdatePaging(){if(currentPage!=1){$("#PrevPageRss").attr("href","#");$("#PrevPageRss").click(PrevPage)}if(currentPage!=lastPage){$("#NextPageRss").attr("href","#");$("#NextPageRss").click(NextPage)}$(".rssFeedLink").click(ShowFeed)}function UpdatePagingFeed(){if(currentPageFeed!=1){$("#PrevPageRssFeed").attr("href","#");$("#PrevPageRssFeed").click(PrevPageFeed)}if(currentPageFeed!=lastPageFeed){$("#NextPageRssFeed").attr("href","#");$("#NextPageRssFeed").click(NextPageFeed)}$("#AllPageRss").attr("href","#");$("#AllPageRss").click(ReturnToAll)}function NextPage(a){a.preventDefault();pageTracker._trackEvent("LAI","NextPage");DisplayProgressIndicationRss();setTimeout("DisplayRSSTable(++currentPage)",1200)}function PrevPage(a){a.preventDefault();pageTracker._trackEvent("LAI","PreviousPage");DisplayProgressIndicationRss();if(currentPage===2){$("#PrevPage").removeAttr("href")}setTimeout("DisplayRSSTable(--currentPage)",1200)}function ShowFeed(a){a.preventDefault();FeedId=$(a.target).attr("id").replace("feed","");pageTracker._trackPageview("/LiveArticleInbox/"+FeedId);LiveArticleFirstPageHtml=$("#contentRss").html();DisplayProgressIndicationRss();setTimeout("DisplayRSSTableFeed(currentPageFeed,FeedId)",1200)}function ReturnToAll(a){a.preventDefault();DisplayProgressIndicationRss();setTimeout("DisplayRSSTable(currentPage)",1200)}function NextPageFeed(a){a.preventDefault();pageTracker._trackEvent("LAI","Next Page Feed");DisplayProgressIndicationRss();setTimeout("DisplayRSSTableFeed(++currentPageFeed,FeedId)",1200)}function PrevPageFeed(a){a.preventDefault();var b=$(a.target).attr("id").replace("feed","");pageTracker._trackEvent("LAI","Previous Page Feed");DisplayProgressIndicationRss();if(currentPage===2){$("#PrevPage").removeAttr("href")}setTimeout("DisplayRSSTableFeed(--currentPageFeed,FeedId)",1200)}function UpdateMinePaging(){if(currentMinePage!=1){$("#PrevPageMine").attr("href","#");$("#PrevPageMine").click(PrevMinePage)}if(currentMinePage!=lastMinePage){$("#NextPageMine").attr("href","#");$("#NextPageMine").click(NextMinePage)}}function NextMinePage(a){a.preventDefault();DisplayProgressIndicationMine();setTimeout("DisplayMineTable(++currentMinePage)",1200)}function PrevMinePage(a){a.preventDefault();DisplayProgressIndicationMine();if(currentMinePage===2){$("#PrevPageMine").removeAttr("href")}setTimeout("DisplayMineTable(--currentMinePage)",1200)}function DateDeserialize(dateStr){return eval("new"+dateStr.replace(/\//g," "))}var dateFormat=function(){var a=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,b=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,d=/[^-+\dA-Z]/g,c=function(f,e){f=String(f);e=e||2;while(f.length<e){f="0"+f}return f};return function(i,v,q){var g=dateFormat;if(arguments.length==1&&(typeof i=="string"||i instanceof String)&&!/\d/.test(i)){v=i;i=undefined}i=i?new Date(i):new Date();if(isNaN(i)){throw new SyntaxError("invalid date")}v=String(g.masks[v]||v||g.masks["default"]);if(v.slice(0,4)=="UTC:"){v=v.slice(4);q=true}var t=q?"getUTC":"get",l=i[t+"Date"](),e=i[t+"Day"](),j=i[t+"Month"](),p=i[t+"FullYear"](),r=i[t+"Hours"](),k=i[t+"Minutes"](),u=i[t+"Seconds"](),n=i[t+"Milliseconds"](),f=q?0:i.getTimezoneOffset(),h={d:l,dd:c(l),ddd:g.i18n.dayNames[e],dddd:g.i18n.dayNames[e+7],m:j+1,mm:c(j+1),mmm:g.i18n.monthNames[j],mmmm:g.i18n.monthNames[j+12],yy:String(p).slice(2),yyyy:p,h:r%12||12,hh:c(r%12||12),H:r,HH:c(r),M:k,MM:c(k),s:u,ss:c(u),l:c(n,3),L:c(n>99?Math.round(n/10):n),t:r<12?"a":"p",tt:r<12?"am":"pm",T:r<12?"A":"P",TT:r<12?"AM":"PM",Z:q?"UTC":(String(i).match(b)||[""]).pop().replace(d,""),o:(f>0?"-":"+")+c(Math.floor(Math.abs(f)/60)*100+Math.abs(f)%60,4),S:["th","st","nd","rd"][l%10>3?0:(l%100-l%10!=10)*l%10]};return v.replace(a,function(m){return m in h?h[m]:m.slice(1,m.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(a,b){return dateFormat(this,a,b)};function tb_init(b){$(b).click(function(){var c=this.href||this.alt;a(c);this.blur();return false});function a(c){pageTracker._trackPageview("/GoldReader/"+c);try{if(typeof document.body.style.maxHeight==="undefined"){$("body","html").css({height:"100%",width:"100%"});$("html").css("overflow","hidden");if(document.getElementById("TB_HideSelect")===null){$("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");$("#TB_overlay").click(tb_remove)}}else{if(document.getElementById("TB_overlay")===null){$("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");$("#TB_overlay").click(tb_remove)}}if(tb_detectMacXFF()){$("#TB_overlay").addClass("TB_overlayMacFFBGHack")}else{$("#TB_overlay").addClass("TB_overlayBG")}TB_WIDTH=$(window).width()+17||630;TB_HEIGHT=$(window).height()||440;ajaxContentW=TB_WIDTH;ajaxContentH=TB_HEIGHT-35;$("#TB_window").append("<div id='TB_title'><table id='TB_table' align='center'><tr><td width='35px'><a href='#' class='TB_closeWindowButton' title='Close'><img id='TB_window_back' alt='back' src='images/reader_back.png' /></a></td><td><a href='#' class='TB_closeWindowButton' title='Close'> &nbsp;Return to Gold Speculator</a></td><td width='200px'><span class='titlereader'>GS Reader</span></td></tr></table></div><iframe frameborder='0' hspace='0' src='"+c+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' style='width:"+(ajaxContentW)+"px;height:"+(ajaxContentH)+"px;' > </iframe>");$("#TB_window").show();$("html").css("overflow","hidden");$("#TB_title").show();$("#TB_shadow").show("slow");$("#TB_iframeContent").show();$(".TB_closeWindowButton").click(tb_remove);tb_position();if($.browser.safari){$("#TB_load").remove();$("#TB_window").css({display:"block"})}document.onkeyup=function(f){if(f==null){keycode=event.keyCode}else{keycode=f.which}if(keycode==27){tb_remove()}}}catch(d){alert(d)}}}function tb_showIframe(){$("#TB_load").remove();$("#TB_window").slideDown("slow")}function tb_remove(){pageTracker._trackPageview("/GoldReader/Return");$("#TB_closeWindowButton").unbind("click");$("#TB_shadow").hide();$("#TB_title").slideUp("1000");setTimeout('$("#TB_window").hide("fast",function(){$("#TB_window,#TB_overlay,#TB_HideSelect").trigger("unload").unbind().remove()})',1000);$("#TB_iframeContent,#TB_overlay").hide();$("html").css("overflow","auto");if(typeof document.body.style.maxHeight=="undefined"){$("body","html").css({height:"auto",width:"auto"});$("html").css("overflow","")}document.onkeydown="";document.onkeyup="";return false}function tb_position(){$("#TB_window").css({marginLeft:"-"+parseInt((TB_WIDTH/2),10)+"px",width:TB_WIDTH+"px"});if(!(jQuery.browser.msie&&jQuery.browser.version<7)){$("#TB_window").css({marginTop:"-"+parseInt((TB_HEIGHT/2),10)+"px"})}}function tb_detectMacXFF(){var a=navigator.userAgent.toLowerCase();if(a.indexOf("mac")!=-1&&a.indexOf("firefox")!=-1){return true}}(function(a){a.fn.customFadeIn=function(b,c){a(this).fadeIn(b,function(){if(jQuery.browser.msie){a(this).get(0).style.removeAttribute("filter")}if(c!=undefined){c()}})};a.fn.customFadeOut=function(b,c){a(this).fadeOut(b,function(){if(jQuery.browser.msie){a(this).get(0).style.removeAttribute("filter")}if(c!=undefined){c()}})}})(jQuery);function jsddm_open(){jsddm_canceltimer();jsddm_close();ddmenuitem=$(this).find("ul").css("visibility","visible")}function jsddm_close(){if(ddmenuitem){ddmenuitem.css("visibility","hidden")}}function jsddm_timer(){closetimer=window.setTimeout(jsddm_close,timeout)}function jsddm_canceltimer(){if(closetimer){window.clearTimeout(closetimer);closetimer=null}}function Scroll(){$("#scroller").serialScroll({items:"li",prev:"#scrollprevious",next:"#scrollnext",start:1,step:3,duration:500,exclude:1,easing:"swing"})};