var photos = new Array();
// ************************* Photo Notes ************************************
// "picture.jpg (image here)|Clean Your Cube (Alt Test Here)|/index.cfm (Link to the what ever page)";
//photos[5] = "/images/ss-business-center.jpg|The Business Center is Your Link to the Law|http://business.ftc.gov/";
//photos[4] = "/images/ss-bcp-disaster.jpg|Disaster Preparedness|/opa/2011/08/irene.shtm";
//photos[0] = "/images/ss-opa-preciousmetals3.jpg|Advertising, Marketing, or Purchasing Precious Metals: What Consumers and Businesses Need to Know|/bcp/menus/consumer/invest/schemes.shtm";
// ************************************************************************************

photos[0] = "/images/ss-bcp-windows.jpg|Replacing Your Windows?|/opa/2012/02/windows.shtm";
photos[1] = "/images/ss-bcp-fake-debt.jpg|Who's Calling? That Debt Collector Could Be Fake. Click to learn more.|/opa/2012/02/acc.shtm";
photos[2] = "/images/ss-bcp-mobileappskids.jpg|Mobile Apps for Kids: Current Privacy Disclosures are Disappointing. Click here to read the report.|/os/2012/02/120216mobile_apps_kids.pdf";
photos[3] = "/images/ss-regulatoryreview.jpg|Federal Trade Commission Regulatory Review|/ftc/regreview/index.shtml";
photos[4] = "/images/ss-opa-history.jpg|The History of FTC|/opa/history/";
photos[5] = "/images/ss-bc-competitioncounts.jpg|How Consumers Win When Businesses Compete|/bc/edu/pubs/consumer/general/zgen01.pdf";

var photoPos = new Array();
// ************************* Photo Position Notes ************************************
// photoPos[0] = 20; (Add 100 with each new photo)
// ************************************************************************************
photoPos[0] = 20;
photoPos[1] = 120;
photoPos[2] = 220;
photoPos[3] = 320;
photoPos[4] = 420;
photoPos[5] = 520;

