/*********************************************************************
	Title: Image SlideShow and Moving Pointer with Click Facility
	Author URL: www.iindev.com
	Date:02-05-2009
	Important Note: This is a commercial software and not for free use.
	This content cannot be modified, redistributed or sell without the 
	Permission of www.iindev.com
*********************************************************************/

var effect_duration = speed * 1000;
var effect_rotation_interval = wait * 1000;

function show(whichOne){
	var which_img = $('which_img')
	
	if(whichOne == which_img.value){ return false;}
	var vDiv = "div"+whichOne;
	var tDiv = "div"+which_img.value
	which_img.value = whichOne;
	var image2fed = $(vDiv);
	var img2fedFx = new Fx.Style(image2fed, 'opacity', {
			wait: false,
			duration: effect_duration + 200,
			transition: Fx.Transitions.Quart.easeInOut
		});

	img2fedFx.start(0, 1);
	image2fed.style.zIndex = '98';
	
	
	var image2vanish = $(tDiv);
	var img2vanishFx = new Fx.Style(image2vanish, 'opacity', {
			wait: false,
			duration: effect_duration + 200,
			transition: Fx.Transitions.Quart.easeInOut
		});
	
	img2vanishFx.start(1, 0);
	image2vanish.style.zIndex='97';
}

function move_down(top_end, image2show, auto_move){
	var target = $('target');
	var box = $('box');
	var fx = new Fx.Styles(target, {duration: effect_duration, wait: true});
	
	var transition = 'Cubic';
	var ease = 'easeIn';
	fx.options.transition = Fx.Transitions[transition][ease];
	transition = 'Fx.Transitions.' + transition + '.' + ease;

if(auto_move != 1){
		fx.start({
			'top': top_end,
			'left': 152
		});
		
		show(image2show);
		
		clearInterval(effect_rotation);
		effect_rotation = setInterval('move_down(0, 0, 1)', effect_rotation_interval);
	}
	else{
		var which_img = $('which_img');
		
		if(which_img.value == 1){
			fx.start({
				'top': 48,
				'left': 152
			});
			show(2);
			which_img.value = 2;
		}
		else if(which_img.value == 2){
			fx.start({
				'top': 95,
				'left': 152
			});
			show(3);
			which_img.value = 3;
		}
		else if(which_img.value == 3){
			fx.start({
				'top': 142,
				'left': 152
			});
			show(4);
			which_img.value = 4;
		}
		else if(which_img.value == 4){
			fx.start({
				'top': 189,
				'left': 152
			});
			show(5);
			which_img.value = 5;
		}
		else if(which_img.value == 5){
			fx.start({
				'top': 1,
				'left': 152
			});
			show(1);
			which_img.value = 1;
		}
	}
}

window.addEvent('domready', function(){
	effect_rotation = setInterval('move_down(0, 0, 1)', effect_rotation_interval);
});
