var tIndex = 0;//used when adding elements to the array
var slideshowInterval = 10;
var cb = 0;//currentbanner
var NUM_BANNER_LOCATIONS = 0;
var bannerArray = new Array();
var snippetArray = new Array();
function Banner(theImage, theDescription, theLinkText, theURL, theLinkTarget, theLinkLocation, thePopup, thePopupHeight, thePopupWidth, theBannerLocation){
//the banner object
this.image = theImage;
this.description = theDescription;
this.linktext = theLinkText;
//theURL == "" ? this.url = "#" : this.url = theURL;
this.url = theURL;
theLinkTarget == "Current Window" ? this.linktarget = "_self" : this.linktarget = "_blank";
this.linklocation = theLinkLocation;
this.popup = thePopup;
this.popupHeight = thePopupHeight;
this.popupWidth = thePopupWidth;
this.bannerlocation = theBannerLocation;
this.bannerSnippet = "";
}
function addElement(theImage, theDescription, theLinkText, theURL, theLinkTarget, theLinkLocation, thePopup, thePopupHeight, thePopupWidth, theBannerLocation){
//this function takes bannerArray and makes the current subscript (tIndex) a banner object with the given parameters
bannerArray[tIndex] = new Banner(theImage, theDescription, theLinkText, theURL, theLinkTarget, theLinkLocation, thePopup, thePopupHeight, thePopupWidth, theBannerLocation);
//build the bannerSnippet
if(bannerArray[tIndex].popup =="1")//build the snippet to open in a popup window
{
if(bannerArray[tIndex].linklocation == "image")//if the link location is an image...
{
if(bannerArray[tIndex].description == "")//if the description is missing
bannerArray[tIndex].bannerSnippet = '' + bannerArray[tIndex].image + '';
else//assume there is a description
bannerArray[tIndex].bannerSnippet = '' + bannerArray[tIndex].image + '
' + bannerArray[tIndex].description;
}
if(bannerArray[tIndex].linklocation == "description")//if the link location is the description
{
if(bannerArray[tIndex].image == "")//if there is no image
bannerArray[tIndex].bannerSnippet = bannerArray[tIndex].description + ' ';
else//assume there is an image
bannerArray[tIndex].bannerSnippet = bannerArray[tIndex].image + '
' + bannerArray[tIndex].description + ' ';
if (bannerArray[tIndex].linktext == "")//if there is no link text
bannerArray[tIndex].bannerSnippet += 'Click here for more';
else//assume there is link text
bannerArray[tIndex].bannerSnippet += bannerArray[tIndex].linktext + '';
}
}
else//build snippet to open in a regular window
{
var urlLink;
if(bannerArray[tIndex].linklocation == "image")//if the link location is an image...
{
if(bannerArray[tIndex].description == ""){//if the description is missing
//don't generate a link tag if no url is provided
bannerArray[tIndex].url == "" ? urlLink = "" : urlLink = '';
bannerArray[tIndex].bannerSnippet = urlLink + bannerArray[tIndex].image;
urlLink != "" ? bannerArray[tIndex].bannerSnippet += '':null;//if there is a link, close the tag
}
else{//assume there is a description
//don't generate a link tag if no url is provided
bannerArray[tIndex].url == "" ? urlLink = "" : urlLink = '';
bannerArray[tIndex].bannerSnippet = urlLink + bannerArray[tIndex].image;
urlLink != "" ? bannerArray[tIndex].bannerSnippet += '':null;//if there is a link, close the tag
bannerArray[tIndex].bannerSnippet += '
' + bannerArray[tIndex].description;
}
}
if(bannerArray[tIndex].linklocation == "description")//if the link location is the description
{
if(bannerArray[tIndex].image == "")//if there is no image
bannerArray[tIndex].bannerSnippet = bannerArray[tIndex].description + ' ';
else//assume there is an image
bannerArray[tIndex].bannerSnippet = bannerArray[tIndex].image + '
' + bannerArray[tIndex].description + ' ';
if (bannerArray[tIndex].linktext == "")//if there is no link text
bannerArray[tIndex].bannerSnippet += 'Click here for more';
else//assume there is link text
bannerArray[tIndex].bannerSnippet += bannerArray[tIndex].linktext + '';
}
}
//document.write('