﻿/*
* _o : original
* _t : thumbnail
* _f : focusimage
*
*
*/
var timer = new Array();

$(document).ready(function() {
	
	if ($("div.slideshow").length) {
		
		$("div.slideshow").each(function() {
			$("div.slide:first", $(this)).show();
			timer[$(this).attr('id')] = setTimeout("showNextImage('" + $(this).attr('id') + "');", 5000);
			var slider = $(this);
			$("div.menu div", slider).click(function() {
				clearTimeout(timer[slider.attr("id")]);
				$("div.slide:visible", slider).fadeOut(500);
				$("div.slide:eq(" + $("div.menu div", slider).index(this) + ")", slider).fadeIn(500);
				timer[slider.attr("id")] = setTimeout("showNextImage('" + slider.attr('id') + "')", 5000);
			});
		});
	}
});

function showNextImage(slideshowId) {
	
	$("div.slide:visible", $("div.slideshow#" + slideshowId)).fadeOut(500);
	
	if ($("div.slide:visible", $("div.slideshow#" + slideshowId)).next("div.slide").length) {
		$("div.slide:visible", $("div.slideshow#" + slideshowId)).next().fadeIn(500);
	} else {
		$("div.slide:first", $("div.slideshow#" + slideshowId)).fadeIn(500);
	}
	timer[slideshowId] = setTimeout("showNextImage('" + slideshowId + "');", 5000);
}

/*
var timer = new Array();
$(document).ready(function () {


    // Fill/Clear inputs
    if ($(".ClearTextBox").length) {
        $(".ClearTextBox").focus(function () {
            if (this.value == this.defaultValue)
                this.value = '';
            if (this.value != this.defaultValue)
                this.select();
        });
        $(".ClearTextBox").blur(function () {
            if ($.trim(this.value) == '')
                this.value = (this.defaultValue ? this.defaultValue : '');
        });
    };

	if ($("div.slideshow").length) {
		$("div.slideshow").each(function() {
			$("div.slide:first", $(this)).show();
			timer[$(this).attr('id')] = setTimeout("showNextImage('" + $(this).attr('id') + "');", 10000);
			var slider = $(this);
			$("div#Info div", slider).click(function() {
				clearTimeout(timer[slider.attr("id")]);
				$("div.slide:visible", slider).fadeOut(500);
				$("div.slide:eq(" + $("div#Info div", slider).index(this) + ")", slider).fadeIn(500);
				timer[slider.attr("id")] = setTimeout("showNextImage('" + slider.attr('id') + "')", 10000);
			});
		});
	}

});

function showNextImage(slideshowId) {
	$("div.slide:visible", $("div.slideshow#" + slideshowId)).fadeOut(500);
	
	if ($("div.slide:visible", $("div.slideshow#" + slideshowId)).next("div.slide").length) {
		$("div.slide:visible", $("div.slideshow#" + slideshowId)).next().fadeIn(500);
	} else {
		$("div.slide:first", $("div.slideshow#" + slideshowId)).fadeIn(500);
	}
	timer[slideshowId] = setTimeout("showNextImage('" + slideshowId + "');", 10000);
}*/
