$(function() {
	var $test1 = $('#test1'),
		$test2 = $('#test2'),
		$test3 = $('#test3'),
		$test4 = $('#test4'),
		$caption = $('div.caption'),
		$pause = $('#pause'),
		$resume = $('#resume'),
		$freeze = $('#freeze'),
		$stop = $('#stop'),
		$restart = $('#restart'),
		STOP = 1, RUN = 2, PAUSE = 3;


	$test3.crossSlide({
		fade: 1
	}, [
			{
			src:  'http://www.kessaris.gr/images/index-slideshow/kessaris_intro_01.jpg',
			//alt:  'shop1',
			from: 'top left',
			to:   'bottom left',
			time: 3
		}, {
			src:  'http://www.kessaris.gr/images/index-slideshow/kessaris_intro_02.jpg',
			//alt:  'shop2',
			from: 'top left',
			to:   'top right',
			time: 4
		}, {
			src:  'http://www.kessaris.gr/images/index-slideshow/kessaris_intro_03.jpg',
			//alt:  'shop3',
			from: 'top left',
			to:   'bottom left',
			time: 3
		}, {
			src:  'http://www.kessaris.gr/images/index-slideshow/kessaris_intro_04.jpg',
			//alt:  'shop4',
			from: 'top left',
			to:   'top right',
			time: 4
		}
	], function(idx, img, idxOut, imgOut) {
		if (idxOut == undefined) {
			$caption.text(img.alt).animate({ opacity: .7 })
		} else {
			$caption.animate({ opacity: 0 })
		}
	});
	$caption.show().css({ opacity: 0 })

	function state(state) {
		$pause.attr('disabled', state != RUN);
		$resume.attr('disabled', state != PAUSE);
		$freeze.attr('disabled', state == STOP);
		$stop.attr('disabled', state == STOP);
	}
	state(RUN);

	//$pause.click(function() {
//		$test3.crossSlidePause();
//		state(PAUSE);
//	});
//
//	$resume.click(function() {
//		$test3.crossSlideResume();
//		state(RUN);
//	})
//
//	$freeze.click(function() {
//		$test3.crossSlideFreeze();
//		state(STOP);
//	});
//
//	$stop.click(function() {
//		$test3.crossSlideStop();
//		$caption.css({ opacity: 0 })
//		state(STOP);
//	});
//
//	$restart.click(function() {
//		$test3.crossSlideRestart();
//		state(RUN);
//	});
//
//	$test4.crossSlide({
//		fade: 1,
//		variant: true,
//		easing: 'easeInOutQuad'
//	}, [
//		{
//			src:  'ind_img04.jpg',
//			from: '100% 80% 1x',
//			to:   '100% 0% 1.5x',
//			time: 4
//		}, {
//			src:  'ind_img05.jpg',
//			from: 'top left',
//			to:   'bottom right 1.5x',
//			time: 4
//		}, {
//			src:  'flip-flops.jpeg',
//			from: '100% 80% 1.5x',
//			to:   '80% 0%',
//			time: 4
//		}, {
//			src:  'rubber-ring.jpeg',
//			from: '100% 50%',
//			to:   '30% 50% 1.5x',
//			time: 4
//		}
//	]);
});

