// this script creates an array where image locations are stored, 
// calculate the directory where the image should be pulled, 
// and rotate the images Written by XHL (xluong@certifiedvacations.com)

var slideShowSpeed    = 6000;
var crossFadeDuration = 5;
var current_image = 0;
var number_of_images = 4;
if (action_image_count && action_image_count > 0) number_of_images = action_image_count;

var preLoad = [];
for (i = 0; i < number_of_images; i++) {
	preLoad[i] = new Image();
	preLoad[i].src = 'images/'+ image_path + '/' + i +'.jpg';
	//alert('/images/'+ image_path + '/' + i +'.jpg');
}

function runSlideShow() {
	if (document.all) {
		$('SlideShow').style.filter="blendTrans(duration=2)";
		$('SlideShow').style.filter="blendTrans(duration=crossFadeDuration)";
		$('SlideShow').filters.blendTrans.Apply();
	}
	
	$('SlideShow').src = preLoad[current_image].src;
	if (document.all) document.images.SlideShow.filters.blendTrans.Play();
	
	current_image = current_image + 1;
	if (current_image > (number_of_images - 1)) current_image = 0;	
}

// setInterval calls the specified function repeatedly 
// no need for recursion in runSlideShow
function on_page_load() {
	window.setInterval(runSlideShow, slideShowSpeed);
}

function popup(url, top, left, width, height)
{
    window.open(url, '', 'top=' + top + ', left=' + left + ', width=' + width + ', height=' + height);
}


