
/* GALLERY */
var imgs_baseURL = "";
var images = [];
var img_index = 0;

function galleryNexImage() {
	if(++img_index >= images.length) {
		img_index = 0;
	}

	$('<img />')
    .attr('src', imgs_baseURL + images[img_index])
    .load(function(){
		var container = $('#gimage');
		var new_img = this
        container.animate({opacity: 0.1}, 'slow', 'linear', function() {
			container.html( $(new_img) ).animate({opacity: 1})
		});
    });

	return true;
}
function galleryPreviousImage() {
	if(img_index <= 0) {
		return false;
	} else {
		img_index--;
	}

	$('<img />')
    .attr('src', imgs_baseURL + images[img_index])
    .load(function(){
		var container = $('#gimage');
		var new_img = this
        container.animate({opacity: 0.1}, 'slow', 'linear', function() {
			container.html( $(new_img) ).animate({opacity: 1})
		});
    });

	return true;
}

function gellery_init(gimgs_baseURL, gimages, index) {
	imgs_baseURL = gimgs_baseURL + "/";
	images = gimages;
	img_index = index;
}

function sneak_peek_start_slideshow() {
	setInterval('galleryNexImage()', 5000);
}
/* END GALLERY */
