// IE Version code from http://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx
function pfIEv(){var rv = -1; if (navigator.appName == 'Microsoft Internet Explorer'){ var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); if (re.exec(navigator.userAgent) != null)rv = parseFloat( RegExp.$1 );} return rv;}var ieV=pfIEv();

// All The rest: Shading Picture Frame by Colinot Business & Technologies Services Copyright (C)2011 www.colinot.net
/*

Requires a container with unique ID "pictureFrame" (case sensitive)

Usage:
	pfASetup([Steps], [PauseBetweenPictures], [ShowDescription]) - Setup the animation properties
	pfA([Image URL], [Link], [Description]) - Add an image to the animation stack

*/
var pfI=new Array();var pfIdx=0;var pfSteps=30;var pfWStep=0;var pfPauseFor=3500;var pfText=true;var pfT=null;
function pfWt(s){var d=document.createElement('DIV'); d.appendChild(document.createTextNode(s)); return d;}
function pfASetup(Steps, PauseBetweenPictures, ShowDesc){ pfPauseFor=PauseBetweenPictures; pfSteps=Steps; pfText=ShowDesc; pfWStep=(document.getElementById('pictureFrame').offsetWidth+2)/pfSteps;}
function pfA(src, link, desc){ var idx=pfI.length; var img=document.createElement('IMG');var pf=document.getElementById('pictureFrame'); pfWStep=(pf.offsetWidth+2)/pfSteps;img.src=src;if (pf.clientHeight>pf.clientWidth){img.style.height='100%';} else{img.style.width='100%';} img.style.border='0';var z=idx; var com=document.createElement('a');com.href=link;com.style.width=pf.offsetWidth+'px';com.style.height=pf.offsetHeight+'px';com.style.position='absolute';com.style.left='-'+pf.offsetWidth+'px';com.style.top='0px';com.style.zIndex=-idx;if (idx>0)com.style.display='none';com.appendChild(img);if (pfText)com.appendChild(pfWt(desc));pfI[idx]=new Array(com, 0, link);pf.appendChild(com);pfSetZ();}
function pfStart(){try{clearTimeout(pfT);}catch(x){}setTimeout('pfAnimate(0)', pfPauseFor);}
function pfSetZ(){var p1=pfIdx, p2=(pfIdx==(pfI.length-1)?0:pfIdx+1); pfI[p1][0].style.zIndex=1; pfI[p2][0].style.zIndex=0;pfI[p1][1]=0; pfI[p2][1]=0;pfI[p1][0].style.left='0px';pfI[p2][0].style.left='0px';pfSO(pfI[p1][0], 100);pfSO(pfI[p2][0], 100);for(var j=0;j<pfI.length;j++)if (j!=p1 && j!=p2)pfI[j][0].style.display='none';}
function pfNext(){pfIdx++;if (pfIdx>=pfI.length) pfIdx=0;pfSetZ();}
function pfSO(o, val){o=o.style;o.opacity=(val/100);o.KhtmlOpacity=(val/100); o.MozOpacity=(val/100);if (ieV<9) o.filter="alpha(opacity=" + val + ")";}
function pfAnimate(step){ var p2=(pfIdx==(pfI.length-1)?0:pfIdx+1);if (step!=0)pfI[p2][0].style.display='block'; try{clearTimeout(pfT);}catch(x){} pfI[pfIdx][0].style.left=-(pfWStep*step)+"px"; pfI[pfIdx][1]=(pfWStep*step); pfSO(pfI[pfIdx][0],100 - (step/pfSteps * 100)); if (step>=pfSteps){ pfNext(); step=-1; pfT=setTimeout('pfAnimate(0)', pfPauseFor);} else{step++;pfT=setTimeout('pfAnimate('+step+')', 16.68);}}
