function getColour(a){switch(a){case 0:return"#ff0000";case 1:return"#d71700";case 2:return"#c03000";case 3:return"#a74700";case 4:return"#906000";case 5:return"#777700";case 6:return"#609000";case 7:return"#77a700";case 8:return"#90c000";case 9:return"#a7d700";case 10:return"#c0ff00"}return"#cccccc"}var DAYS_OF_WEEK=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];var MONTHS=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function showTimeSeries(d,b){var g=0;b.setTime(b.getTime()-(d.length-1)*1000*60*60*24);for(var a=0;a<d.length;a++){var f=getColour(d[a]);var e=DAYS_OF_WEEK[b.getDay()]+" "+b.getDate();var c="<div style='position: absolute; bottom: 0; left: "+g+"px; height: "+(d[a]+1)*10+"px; width: 5px; background-color: "+f+"' title='"+e+"' alt='"+e+"'>&nbsp;</div>";document.write(c);b.setTime(b.getTime()+(1000*60*60*24));g+=5}}function average(b){var d=0;for(var c=0;c<b.length;c++){d+=b[c]}return d/b.length}function showRollingSeries(d,b){var c=0;var k=7;var h=[];var g=0;b.setTime(b.getTime()-(d.length-1)*1000*60*60*24);for(var j=0;j<d.length;j++){h[g]=d[j];g=(g+1)%k;var i=average(h);var a=getColour(Math.round(i));var f=DAYS_OF_WEEK[b.getDay()]+" "+b.getDate()+" - "+(Math.round(i*10)/10);var e="<div style='position: absolute; bottom: 0; left: "+c+"px; height: "+Math.round((i+1)*10)+"px; width: 5px; background-color: "+a+"' title='"+f+"' alt='"+f+"'>&nbsp;</div>";document.write(e);b.setTime(b.getTime()+(1000*60*60*24));c+=5}}function omega(b,a){return 2*Math.PI*b/a}function showFourierSeries(h){var r=new Array();var p=new Array();var o=new Array();var q=0;var d=0;for(var k=0;k<h.length;k++){if(h[k]!=-1){d=k;break}}var g=h.length-d;if(g<2){document.write("<p>Insufficient data</p>");return o}even=g%2==0;var v=0;var f=0;for(var e=d;e<h.length;e++){v+=h[e];f++}var b=v/f;for(var u=0;u<=g/2;u++){var m=0;var l=0;var a=0;for(var t=d;t<h.length;t++){m+=(h[t]-b)*Math.cos(omega(u,g)*a);l+=(h[t]-b)*Math.sin(omega(u,g)*a);a++}if(u<g/2||!even){r[u]=2*m/g;p[u]=2*l/g}else{r[u]=2*m/g}o[u]=r[u]*r[u]+p[u]*p[u];if(o[u]>q){q=o[u]}}var c=0;if(q==0){document.write("<p>No cycles found</p>");return o}for(var k=0;k<o.length;k++){var j=getColour(Math.round(o[k]*10/q));var s=""+k+" day cycle: "+o[k].toFixed(2);var n=Math.round(o[k]*100/q).toFixed(2);var i="<div style='position: absolute; bottom: 0; left: "+c+"px; height: "+n+"px; width: 10px; background-color: "+j+"' title='"+s+"' alt='"+s+"'>&nbsp;</div>";document.write(i);c+=10}return o}function showCycles(g){var e=-1,c=-1,b=-1;var h=0,f=0,d=0;for(var a=0;a<g.length;a++){if(g[a]>e){b=c;d=f;c=e;f=h;e=g[a];h=a}else{if(g[a]>c){b=c;d=f;c=g[a];f=a}else{if(g[a]>b){b=g[a];d=a}}}}if(h!=-1){document.write("1st: <b>"+h+" day cycle</b> (strength "+e.toFixed(1)+")<br/>");if(f!=-1){document.write("2nd: <b>"+f+" day cycle</b> (strength "+c.toFixed(1)+")<br/>");if(d!=-1){document.write("3rd: <b>"+d+" day cycle</b> (strength "+b.toFixed(1)+")<br/>")}}}}function calculateCorrelation(m,l){if(m.length==0||l.length==0){return"0.0"}var e=0;var d=0;var p=0;var q=m[0]*1;var o=l[0]*1;var h=Math.min(m.length,l.length);for(var f=1;f<h;f++){var n=((f+f)-1)/(f+1);var c=m[f]-q;var b=l[f]-o;e+=c*c*n;d+=b*b*n;p+=c*b*n;q+=c/(f+1);o+=b/(f+1)}var k=Math.sqrt(e/h);var j=Math.sqrt(d/h);var g=p/h;var a=g/(k*j);return a}function openid_auth(c){var a="";var d=false;var b=false;var e=false;if(c=="google"){a="https://www.google.com/accounts/o8/id";d=true}else{if(c=="yahoo"){a="http://yahoo.com/";d=true}else{if(c=="openid"){b=true}else{if(c=="aol"){a="http://openid.aol.com/{username}";e=true;d=false}}}}if(b){document.getElementById("openid_manual").style.display="block"}else{document.getElementById("openid_manual").style.display="none"}if(e){document.getElementById("openid_username_div").style.display="block"}else{document.getElementById("openid_username_div").style.display="none"}document.getElementById("openid_provider").value=a;if(d){document.getElementById("openid_form").submit()}};