// The base link should be set relative to the page the slideshow appears on.
var BASELINK = "/slideshow/";
// There should be no need to alter anything below this line.
// Original Normal: TIMER = 6000; Longer: TIMER = 6000 (for normal) 3600000 (to slow down)
var TIMER = 6000, FADESPEED = 100, position = 0, GtimerId;
var timeOutFlag;
var normalBK="#999999", currentBK="#a6824b";
var slideRunning=1;
function initSlideShow() {
setOpacity(document.getElementById("topImage"), 1.0);
document.getElementById("topImage").style.zIndex = 51;
var img = new Image();
img.onload = setPhoto;
if (photos[position].indexOf("|") != -1) {
img.alt = photos[position].split("|")[1];
img.src = BASELINK + photos[position].split("|")[0];
}
else { img.src = BASELINK + photos[position]; }
createNavigation();
setBkColor(position+1);
}
function createNavigation(){
var obj = document.getElementById("slideshowNav");
if(obj != null){
for(i=1;i<(photos.length+1);++i){
var img = document.createElement("a");
img.setAttribute("href","javascript:jumpPhoto("+(i-1)+")");
img.setAttribute("id","pic"+i);
var txt =document.createTextNode(""+i);
var blk =document.createTextNode(" ");
img.appendChild(txt);
obj.appendChild(img);
obj.appendChild(blk);
}
}
}
function setPhoto() {
var obj = document.getElementById("topImage");
if(obj != null) document.getElementById("slideshow").removeChild(obj);
var img = document.createElement("img");
img.setAttribute("src",this.src);
img.setAttribute("id","topImage");
img.setAttribute("height",this.height);
img.setAttribute("width",this.width);
img.setAttribute("border","0");
setOpacity(img, 1.0);
document.getElementById("slideshow").appendChild(img);
if (this.alt) {
img.setAttribute("alt",this.alt);
}
else { img.setAttribute("alt","Federal Trade Commission Slide Show image"); }
document.getElementById("topImage").style.zIndex = 51;
if(slideRunning == 1){
loadPhoto();
}
}
function loadPhoto() {
if (position == (photos.length - 1)) { position = 0; }
else { position++; }
var img = new Image();
img.onload = loadUnder;
if (photos[position].indexOf("|") != -1) {
img.alt = photos[position].split("|")[1];
img.src = BASELINK + photos[position].split("|")[0];
}
else { img.src = BASELINK + photos[position]; }
slideRunning=1;
}
function loadUnder() {
var img = document.createElement("img");
img.setAttribute("src",this.src);
img.setAttribute("id","bottomImage");
img.setAttribute("height",this.height);
img.setAttribute("width",this.width);
img.setAttribute("border","0");
setOpacity(img, 1.0);
document.getElementById("slideshow").appendChild(img);
if (this.alt) {
//addPhotoText(this.alt);
img.setAttribute("alt",this.alt);
}
else { img.setAttribute("alt","Federal Trade Commission Slide Show image"); }
timeOutFlag=setTimeout("initFade()",TIMER);
}
function addPhotoText(text) {
var div = document.createElement("div");
div.setAttribute("id","bottomTextOverlay");
setOpacity(div, 0.8);
var span = document.createElement("span");
span.appendChild(document.createTextNode(text));
div.appendChild(span);
document.getElementById("slideshow").appendChild(div);
}
function initFade() {
GtimerId = setInterval("fadeOut()",FADESPEED);
document.getElementById("topImage").style.zIndex = 51;
if (document.getElementById("topTextOverlay") != null)
document.getElementById("slideshow").removeChild(document.getElementById("topTextOverlay"));
if (document.getElementById("bottomTextOverlay") != null)
document.getElementById("bottomTextOverlay").setAttribute("id","topTextOverlay");
}
function fadeOut() {
var obj = document.getElementById("topImage");
if (obj.style.opacity < 0.1) {
clearInterval(GtimerId);
document.getElementById("slideshow").removeChild(obj);
document.getElementById("bottomImage").setAttribute("id","topImage");
setBkColor(position+1);
loadPhoto();
}
else { setOpacity(obj, (obj.style.opacity - 0.1)); }
}
function setOpacity(obj, opacity) {
obj.style.opacity = opacity;
obj.style.MozOpacity = opacity;
obj.style.KhtmlOpacity = opacity;
obj.style.filter = "alpha(opacity=" + (opacity * 100) + ")";
}
function jumpPhoto(noPic) {
position=noPic;
if (position == photos.length) { position = 0; }
var img = new Image();
img.onload = loadJump;
if (photos[position].indexOf("|") != -1) {
img.alt = photos[position].split("|")[1];
img.src = BASELINK + photos[position].split("|")[0];
}
else { img.src = BASELINK + photos[position]; }
slideRunning=0;
}
function loadJump() {
var obj = document.getElementById("bottomImage");
if(obj != null) document.getElementById("slideshow").removeChild(obj);
var img = document.createElement("img");
img.setAttribute("src",this.src);
img.setAttribute("id","bottomImage");
img.setAttribute("height",this.height);
img.setAttribute("width",this.width);
img.setAttribute("border","0");
setOpacity(img, 1.0);
document.getElementById("slideshow").appendChild(img);
if (this.alt) {
img.setAttribute("alt",this.alt);
}
else { img.setAttribute("alt","Federal Trade Commission Slide Show image"); }
//var obj1 = document.getElementById("topImage");
//document.getElementById("slideshow").removeChild(obj1);
//document.getElementById("bottomImage").setAttribute("id","topImage");
setBkColor(position+1);
clearTimeout(timeOutFlag);
clearInterval(GtimerId);
GtimerId = setInterval("jumpFadeOut()",FADESPEED/3);
document.getElementById("topImage").style.zIndex = 51;
}
function jumpFadeOut() {
var obj = document.getElementById("topImage");
if (obj.style.opacity < 0.1) {
clearInterval(GtimerId);
document.getElementById("slideshow").removeChild(obj);
document.getElementById("bottomImage").setAttribute("id","topImage");
}
else { setOpacity(obj, (obj.style.opacity - 0.1)); }
}
//The script for the rotating links starts here.
function slidelink(){
var current=position;
if(slideRunning == 1){
var current=(position!=0?position-1:(photos.length - 1));
}
window.location=photos[current].split("|")[2];
}
function showNavigation(){
//var current=(position!=0?position-1:(photos.length - 1));
//var obj = document.getElementById("slideshowNav");
//obj.style.zIndex=55;
//obj.style.top=photoPos[current];
}
function hideNavigation(){
//var obj = document.getElementById("slideshowNav");
//obj.style.zIndex=0;
//obj.style.
}
function setBkColor(item){
try{
for(i=1;i<(photos.length+1);++i){
document.getElementById("pic"+i).style.backgroundColor=normalBK;
}
}catch(err){
}
try{
document.getElementById("pic"+item).style.backgroundColor=currentBK;
}catch(err){
}
}
// window.onload = setTimeout("initSlideShow()",1000);

