// JavaScript Document
var currentPosition = 1;
var slideWidth = 866;
var slides = $('.slide');
var numberOfSlides = slides.length;


var t;
var timer_is_on=0;

function doTimer()
{
if (!timer_is_on)
  {
  timer_is_on=1;
  timedCount();
  }
}

function timedCount()
{
	if( currentPosition >= numberOfSlides)
		currentPosition=0;
	
	currentPosition++;
	
	$('#slideInner').animate({'marginLeft' : slideWidth*(-currentPosition+1)}, 500, "swing");
	

//document.getElementById('txt').value=c;
//c=c+1;
t=setTimeout("timedCount()",5500);
}

function stopCount()
{
clearTimeout(t);
timer_is_on=0;
}



$(document).ready(function(){

	// Remove scrollbar in JS
	$('#slideshowContainer').css('overflow', 'hidden');
  
	// Wrap all .slides with #slideInner div
	slides
	.wrapAll('<div id="slideInner"></div>')
	// Float left to display horizontally, readjust .slides width
	.css({
	  'float' : 'left',
	  'width' : slideWidth
	});
  
	// Set #slideInner width equal to total width of all slides
	$('#slideInner').css('width', slideWidth * numberOfSlides);
	
	
	$('#slideInner').mouseover( function() { 
		$('#slideInner').stop();
		stopCount();
	 });
	 
	$('#slideInner').mouseout( function() { doTimer(); });	
	
	doTimer();
	//autoSlide();
	
	});


