function ssImage(imagepath, linkpath, title, caption) {
	this.imagepath = imagepath;
	this.linkpath = linkpath;
	this.title = title;
	this.caption = caption;
}

addLoadEvent( function() {
	if (document.getElementById("ssImage") ) {
		document.getElementById("ssImage").onclick = switchSlideShow;
		document.getElementById("ssDiv").getElementsByTagName("div")[0].style.display = "block";
	
		// Loop through the array and create the DOM objects for the slideshow, appending each to the container div "ssDiv" that is in the markup
		for (i=1; i<ssArray.length; i++) {
			var div1 = document.createElement("div");
			var leftTextNode = document.createTextNode("< ");
			var rightTextNode = document.createTextNode(" >");
			var rightTextNodeBtm = document.createTextNode(" >");
	
			var photo = document.createElement("img");
			var photoA = document.createElement("a");
	
			var navContent = document.createElement("div");
			var navContentLeft = document.createElement("p");
			var navContentLeftA = document.createElement("a");
			var navContentCenter = document.createElement("p");
			var navContentRight = document.createElement("p");
			var navContentRightA = document.createElement("a");
	
			var capDiv = document.createElement("div");
			var capH4 = document.createElement("h4");
			var capH4A = document.createElement("a");
			var capText = document.createElement("div");
	
			var bottomMsg = document.createElement("p");
			var bottomMsgA = document.createElement("a");
	
			//gather image data
			photoA.setAttribute("href",ssArray[i].linkpath);
			photo.setAttribute("src",ssArray[i].imagepath);
			photo.setAttribute("border","0");
	
			//paste image together
			photoA.appendChild(photo);
	
			//gather navigation data
			navContent.setAttribute("id","ssFoot");
			navContentLeft.setAttribute("id","ssFootLeft");
			navContentLeft.appendChild(leftTextNode);
			navContentLeftA.innerHTML = buttonBack;
			navContentLeftA.setAttribute("href","javascript: switchSlideShow(-1);");
			navContentCenter.setAttribute("id","ssFootCenter");
			navContentCenter.innerHTML = (i+1) + " of " + ssArray.length;
			navContentRight.setAttribute("id","ssFootRight");
			navContentRightA.innerHTML = buttonNext;
			navContentRightA.setAttribute("href","javascript: switchSlideShow(1);");
			navContentRight.appendChild(navContentRightA);
			navContentRight.appendChild(rightTextNode);
	
			//paste navigation together
			navContentLeft.appendChild(navContentLeftA);
	
			navContent.appendChild(navContentLeft);
			navContent.appendChild(navContentCenter);
			navContent.appendChild(navContentRight);
	
			//gather caption data
			capDiv.setAttribute("class","caption");
			capH4A.innerHTML = ssArray[i].title;
			capH4A.setAttribute("href",ssArray[i].linkpath);
			capText.innerHTML = ssArray[i].caption;
	
			//paste caption together
			capH4.appendChild(capH4A);
			capDiv.appendChild(capH4);
			capDiv.appendChild(capText);
	
			//gather bottomMsg data
			bottomMsg.setAttribute("id","bottomMsg");
			bottomMsgA.setAttribute("href",jsBottomLink);
			bottomMsgA.innerHTML = jsBottomMsg;
	
			//paste bottomMsg data
			bottomMsg.appendChild(bottomMsgA);
			bottomMsg.appendChild(rightTextNodeBtm);
	
			//gather main div data
			div1.appendChild(photoA);
			div1.appendChild(navContent);
			div1.appendChild(capDiv);
			div1.appendChild(bottomMsg);
	
			//set main div to not display
			div1.style.display = "none";
	
			//paste main div data to parent
			document.getElementById("ssDiv").appendChild(div1);
		}
	
		switchSlideShow();
	}
} );

	// Function to actually change the slideshow
	// Starts with the slideshow container ssDiv and finds all its 'div' children, before identifying only the direct children of ssDiv and adding them to a seperate array
	// Then works out which of the ssDiv children is currently displayed, before turning on the next child and switching off the current child
	function switchSlideShow(ssMove) {
		var ssOn; // placeholder for reference to current div
		var ssNext = 1; // placeholder for next div (not always current + 1 - we have to loop)
		var ssChildDivs = new Array(); // placeholder for array of child divs (the individual image containers created in the initialization block above plus any in the original markup)
		var ssNavFoot = document.getElementById("ssFoot");
		var ssNavFootCenter = document.getElementById("ssFootCenter");
		var ssNavFooterCenterDis;

		// Get the child divs of ssDiv
		var ssDivs = document.getElementById("ssDiv").getElementsByTagName("div");

		// Put the direct children in the ssChildDivs array
		for(i=0; i<ssDivs.length; i++)  {
			if (ssDivs[i].parentNode.id == "ssDiv") ssChildDivs.push(ssDivs[i]);
		}

		// Find the currently displayed div and set ssOn and ssNext
		for(i=0; i<ssChildDivs.length; i++) {
			if (ssChildDivs[i].style.display == "block" && ssMove != null) {
				ssOn = i;
				if ((ssOn+ssMove) == ssChildDivs.length) {ssNext=0;}
				else if(ssMove < 0) {
					if (ssOn+ssMove < 0){ssNext=ssChildDivs.length-1;}
					else {ssNext=ssOn-1;}
				}
				else if(ssMove > 0) {ssNext=ssOn+1}
				else {ssNext=ssOn-1;}

			}
		}
		if(ssMove != null) {ssNavFooterCenterDis = ssNext+1;}
		else{ssNavFooterCenterDis = ssNext;}
		ssNavFootCenter.innerHTML = ssNavFooterCenterDis + " of " + ssArray.length;

		if(ssChildDivs.length > 1){ ssNavFoot.style.display = "block"; }

		//Omniture tracking for offer views
		//if (ssMove != null){
			//var pageNameSOIdx = s_pageName.indexOf(":SO");
			//var s_prop2SOIdx = s_prop2.indexOf(":SO");
			//var s_prop6SOIdx = s_prop6.indexOf(":SO");

			//s_pageName = (pageNameSOIdx != -1) ? s_pageName.substring(0,pageNameSOIdx) : s_pageName;
			//s_prop2 = (s_prop2SOIdx != -1) ? s_prop2.substring(0,s_prop2SOIdx) : s_prop2;
			//s_prop6 = (s_prop2SOIdx != -1) ? s_prop6.substring(0,s_prop6SOIdx) : s_prop6;

			//redefine the page-level tracking with tagging of offer placement
			//s_pageName = s_pageName + ":SO " + ssNavFooterCenterDis;
			//s_prop2 = s_prop2 + ":SO " + ssNavFooterCenterDis
			//s_prop6 = s_prop6 + ":SO " + ssNavFooterCenterDis

			//fire off omniture function to track new page view, passing in omniture account information
			//s_gs(omniture_account_info);
		//}

		// Turn on the next div and turn off the current div - slideshow is updated!
		if (ssMove != null){
			ssChildDivs[ssNext].style.display = "block";
			ssChildDivs[ssOn].style.display = "none";
		}
	}

