function slideshow(){
		
	if (document.getElementById('slideshow')){	

		var slideshow = document.getElementById('slideshow');
		var imgs = slideshow.getElementsByTagName('img');
		slideshow.className = 'loaded';
		imgs[0].className = 'current'; //show first image
		imgs[1].className = 'next'
	
		var current = 0; //current image
		var next;	    //next image
		
		setInterval(function(){
			next = current+1;
			if (next == imgs.length) next = 0; //if current image is last, set next to first image
			
			if (!/ current /.test(' '+imgs[current].className+' ')) imgs[current].className = 'current'; //set current image css
			if (!/ next /.test(' '+imgs[next].className+' ')) imgs[next].className = 'next';            //set next image css
		
			var _opacity = 1;
			var fadeOut = setInterval(function(){
			
				_opacity -= 0.05;
			
				if (_opacity > 0.5){
					imgs[current].style.opacity = _opacity;
					imgs[current].style.MsFilter = '"progid:DXImageTransform.Microsoft.Alpha(Opacity=' + (_opacity*100) + ')"';
					imgs[current].style.filter = 'alpha(opacity=' + (_opacity*100) + ')';	
			
				} else if (_opacity <= 0.5 && _opacity > 0.05){ //double fade speed at opacity midpoint
					_opacity -= 0.05;
					imgs[current].style.opacity = _opacity;
					imgs[current].style.MsFilter = '"progid:DXImageTransform.Microsoft.Alpha(Opacity=' + (_opacity*100) + ')"';
					imgs[current].style.filter = 'alpha(opacity=' + (_opacity*100) + ')';
			
				} else {
					clearInterval(fadeOut);
				
					imgs[current].className = ''; //reset formerly-current image
					imgs[current].style.MsFilter = '';
					imgs[current].style.filter = '';
					imgs[current].style.opacity = '';
					imgs[next].className = 'current'; //next image is now current
				
					current++
					if (current == imgs.length) current = 0; //if end of image array, start back from beginning
				} 
			},100)	
		},6000); // 6 second loop per image
	}
}

function addEvent(obj,evt,fn){
	if (obj.addEventListener){
		obj.addEventListener(evt,fn,false);
	} else if (obj.attachEvent){
		obj.attachEvent('on'+evt,fn);
	}
}

addEvent(window,'load',slideshow);