/*
	Javascript code written by PSLWeb.co.uk for Humble Cake (www.humblecake.co.uk)
	[except where noted below]. Copyright ©2009 PSLWeb.co.uk - All Rights Reserved.
*/
function runOnLoad(f){if(runOnLoad.loaded)f();else runOnLoad.funcs.push(f)};runOnLoad.funcs=[];runOnLoad.loaded=false;runOnLoad.run=function(){if(runOnLoad.loaded)return;for(var i=0;i<runOnLoad.funcs.length;i++){try{runOnLoad.funcs[i]()}catch(e){}}runOnLoad.loaded=true;delete runOnLoad.funcs;delete runOnLoad.run};if(window.addEventListener)window.addEventListener("load",runOnLoad.run,false);else if(window.attachEvent)window.attachEvent("onload",runOnLoad.run);else window.onload=runOnLoad.run;sfHover=function(){var a=document.getElementById("nav").getElementsByTagName("LI");for(var i=0;i<a.length;i++){a[i].onmouseover=function(){this.className+=" sfhover"};a[i].onmouseout=function(){this.className=this.className.replace(new RegExp(" sfhover\\b"),"")}}};if((window.attachEvent)&&(!(window.XMLHttpRequest)))window.attachEvent("onload",sfHover);var COOKIE={};COOKIE.exists=function(a){if(document.cookie){cookies=document.cookie.split("; ");for(i=0;i<cookies.length;i++)if(cookies[i].split("=")[0]==a)return true}return false};COOKIE.read=function(a){if(document.cookie){cookies=document.cookie.split("; ");for(i=0;i<cookies.length;i++)if(cookies[i].split("=")[0]==a)return cookies[i].split("=")[1]}return""};COOKIE.set=function(a,b,c){var d=new Date;d.setMonth(d.getTime()+c*1000*60*60*24);document.cookie=a+"="+b.toString()+";expires="+d.toGMTString()};COOKIE.remove=function(a){var b=new Date;b.setMonth(b.getMonth()-1);document.cookie=a+"=null"+";expires="+b.toGMTString()};var HTTP={};HTTP.newRequest=function(){var a=false;if(window.XMLHttpRequest)a=new XMLHttpRequest();else if(window.ActiveXObject){try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{a=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}}return a};HTTP.parseXML=function(a){var b=a.getElementsByTagName("comment");var c=b.length;var d,comment;var e=new Array();for(var i=0;i<c;i++){d=b[i].getAttribute("cite");comment=b[i].firstChild.data;e[i]=comment+"&#8221";if(d)e[i]+="<br />&#8211; <cite>"+d+"</cite>"}var f=document.getElementById('commentContainer');f.innerHTML='<p id="leftQuote">&#8220;</p><div id="testimonials"><p id="HCComA">&nbsp;</p></div>';var g=new Slideshow(24,2,10,true,e,'testimonials','HCComA','HCComB')};HTTP.init=function(){var a="testimonials.xml";var b=(location.hostname=="localhost")?"/hc/":"/";var c=location.protocol+'//'+location.hostname+b+a;var d=HTTP.newRequest();if(!(d))return;d.onreadystatechange=function(){if((d.readyState==4)&&(d.status==200))HTTP.parseXML(d.responseXML)};d.open("GET",c);d.send(null)};function Slideshow(d,e,f,g,h,i,j,k){if(!(document.getElementById(i)))return;this.frameRate=d;this.commentList=h;this.numComments=h.length;this.thisComment=(COOKIE.exists("thisComment"))?COOKIE.read("thisComment"):Math.floor(Math.random()*this.numComments);this.nextComment=(this.thisComment<this.numComments-1)?parseInt(this.thisComment)+1:0;this.commentSwitch=false;this.fadeRate=d*e;this.fadeCount=this.fadeRate+1;this.cycleRate=1000/d;this.commentStatic=f*1000;this.loop=g;this.ssCommentA=j;this.ssCommentB=k;var l=this;var i=document.getElementById(i);var m=document.getElementById(this.ssCommentA);m.innerHTML=l.commentList[l.thisComment];var n=document.createElement("P");n.style.marginTop="0px";n.style.paddingLeft="0.5em";n.style.position="absolute";n.style.top="0px";n.style.left="0px";n.style.opacity=0;n.style.MozOpacity=0;n.style.KhtmlOpacity=0;n.style.filter='alpha(opacity=0)';n.id=this.ssCommentB;i.appendChild(n);this.startFade=function(){l.timer=setInterval(l.fadeComment,l.cycleRate)};this.fadeComment=function(){if(l.fadeCount<=l.fadeRate){var a=(l.commentSwitch)?document.getElementById(l.ssCommentA):document.getElementById(l.ssCommentB);a.style.opacity=1-(l.fadeCount/l.fadeRate);a.style.MozOpacity=1-(l.fadeCount/l.fadeRate);a.style.KhtmlOpacity=1-(l.fadeCount/l.fadeRate);a.style.filter='alpha(opacity='+eval(100-(100*l.fadeCount/l.fadeRate))+')';var b=(l.commentSwitch)?document.getElementById(l.ssCommentB):document.getElementById(l.ssCommentA);b.style.opacity=l.fadeCount/l.fadeRate;b.style.MozOpacity=l.fadeCount/l.fadeRate;b.style.KhtmlOpacity=l.fadeCount/l.fadeRate;b.style.filter='alpha(opacity='+eval(100*l.fadeCount/l.fadeRate)+')';l.fadeCount++}else{var c=(l.commentSwitch)?document.getElementById(l.ssCommentA):document.getElementById(l.ssCommentB);c.innerHTML=l.commentList[l.nextComment];l.thisComment=l.nextComment++;if(l.nextComment>=l.numComments)l.nextComment=0;COOKIE.set("thisComment",l.thisComment,28);if((l.loop)||(l.nextComment!=1)){l.commentSwitch=!(l.commentSwitch);l.fadeCount=0;clearInterval(l.timer);setTimeout(l.startFade,l.commentStatic)}else clearInterval(l.timer)}};setTimeout(this.startFade,0)};runOnLoad(HTTP.init);
