

function Slideshow_Builder__Object(sThisObjectName, oRenderIn)
{
	this.sThisObjectName = sThisObjectName;
	this.oRenderIn = oRenderIn;
	this.iRandom = Math.floor(Math.random()*1111);
	
	
	this.aItems = new Array();
	
	this.oGalleryHolder = null;
	this.oSlideShowGallery = null;
	
	this.sHolderHeight = '200px';
	this.sHolderWidth = '200px';
	
	this.oInitTimer = null;
	
	this.__construct();
}


Slideshow_Builder__Object.prototype.__construct = function()
{

	//this.Add_Scripts();
	
	//window.addEvent('domready',  alert(this.sThisObjectName + ".Render_Slideshow_Init();"));
	
}

Slideshow_Builder__Object.prototype.Add_Scripts = function()
{
	
	
}


Slideshow_Builder__Object.prototype.Add_Image = function(oImageElement)
{
	this.aItems[this.aItems.length] = oImageElement;
}



Slideshow_Builder__Object.prototype.Render = function()
{
	this.oGalleryHolder = document.createElement('div');
	this.oGalleryHolder.style.display = 'none';
	this.oGalleryHolder.id = "GallerySlideShowHolder_" + this.iRandom;
	this.oGalleryHolder.style.height = this.sHolderHeight;
	this.oGalleryHolder.style.width = this.sHolderWidth;
	
	
	var iCount = this.aItems.length;
	for (var x = 0; x < iCount; x++)
	{
		this.aItems[x].Render(this.oGalleryHolder);
	}
	
	
	while (this.oRenderIn.firstChild) { // nuke all items currently in select to rebuild clean
		this.oRenderIn.removeChild(this.oRenderIn.firstChild);
     }
	
	//this.Add_Scripts();
	
	this.oRenderIn.appendChild(this.oGalleryHolder);

	this.Delay_Slideshow_Init();
	
}


Slideshow_Builder__Object.prototype.Delay_Slideshow_Init = function()
{
	this.oInitTimer = setTimeout(this.sThisObjectName + ".Render_Slideshow_Init();",1000);
}

Slideshow_Builder__Object.prototype.Render_Slideshow_Init = function()
{
	
	this.oSlideShowGallery = new gallery($("GallerySlideShowHolder_" + this.iRandom), {
		timed: true,
		linkWindow: "",
		target: "",
		showArrows: false,
		showInfopane: false,
		showCarousel: false,
		embedLinks: true,
		delay: 4000
	});

	
	this.oGalleryHolder.display = '';
}


function Slideshow_Builder_Image_Element_Object(oParent)
{
	this.oParent = oParent;
	
	this.sSmallImageURL = '';
	this.sLargeImageURL = '';
	this.sLink = '#';
	this.sName = 'name';
	this.sDescription = 'desc';
	
	this.oElementHolder = null;
}



Slideshow_Builder_Image_Element_Object.prototype.Set_Small_Image_URL = function(sURL)
{
	this.sSmallImageURL = sURL;
}

Slideshow_Builder_Image_Element_Object.prototype.Set_Big_Image_URL = function(sURL)
{
	this.sLargeImageURL = sURL;
}

Slideshow_Builder_Image_Element_Object.prototype.Set_Image_Link_URL = function(sURL)
{
	this.sLink = sURL;
}


Slideshow_Builder_Image_Element_Object.prototype.Render = function(oRenderIn)
{
	
	this.oElementHolder = document.createElement('div');
		this.oElementHolder.className = 'imageElement';
		

		var oName = document.createElement('h2');
			oName.innerHTML = this.sName;
		this.oElementHolder.appendChild(oName);
		
		var oDesc = document.createElement('p');
			oDesc.innerHTML = this.sDescription;
		this.oElementHolder.appendChild(oDesc);

		
		var oLink = document.createElement('a');
			oLink.href = this.sLink;
			oLink.className = 'open';
		this.oElementHolder.appendChild(oLink);
		
		var oBig = document.createElement('img');
			oBig.src = this.sLargeImageURL;
			oBig.className = 'full';
		this.oElementHolder.appendChild(oBig);
		
		
		var oSmall = document.createElement('img');
			oSmall.src = this.sSmallImageURL;
			oSmall.className = 'thumbnail';
		this.oElementHolder.appendChild(oSmall);
	
	//<div class="imageElement"><a href="#" title="open image" class="open"></a><img src="http://media.masspublisher.com/customers/337/flash/97.jpg" class="full" /><img src="http://media.masspublisher.com/customers/337/flash/97.jpg" class="thumbnail" /></div>
	
	oRenderIn.appendChild(this.oElementHolder);
	
}






