var Ajax={newRequest:function(){var c=null;try{c=new XMLHttpRequest()}catch(b){try{c=new ActiveXObject("Msxml2.XMLHTTP")}catch(d){try{c=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){c=null}}}return c}};function BannerRotation(){var i=10,v=true,s="/ajax/hpb.php",D="/cms/hpb/",t="/images/icons/progress.gif",g="/images/icons/error.gif",B=false,u=null,F=null,o=null,G=true,x=0,h=0,w=0,m=new Array(),y="banner-item",k=null,I="",n=0,b=0,j=function(){if(k){var M=document.createElement("div"),L=document.createElement("div"),N=document.createElement("a"),K=document.createElement("img");M.id=I+"-status";M.style.display="none";k.appendChild(M);L.id=I+"-item";L.className=y;k.appendChild(L);N.id=I+"-link";k.appendChild(N);K.src="/images/main/spacer.gif";N.appendChild(K);return true}else{return false}},a=function(){if(Browser.NAME=="Internet Explorer"&&Browser.VERSION<=6){(new Image()).src="/images/banners/play_over.png";(new Image()).src="/images/banners/pause_over.png";(new Image()).src="/images/banners/prev_over.png";(new Image()).src="/images/banners/next_over.png";(new Image()).src="/images/banners/play_hit.png";(new Image()).src="/images/banners/pause_hit.png";(new Image()).src="/images/banners/prev_hit.png";(new Image()).src="/images/banners/next_hit.png";(new Image()).src="/images/banners/pause.png";(new Image()).src="/images/banners/pause_over.png";(new Image()).src="/images/banners/pause_hit.png"}},l=function(){var O=Ajax.newRequest(),U,N,R,L,P,S,K,Q,M,T="";O.open("POST",s,true);O.onreadystatechange=function(){if(O.readyState==4){if(O.status==200){m=new Array();U=O.responseXML;N=U.getElementsByTagName("Banners");for(R=0;R<N.length;R++){L=(N[R].getElementsByTagName("ID")[0])?N[R].getElementsByTagName("ID")[0].firstChild.nodeValue:"";P=(N[R].getElementsByTagName("IndexID")[0])?N[R].getElementsByTagName("IndexID")[0].firstChild.nodeValue:"";S=(N[R].getElementsByTagName("Description")[0])?N[R].getElementsByTagName("Description")[0].firstChild.nodeValue:"";K=(N[R].getElementsByTagName("LinkURL")[0])?N[R].getElementsByTagName("LinkURL")[0].firstChild.nodeValue:"";Q=(N[R].getElementsByTagName("LinkTarget")[0])?N[R].getElementsByTagName("LinkTarget")[0].firstChild.nodeValue:"";M=(N[R].getElementsByTagName("LastUpdated")[0])?N[R].getElementsByTagName("LastUpdated")[0].firstChild.nodeValue.substr(0,N[R].getElementsByTagName("LastUpdated")[0].firstChild.nodeValue.indexOf(".")):"";m.push({ID:L,IndexID:P,Description:S,LinkURL:K,LinkTarget:Q,FileDate:M})}if(m.length>1){H()}if(m.length>1&&v){E(false)}r(x)}else{T=O.statusText;if(T.length==0){T="Unspecified error "+O.status.toString()}C(T)}}};O.setRequestHeader("Content-Type","application/x-www-form-urlencoded");O.send(location.search.substring(1))},H=function(){var L=document.createElement("a"),M=document.createElement("a"),K=document.createElement("a");L.id=I+"-btnPrev";L.className="button-prev";L.setAttribute("title","Previous");L.href="javascript:void(0);";L.onmouseover=function(){this.className="button-prev-over"};L.onmousedown=function(){this.className="button-prev-hit"};L.onmouseup=function(){this.className="button-prev-over"};L.onmouseout=function(){this.className="button-prev"};L.onclick=d;k.appendChild(L);M.id=I+"-btnPlayPause";M.className="button-play";M.setAttribute("title","Play");M.href="javascript:void(0);";M.onmouseover=function(){this.className="button-play-over"};M.onmousedown=function(){this.className="button-play-hit"};M.onmouseup=function(){this.className="button-pause-over"};M.onmouseout=function(){this.className="button-play"};M.onclick=c;k.appendChild(M);K.id=I+"-btnNext";K.className="button-next";K.setAttribute("title","Next");K.href="javascript:void(0);";K.onmouseover=function(){this.className="button-next-over"};K.onmousedown=function(){this.className="button-next-hit"};K.onmouseup=function(){this.className="button-next-over"};K.onmouseout=function(){this.className="button-next"};K.onclick=A;k.appendChild(K)},r=function(K){if(F!=null){clearTimeout(F);F=null}var O=document.getElementById(I+"-item"),N=document.getElementById(I+"-link"),L=document.createElement("div"),M=document.createElement("img");if(K>=m.length){K=0}else{if(K<0){K=m.length-1}}if(u!=null){if(o!=null){clearTimeout(o);o=null}o=setTimeout(function(){r(K)},0);return}L.className=y;L.style.zIndex=2;L.style.filter="alpha(opacity=0)";L.style.opacity=0;if(m[K].LinkURL.length>0){N.setAttribute("href",m[K].LinkURL);if(m[K].LinkTarget.length>0){N.setAttribute("target",m[K].LinkTarget)}}else{N.setAttribute("href","javascript:void(0);")}k.appendChild(L);N.setAttribute("title",m[K].Description);M.setAttribute("alt",m[K].Description);M.setAttribute("border",0);M.setAttribute("galleryimg","no");if(n>0&&b>0){M.setAttribute("width",n);M.setAttribute("height",b)}M.src=D+m[K].ID+".jpg?tt="+encodeURIComponent(m[K].FileDate.replace(/[^0-9]/g,""));L.appendChild(M);if(M.complete){z(L,O)}else{J();M.onload=function(){z(L,O)}}x=K},e=function(K){if(K>=m.length){K=0}else{if(K<0){K=m.length-1}}(new Image()).src=D+m[K].ID+".jpg?tt="+encodeURIComponent(m[K].FileDate.replace(/[^0-9]/g,""))},z=function(L,K){q();if(F!=null){clearTimeout(F);F=null}if(u!=null){f(L,K)}u=setInterval(function(){p(L,K)},20)},p=function(M,L){if(h>=100){f(M,L)}else{h=h+5;var K=(h/100);M.style.zIndex=2;M.style.filter="alpha(opacity="+h+")";M.style.opacity=K}},f=function(L,K){if(u!=null){clearInterval(u);u=null}if(K){K.parentNode.removeChild(K)}L.id=I+"-item";L.style.zIndex=1;L.style.filter="alpha(opacity=100)";L.style.opacity=1;h=0;if(B){F=setTimeout(A,i*1000)}if(m.length>1){e(x+1)}G=false},E=function(L){var K=document.getElementById(I+"-btnPlayPause");if(B){if(K){K.className=(L)?"button-play-over":"button-play";K.setAttribute("title","Play");K.onmouseover=function(){this.className="button-play-over"};K.onmousedown=function(){this.className="button-play-hit"};K.onmouseup=function(){this.className="button-pause-over"};K.onmouseout=function(){this.className="button-play"}}B=false}else{if(K){K.className=(L)?"button-pause-over":"button-pause";K.setAttribute("title","Pause");K.onmouseover=function(){this.className="button-pause-over"};K.onmousedown=function(){this.className="button-pause-hit"};K.onmouseup=function(){this.className="button-play-over"};K.onmouseout=function(){this.className="button-pause"}}B=true}},c=function(){if(F!=null){clearTimeout(F);F=null}E(true);if(B){F=setTimeout(A,i*1000)}},d=function(){if(m.length>1){r(x-1)}},A=function(){if(m.length>1){r(x+1)}},J=function(){if(w==1){return}var L=document.getElementById(I+"-status");if(L){while(L.firstChild){L.removeChild(L.firstChild)}var K=document.createElement("img");K.src=t;K.width="16";K.height="16";K.border="0";K.setAttribute("align","absmiddle");L.appendChild(K);L.appendChild(document.createTextNode(" Loading..."));L.style.display="";L.style.width="90px";w=1}},C=function(M){if(w==2){return}var L=document.getElementById(I+"-status");if(L){while(L.firstChild){L.removeChild(L.firstChild)}var K=document.createElement("img");K.src=g;K.width="16";K.height="16";K.border="0";K.setAttribute("align","absmiddle");L.appendChild(K);L.appendChild(document.createTextNode(" "+M));L.style.display="";L.style.width="250px";w=2}},q=function(){if(w==0){return}var K=document.getElementById(I+"-status");if(K){K.style.display="none";w=0}};this.setScriptURL=function(K){s=K};this.setImageURL=function(K){D=K};this.setBannerSize=function(L,K){n=parseInt(L);b=parseInt(K)};this.setDisplayTime=function(K){if(parseInt(K)>0){i=K}else{throw new Error("Display time must be a valid number in seconds")}};this.setDefaultPlay=function(K){v=(K)?true:false};this.create=function(L){I=L;k=document.getElementById(I);var K=j();if(K){a();l()}}}$(function(){if(document.getElementById("HomePageRotation")){var a=new BannerRotation();a.create("HomePageRotation");return}});
