
CSlideShow = function(obj)
{
	this.id = 0;
	this.Slide = obj;
	this.paused = false;
	this.timer = null;
	this.Init = function()
	{

	}


	this.changeSlide = function()
	{
		var current = $('.visible',this.Slide);
		var next = $('.visible',this.Slide).next();


		if(  $('.slide',this.Slide).index(current)==$('.slide',this.Slide).length-1 )
		{
			next =  $('.slide:first',this.Slide);
		}

		if(!this.paused)
		{
			// effect 1
			current.fadeOut(500,function(){ $(this).removeClass('visible'); next.fadeIn(600,function(){ $(this).addClass('visible') }); });

		}

	}


	this.Start = function(){

		this.changeSlide();
		this.timer = window.setInterval('slideShowArray['+this.id+'].changeSlide()',4500);
		//this.paused = false;
	}

	this.Stop = function(){

		clearTimeout(this.timer);
		//this.paused = true;
	}

	this.Pause = function(){

		this.paused = true;
	}

	this.Resume = function(){

		this.paused = false;
	}
}


var slideShowArray = new Array();




$(document).ready(function(){

	$('.slideshow').each(function(){

			var t= new CSlideShow(this);
			t.id = slideShowArray.length;
			slideShowArray[t.id]=t;
			$(this).attr('id',t.id);
	});

	})


	function InputReceiveFocus(obj, defaultStr) {
		if (obj.value == defaultStr) {
			obj.value = "";
		}
	}


	function InputLouseFocus(obj, defaultStr) {
		if (obj.value == "") {
			obj.value = defaultStr;
		}
	}


