/*
JavasScript - Slide Show
Written by: Aaron E.
*/

//Locate those div's
function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

//Hide or show those div's
function shL(divname, v) {
  	if ((obj=findObj(divname))!=null) {
    	if (obj.style) {
			obj=obj.style;
			v=(v=='show')?'block':(v='hide')?'none':v;
		}
		obj.display=v;
	}
}

//Hide all those div's
function closeAll() {
	shL('ssSlide0','hide');
	shL('ssSlide1','hide');
	shL('ssSlide2','hide');
	shL('ssSlide3','hide');
	shL('ssSlide4','hide');
	shL('ssSlide5','hide');
}

/* ------------- The next & previous button functions ------------- */

/* Stores the slideIndex in a span tag */
var ssCurrSlideIndex = 0;

function setssIndex(x) {
	ssCurrSlideIndex = x;
}

function ssNext() {
	if (ssCurrSlideIndex < 5) {
		ssCurrSlideIndex = ssCurrSlideIndex + 1
		if (ssCurrSlideIndex > 6)
		{
			ssCurrSlideIndex = 0;
		}
		closeAll();
		shL('ssSlide' + ssCurrSlideIndex, 'show');
	}
	return false;	// so # HREFs not followed
}

function ssPrev() {
	if (ssCurrSlideIndex > 0) {
		ssCurrSlideIndex = ssCurrSlideIndex - 1;
		closeAll();
		shL('ssSlide' + ssCurrSlideIndex, 'show');
	}
	return false;	// so links not followed
}
