// JavaScript Document
var clicked
var x = 0;
var w = $('.slide').width();
var n = $('.slide').length;
var holder = n * w
$('#slideholder').css({'width': holder+'px'});

function swapImages(){
x=x+1;
if(x>n-1)
{
	x=0;
}
var pos = 0-x*w
$('#slideholder').animate({
					   'left': pos+'px' }, 600);
fadenumber(x)
};

	
$(document).ready(function(){
	fadenumber(0)
	$('#pause').animate({'opacity': 0 },200)
	$('#slideover').delay(500).fadeIn(200);
     Int = setInterval('swapImages()', 4000);
});


function next(){
clearInterval(Int);
x=x+1;

if(x>n-1)
{
	x=0;
}
var pos = 0-x*w
$('#slideholder').animate({
					   'left': pos+'px' }, 600);
fadenumber(x)


};

function prev(){
	clearInterval(Int);
x=x-1;
if(x<0)
{
	x=n-1;
}
var pos = 0-x*w
$('#slideholder').animate({
					   'left': pos+'px' }, 600);
fadenumber(x)


 };


function gotoslide(s){
	clearInterval(Int);
x = s-1
var pos = 0-x*w
$('#slideholder').animate({
					   'left': pos+'px' }, 600);
fadenumber(x)


};
 
 
 
function fadenumber(active){
i=0;
active=active+1
while(i < n+1){
$('#n'+i).animate({'opacity': .2 },100);
i++;
 }
 $('#n'+active).animate({'opacity': 1 },100)
  };
  
var opac=1
$(".control").live('mouseenter', (function()
{
	opac = $(this).css('opacity');
	$(this).animate({'opacity': .6 },200)

}
));



$(".control").live('mouseleave', (function()
{

	$(this).animate({'opacity': opac },200)

}
));


$("#slideshow").live('mouseenter', (function()
{
	$('#pause').animate({'opacity': 1 },200)

clearInterval(Int);
}
));



$("#slideshow").live('mouseleave', (function()
{
	clearInterval(Int);
	$('#pause').animate({'opacity': 0 },200)


Int = setInterval('swapImages()', 4000);

}
));



