var slideshow={
	ids:new Array(),
	services:new Array(),
	curFrame:0,
	interval:false,
	pause:5000,
	duration:.75,
	gotoFrame:function(frame_id){
		curId = slideshow.ids[slideshow.curFrame];
		nextId = slideshow.ids[frame_id];
		if(curId != nextId){
			Effect.Fade(curId,{duration:0.25});
			slideshow.curFrame = frame_id;
		}
		if(document.getElementById(nextId).style.display=='none'){
			Effect.Appear(nextId,{duration:0.25});
		}
	},
	gotoService:function(service_id){
		matches = new Array();
		for(i=0;i<slideshow.services.length;i++){
			if(slideshow.services[i]==service_id){
				matches[matches.length] = i;
			}
		}
		if(matches.length>0){
			var rand_no = Math.floor((matches.length-1)*Math.random());
			slideshow.gotoFrame(matches[rand_no]);
			slideshow.stop();
			slideshow.interval=false;
		}
	},
	go:function(){
		if(slideshow.interval==false){
			slideshow.interval = setInterval("slideshow.next();",slideshow.pause);
		}
	},
	stop:function(){
		clearInterval(slideshow.interval);
	},
	next:function(){
		curId = slideshow.ids[slideshow.curFrame];
		Effect.Fade(curId,{duration:slideshow.duration});
		if((slideshow.curFrame+1)==slideshow.ids.length){
			slideshow.curFrame=0;
		}else{
			slideshow.curFrame++;	
		}
		nextId = slideshow.ids[slideshow.curFrame];
		Effect.Appear(nextId,{duration:slideshow.duration});
	}
};