/**
 *  Ozhan Binici - http://www.ozhanbinici.com - http://www.katalist.com.tr
 *
 *	Basic Slideshow App
 *	
 */
var w = 910;
var wait = 5000;
var cimage = 0;
var nimages;

function moveToNext()
{
  	new Effect.Move('imageBoxInside', {x: -w, y: 0, transition: Effect.Transitions.sinoidal, afterFinish: function(){swapImages()}});
}

function swapImages(){
	var pimage = document.getElementById("image" + cimage);
	var brTag = document.getElementById("imageWrapper");
	var parent = pimage.parentNode;
	parent.removeChild(pimage);
	parent.appendChild(pimage);
	parent.removeChild(brTag);
	parent.appendChild(brTag);
	cimage ++;
	if (cimage >= nimages){
		cimage = 0;
	}
	parent.style.left = 0;
}
// the onload event handler that starts the transitions.
function startSlideShow(nimages) {
	window.nimages = nimages;
	play = setInterval('moveToNext()',wait);
}
