function ipFlickrSlideShow(divId, tableIdList, objectName, showInterval, advanceControlsVisible, captionId, playBtnId, stopBtnId, prevBtnId, nextBtnId)
{
this.panelId=divId;
this.previousTableIndex=-1;
this.currentTableIndex=0;
this.advanceControlsVisible=advanceControlsVisible;
this.slideShowStopped=false;
this.captionId=captionId;
this.playBtnId=playBtnId;
this.stopBtnId=stopBtnId;
this.prevBtnId=prevBtnId;
this.nextBtnId=nextBtnId;
this.prevButtonDown=false;
this.nextButtonDown=false;
this.eventVar=null;
this.loading=false;
this.reverseSlide=false;
this.tableList=new Array();
for (i=0; i<tableIdList.length; i++)
{
this.tableList[i]=document.getElementById(tableIdList[i]);
}
this.name=objectName;
this.interval=showInterval;
this.allImgsLoaded=false;
this.allImagesLoaded=function()
{
if (!this.allImgsLoaded)
{
this.allImgsLoaded=true;
var objImages = document.getElementById(this.panelId).getElementsByTagName("IMG");
for (var i=0; i<objImages.length; i++)
{
if (!objImages[i].complete)
{
this.allImgsLoaded=false;
break;
}
}
}
return this.allImgsLoaded;
};
this.setPanelSize=function()
{
var objPanel=document.getElementById(this.panelId);
var intHeight=0;
var intWidth=0;
for (var i=0; i<this.tableList.length; i++)
{
if (i>0)
this.tableList[i].style.display = '';
if (this.tableList[i].clientWidth>intWidth)
intWidth=this.tableList[i].clientWidth;
if (this.tableList[i].clientHeight>intHeight)
intHeight=this.tableList[i].clientHeight;
if (i>0)
this.tableList[i].style.display = 'none';
}
if (objPanel.style.height == '')
objPanel.style.height = intHeight + 'px';
if (objPanel.style.width == '')
objPanel.style.width = intWidth + 'px';
};
this.toggleControls=function(index)
{
if (this.advanceControlsVisible)
{
var currentIndex=Number(index);
document.getElementById(this.nextBtnId).src = document.getElementById(this.nextBtnId).src.replace('bt_d_','bt_u_');
if (currentIndex==0)
{
document.getElementById(this.prevBtnId).src = document.getElementById(this.prevBtnId).src.replace('bt_u_','bt_d_');
document.getElementById(this.captionId).innerHTML = 'Showing slide 1 of ' + this.tableList.length;
}
if (currentIndex>0)
{
document.getElementById(this.prevBtnId).src = document.getElementById(this.prevBtnId).src.replace('bt_d_','bt_u_');
document.getElementById(this.captionId).innerHTML = 'Showing slide ' + (currentIndex+1) + ' of ' + this.tableList.length;
}
if (currentIndex==(this.tableList.length-1))
{
document.getElementById(this.nextBtnId).src = document.getElementById(this.nextBtnId).src.replace('bt_u_','bt_d_');
document.getElementById(this.captionId).innerHTML = 'Showing slide ' + this.tableList.length + ' of ' + this.tableList.length;
}
}
};
}
function changeOpac(opacity, id, opacEnd, ptrOnEnd, slideShowInfo)
{
var object=document.getElementById(id).style;
object.background = "#FFF";
if (object.height == '' || Number(object.height) <= 0)
{
object.height=document.getElementById(id).clientHeight;
object.width=document.getElementById(id).clientWidth;
}
object.opacity=(opacity/100);
object.MozOpacity=(opacity/100);
object.KhtmlOpacity=(opacity/100);
object.filter = "alpha(opacity=" + opacity + ")";
if (opacity==opacEnd && slideShowInfo.panelId !=null)
{
ptrOnEnd(slideShowInfo);
}
}
function opacity(id, opacStart, opacEnd, milliSec, slideShowInfo)
{
var speed=Math.round(milliSec/20);
var timer=0;
if(opacStart>opacEnd){
for(i=opacStart; i>=opacEnd; i-=5){
setTimeout("changeOpac(" + i + ",'" + id + "'," + opacEnd + ",onFadeOut," + slideShowInfo.name + ")",(timer * speed));
timer++;
}
}else if(opacStart<opacEnd){
for(i=opacStart; i<=opacEnd; i+=5)
{
setTimeout("changeOpac(" + i + ",'" + id + "'," + opacEnd + ",onFadeIn," + slideShowInfo.name + ")",(timer * speed));
timer++;
}
}
}
function slideOut(id, milliSec, slideShowInfo)
{
var intWidth=document.getElementById(slideShowInfo.panelId).offsetWidth;
var intStep=Math.round(intWidth/100);
var speed=Math.round(milliSec/100);
var timer=0;
if (slideShowInfo.reverseSlide)
{
for(var i=0; i<=intWidth; i+=intStep)
{
setTimeout("changeLeft(" + i + ",'" + id + "'," + slideShowInfo.name + ")",(timer * speed));
timer++;
}
setTimeout("changeLeft(" + intWidth + ",'" + id + "'," + slideShowInfo.name + ")",(timer * speed));
}
else
{
for(var i=0; i<=intWidth; i+=intStep)
{
setTimeout("changeLeft(" + -i + ",'" + id + "'," + slideShowInfo.name + ")",(timer * speed));
timer++;
}
setTimeout("changeLeft(" + -intWidth + ",'" + id + "'," + slideShowInfo.name + ")",(timer * speed));
}
}
function slideIn(id, milliSec, slideShowInfo)
{
var intWidth=document.getElementById(slideShowInfo.panelId).offsetWidth;
var intStep=Math.round(intWidth/100);
var speed=Math.round(milliSec/100);
var timer=0;
if (slideShowInfo.reverseSlide)
{
for(var i=intWidth; i>=0; i-=intStep)
{
setTimeout("changeLeft(" + -i + ",'" + id + "'," + slideShowInfo.name + ")",(timer * speed));
timer++;
}
setTimeout("changeLeft(" + 0 + ",'" + id + "'," + slideShowInfo.name + ")",(timer * speed));
setTimeout("onSlideIn(" + slideShowInfo.name + ")",(timer * speed));
}
else
{
for(var i=intWidth; i>=0; i-=intStep)
{
setTimeout("changeLeft(" + i + ",'" + id + "'," + slideShowInfo.name + ")",(timer * speed));
timer++;
}
setTimeout("changeLeft(" + 0 + ",'" + id + "'," + slideShowInfo.name + ")",(timer * speed));
setTimeout("onSlideIn(" + slideShowInfo.name + ")",(timer * speed));
}
}
function changeLeft(left, id, slideShowInfo)
{
var object=document.getElementById(id).style;
object.left = left + 'px';
}
function onSlideOut(slideShowInfo)
{
var panel=document.getElementById(slideShowInfo.panelId);
var oldTable=slideShowInfo.tableList[slideShowInfo.previousTableIndex];
var newTable=slideShowInfo.tableList[slideShowInfo.currentTableIndex];
newTable.style.display = '';
newTable.style.left=panel.offsetWidth;
slideIn(newTable.id, 2000, slideShowInfo);
slideShowInfo.toggleControls(slideShowInfo.currentTableIndex);
}
function onSlideIn(slideShowInfo)
{
slideShowInfo.previousTableIndex=slideShowInfo.currentTableIndex;
slideShowInfo.currentTableIndex=slideShowInfo.currentTableIndex+1;
if (slideShowInfo.currentTableIndex>(slideShowInfo.tableList.length-1)) slideShowInfo.currentTableIndex=0;
document.getElementById(slideShowInfo.panelId).style.overflow = 'hidden';
if (!slideShowInfo.slideShowStopped)
slideShowInfo.eventVar = setTimeout("slideSlideShow(" + slideShowInfo.name + ")", slideShowInfo.interval);
slideShowInfo.loading=false;
slideShowInfo.reverseSlide=false;
}
function onFadeOut(slideShowInfo)
{
var panel=document.getElementById(slideShowInfo.panelId);
var oldTable=slideShowInfo.tableList[slideShowInfo.previousTableIndex];
var newTable=slideShowInfo.tableList[slideShowInfo.currentTableIndex];
panel.removeChild(oldTable);
newTable.style.display = '';
panel.appendChild(newTable);
opacity(slideShowInfo.panelId, 0, 100, 1000, slideShowInfo);
slideShowInfo.toggleControls(slideShowInfo.currentTableIndex);
}
function onFadeIn(slideShowInfo)
{
slideShowInfo.previousTableIndex=slideShowInfo.currentTableIndex;
slideShowInfo.currentTableIndex=slideShowInfo.currentTableIndex+1;
if (slideShowInfo.currentTableIndex>(slideShowInfo.tableList.length-1)) slideShowInfo.currentTableIndex=0;
if (!slideShowInfo.slideShowStopped)
slideShowInfo.eventVar = setTimeout("fadeSlideShow(" + slideShowInfo.name + ")", slideShowInfo.interval);
slideShowInfo.loading=false;
}
function fadeSlideShow(slideShowInfo)
{
if (slideShowInfo.slideShowStopped || slideShowInfo.loading) return false;
if (!slideShowInfo.allImagesLoaded())
{
setTimeout("fadeSlideShow(" + slideShowInfo.name + ")", 100);
return false;
}
slideShowInfo.loading=true;
var objPanel=document.getElementById(slideShowInfo.panelId);
if (slideShowInfo.previousTableIndex>-1)
{
opacity(slideShowInfo.panelId, 100, 0, 1000, slideShowInfo);
}
else
{
slideShowInfo.setPanelSize();
objPanel.appendChild(slideShowInfo.tableList[slideShowInfo.currentTableIndex]);
onFadeIn(slideShowInfo);
}
}
function slideSlideShow(slideShowInfo)
{
if (slideShowInfo.slideShowStopped || slideShowInfo.loading) return false;
if (!slideShowInfo.allImagesLoaded())
{
setTimeout("slideSlideShow(" + slideShowInfo.name + ")", 100);
return false;
}
slideShowInfo.loading=true;
var objPanel=document.getElementById(slideShowInfo.panelId);
if (slideShowInfo.previousTableIndex>-1)
{
slideShowInfo.tableList[slideShowInfo.previousTableIndex].style.position = 'absolute';
objPanel.style.overflow = 'hidden';
setTimeout("slideOut('" + slideShowInfo.tableList[slideShowInfo.previousTableIndex].id + "', 2000," + slideShowInfo.name + ")",20);
setTimeout("onSlideOut(" + slideShowInfo.name + ")",20);
}
else
{
slideShowInfo.setPanelSize();
onSlideIn(slideShowInfo);
}
}
function noneSlideShow(slideShowInfo)
{
if (slideShowInfo.slideShowStopped || slideShowInfo.loading) return false;
if (!slideShowInfo.allImagesLoaded())
{
setTimeout("noneSlideShow(" + slideShowInfo.name + ")", 100);
return false;
}
slideShowInfo.loading=true;
var objPanel=document.getElementById(slideShowInfo.panelId);
if (slideShowInfo.previousTableIndex>-1)
{
objPanel.removeChild(slideShowInfo.tableList[slideShowInfo.previousTableIndex]);
slideShowInfo.tableList[slideShowInfo.currentTableIndex].style.display = '';
objPanel.appendChild(slideShowInfo.tableList[slideShowInfo.currentTableIndex]);
if (slideShowInfo.currentTableIndex !=slideShowInfo.previousTableIndex)
slideShowInfo.tableList[slideShowInfo.previousTableIndex].style.display = 'none';
}
else
{
slideShowInfo.setPanelSize();
}
slideShowInfo.previousTableIndex=slideShowInfo.currentTableIndex;
slideShowInfo.currentTableIndex=slideShowInfo.currentTableIndex+1;
if (slideShowInfo.currentTableIndex>(slideShowInfo.tableList.length-1)) slideShowInfo.currentTableIndex=0;
slideShowInfo.toggleControls(slideShowInfo.previousTableIndex);
if (!slideShowInfo.slideShowStopped)
slideShowInfo.eventVar = setTimeout("noneSlideShow(" + slideShowInfo.name + ")", slideShowInfo.interval);
slideShowInfo.loading=false;
}
function slideShowStart(slideShowInfo, restartString)
{
if (slideShowInfo.slideShowStopped && !slideShowInfo.loading)
{
slideShowInfo.slideShowStopped=false;
document.getElementById(slideShowInfo.playBtnId).src = document.getElementById(slideShowInfo.playBtnId).src.replace('bt_u_','bt_d_');
document.getElementById(slideShowInfo.stopBtnId).src = document.getElementById(slideShowInfo.stopBtnId).src.replace('bt_d_','bt_u_');
slideShowInfo.eventVar=setTimeout(restartString, 500);
}
}
function slideShowStop(slideShowInfo)
{
if (!slideShowInfo.slideShowStopped)
{
slideShowInfo.slideShowStopped=true;
if (slideShowInfo.eventVar)
clearTimeout(slideShowInfo.eventVar);
document.getElementById(slideShowInfo.stopBtnId).src = document.getElementById(slideShowInfo.stopBtnId).src.replace('bt_u_','bt_d_');
document.getElementById(slideShowInfo.playBtnId).src = document.getElementById(slideShowInfo.playBtnId).src.replace('bt_d_','bt_u_');
}
}
function slideShowPrevClick(slideShowInfo, restartString)
{
if (document.getElementById(slideShowInfo.prevBtnId).src.indexOf('bt_u_') > -1 && !slideShowInfo.loading)
{
if (slideShowInfo.eventVar)
clearTimeout(slideShowInfo.eventVar);
slideShowInfo.reverseSlide=true;
slideShowInfo.currentTableIndex-=2;
if (slideShowInfo.currentTableIndex==-1)
{
slideShowInfo.currentTableIndex=slideShowInfo.tableList.length-1;
}
if (slideShowInfo.currentTableIndex==-2)
{
slideShowInfo.currentTableIndex=slideShowInfo.tableList.length-2;
}
var temp=slideShowInfo.slideShowStopped;
slideShowInfo.slideShowStopped=false;
eval(restartString);
slideShowInfo.slideShowStopped=temp;
}
}
function slideShowPrevDown(slideShowInfo)
{
if (document.getElementById(slideShowInfo.prevBtnId).src.indexOf('bt_u_') > -1)
{
slideShowInfo.prevButtonDown=true;
document.getElementById(slideShowInfo.prevBtnId).src = document.getElementById(slideShowInfo.prevBtnId).src.replace('bt_u_','bt_d_');
}
}
function slideShowPrevUp(slideShowInfo)
{
if (slideShowInfo.prevButtonDown)
{
document.getElementById(slideShowInfo.prevBtnId).src = document.getElementById(slideShowInfo.prevBtnId).src.replace('bt_d_','bt_u_');
slideShowInfo.prevButtonDown=false;
}
}
function slideShowNextClick(slideShowInfo, restartString)
{
if (document.getElementById(slideShowInfo.nextBtnId).src.indexOf('bt_u_') > -1 && !slideShowInfo.loading)
{
if (slideShowInfo.eventVar)
clearTimeout(slideShowInfo.eventVar);
var temp=slideShowInfo.slideShowStopped;
slideShowInfo.slideShowStopped=false;
eval(restartString);
slideShowInfo.slideShowStopped=temp;
}
}
function slideShowNextDown(slideShowInfo)
{
if (document.getElementById(slideShowInfo.nextBtnId).src.indexOf('bt_u_') > -1)
{
slideShowInfo.nextButtonDown=true;
document.getElementById(slideShowInfo.nextBtnId).src = document.getElementById(slideShowInfo.nextBtnId).src.replace('bt_u_','bt_d_');
}
}
function slideShowNextUp(slideShowInfo)
{
if (slideShowInfo.nextButtonDown)
{
document.getElementById(slideShowInfo.nextBtnId).src = document.getElementById(slideShowInfo.nextBtnId).src.replace('bt_d_','bt_u_');
slideShowInfo.nextButtonDown=false;
}
}