function SlideShow() {
	this.trans_width = '140px';
	this.trans_height = '225px';
	this.pause = 3000;
	this.degree = 1000; // spped of animation. Greater is faster.
	this.slideshowcontent = new Array();
}

SlideShow.prototype.GetHtmlBlock = SlideShowBlock;

function SlideShowBlock() {
	if (slideshowcontent.length == 0) return "";
	if (ie4||dom) {
		return '<div style="position:relative;width:'+trans_width+';height:'+trans_height+';overflow:hidden;"><div><table width="100%"><tr><td align="left"><a href="javascript:ss_ChangeSlide(-1)"><img src="images/icons/pr_img.png" border=0></a></td><td align=center class=hs_attributevalue>Photo slideshow</td><td align="right"><a href="javascript:ss_ChangeSlide(1)"><img src="images/icons/nx_img.png" border=0></a></td></tr></table></div><div id="canvas0" style="text-align:center;position:absolute;background-color:'+bgcolor+';width:'+trans_width+';height:'+trans_height+';left:-'+trans_width+';filter:alpha(opacity=20);-moz-opacity:0.2;"></div><div id="canvas1" style="text-align:center;position:absolute;background-color:'+bgcolor+';width:'+trans_width+';height:'+trans_height+';left:-'+trans_width+';filter:alpha(opacity=20);-moz-opacity:0.2;"></div></div>';
	} else if (document.layers){
		return '<ilayer id=tickernsmain visibility=hide width='+trans_width+' height='+trans_height+' bgColor='+bgcolor+'><layer id=tickernssub width='+trans_width+' height='+trans_height+' left=0 top=0>'+'<img src="'+slideshowcontent[0][0]+'"></layer></ilayer>';
	}
}


var stopit = false;

//var incr = 1;

// call this function with :
// 0 - show current (curindex value)
// 1 - show next 
// -1 - show previous from slideshowcontent array
function ss_ChangeSlide(incr) {
	if ( slideshowcontent.length == 0) return;
	curindex += incr;
	curindex=(curindex<slideshowcontent.length)? curindex : 0
	curindex=(curindex<0)? slideshowcontent.length-1 : curindex
	rotateslide()
}


/***********************************************
* Translucent Slideshow script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var trans_width='300px' //slideshow width
var trans_height='280px' //slideshow height
var pause=3000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)
var degree=50 //animation speed. Greater is faster.

var slideshowcontent=new Array()
/* Greg */

var bgcolor='#FFFFFF'

function SetSlideArray(arr, bgc) {
	slideshowcontent = arr;
	bgcolor = bgc ? bgc : 'white'
}

////NO need to edit beyond here/////////////



var imageholder=new Array()
for (i=0;i<slideshowcontent.length;i++){
	imageholder[i]=new Image()
	imageholder[i].src=slideshowcontent[i][0]
}

var ie4=document.all
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1

var curpos=trans_width*(-1)
var curcanvas="canvas0"
var curindex=0

function getslidehtml_old(theslide){
	var slidehtml=""
	if (theslide[1]!="")
		slidehtml='<a href="'+theslide[1]+'" target="'+theslide[2]+'">'
	slidehtml+='<img src="'+theslide[0]+'" border="0">'
	if (theslide[1]!="")
		slidehtml+='</a>'
	return slidehtml
}

function getslidehtml(theslide){
	var slidehtml=""
	slidehtml+='<img src="'+theslide+'" style="display:block;margin:auto;" border="0">'
	return slidehtml
}

function moveslide(){
	if (curpos<0){
		curpos=Math.min(curpos+degree,0)
		crossobj.style.left=curpos+"px"
	}
	else{
		clearInterval(dropslide)
		oldcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
		tempobj=ie4? eval("document.all."+oldcanvas) : document.getElementById(oldcanvas)
		if (crossobj.filters) {
			crossobj.filters.alpha.opacity=100
			tempobj.filters.alpha.opacity = 0
		} else if (crossobj.style.MozOpacity) {
			crossobj.style.MozOpacity=1
			tempobj.style.MozOpacity = 0
		}
	}
}

function rotateslide(){
	
	if (ie4||dom){
		curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
		resetit(curcanvas)
		tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
		tempobj.innerHTML=getslidehtml(slideshowcontent[curindex])
		crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
		crossobj.style.zIndex++
		if (crossobj.filters)
			document.all.canvas0.filters.alpha.opacity=document.all.canvas1.filters.alpha.opacity=20
		else if (crossobj.style.MozOpacity)
			document.getElementById("canvas0").style.MozOpacity=document.getElementById("canvas1").style.MozOpacity=0.2
		var temp='setInterval("moveslide()",50)'
		dropslide=eval(temp)
		
	}
	else if (document.layers){
		crossobj.document.write(getslidehtml(slideshowcontent[curindex]))
		crossobj.document.close()
		
	}
/* uncomment for auto slide show, auto slide need some more work 
	curindex=(curindex<slideshowcontent.length-1)? curindex++ : 0
	setInterval("rotateslide()",pause) // Greg
*/
}


/*
function jumptoslide(which){
	curindex=which
	rotateslide()
}
*/
function resetit(what){
	curpos=parseInt(trans_width)*(-1)
	var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
	crossobj.style.left=curpos+"px"
}

// for auto slide
function startit(){
	crossobj=ie4? eval("document.all."+curcanvas) : dom? document.getElementById(curcanvas) : document.tickernsmain.document.tickernssub
	if (ie4||dom){
		rotateslide()
	}
	else{
		document.tickernsmain.visibility='show'
		curindex++
	}
}

/*
if (window.addEventListener)
	window.addEventListener("load", startit, false)
else if (window.attachEvent)
	window.attachEvent("onload", startit)
else if (ie4||dom||document.layers)
	window.onload=startit
	
*/
