// JavaScript Document
var delay = 4500;
var fade = 1000;
	
function slider(){
	$('#banner_1').fadeOut(fade, function(){
		$('#thumb_1').addClass('fade');
		$('#banner_2').fadeIn(fade, function(){
			$('#thumb_2').removeClass('fade');
			$('#banner_2').delay(delay).fadeOut(fade, function(){
				$('#thumb_2').addClass('fade');
				$('#banner_3').fadeIn(fade, function(){
					$('#thumb_3').removeClass('fade');
					$('#banner_3').delay(delay).fadeOut(fade, function(){
						$('#thumb_3').addClass('fade');
						$('#banner_4').fadeIn(fade,function(){
							$('#thumb_4').removeClass('fade');
							$('#banner_4').delay(delay).fadeOut(fade,function(){
								$('#thumb_4').addClass('fade');
								$('#banner_5').fadeIn(fade,function(){
									$('#thumb_5').removeClass('fade');
									$('#banner_5').delay(delay).fadeOut(fade,function(){
										$('#thumb_5').addClass('fade');
										$('#banner_6').fadeIn(fade,function(){
											$('#thumb_6').removeClass('fade');
											$('#banner_6').delay(delay).fadeOut(fade,function(){
												$('#thumb_6').addClass('fade');
												$('#banner_7').fadeIn(fade,function(){
													$('#thumb_7').removeClass('fade');
													$('#banner_7').delay(delay).fadeOut(fade,function(){
														$('#thumb_7').addClass('fade');
														$('#banner_8').fadeIn(fade,function(){
															$('#thumb_8').removeClass('fade');
															$('#banner_8').delay(delay).fadeOut(fade,function(){
																$('#thumb_8').addClass('fade');
																$('#banner_9').fadeIn(fade,function(){
																	$('#thumb_9').removeClass('fade');
																	$('#banner_9').delay(delay).fadeOut(fade,function(){
																		$('#thumb_9').addClass('fade');
																		$('#banner_1').fadeIn(fade,function(){
																			$('#thumb_1').removeClass('fade');
																			setTimeout('slider()',delay);
																		});
																	});
																});
															});
														});
													});
												});
											});
										});
									});
								});
							});
						});
					});
				});
			});
		});
	});
}

function resetBanners(){
	$('#banner_1').css('display','none').stop(true);
	$('#banner_2').css('display','none').stop(true);
	$('#banner_3').css('display','none').stop(true);
	$('#banner_4').css('display','none').stop(true);
	$('#banner_5').css('display','none').stop(true);
	$('#banner_6').css('display','none').stop(true);
	$('#banner_7').css('display','none').stop(true);
	$('#banner_8').css('display','none').stop(true);
	$('#banner_9').css('display','none').stop(true);
	
	$('#thumb_1').addClass('fade').stop(true);
	$('#thumb_2').addClass('fade').stop(true);
	$('#thumb_3').addClass('fade').stop(true);
	$('#thumb_4').addClass('fade').stop(true);
	$('#thumb_5').addClass('fade').stop(true);
	$('#thumb_6').addClass('fade').stop(true);
	$('#thumb_7').addClass('fade').stop(true);
	$('#thumb_8').addClass('fade').stop(true);
	$('#thumb_9').addClass('fade').stop(true);
}

$(document).ready(function() {
  $('#thumb_1').bind('click', function(){
	  resetBanners();
	  $(this).removeClass('fade');
	  $('#banner_1').fadeIn(fade);
  });
  $('#thumb_2').bind('click', function(){
	  resetBanners();
	  $(this).removeClass('fade');
	  $('#banner_2').fadeIn(fade);
  });
  $('#thumb_3').bind('click', function(){
	  resetBanners();
	  $(this).removeClass('fade');
	  $('#banner_3').fadeIn(fade);
  });
  $('#thumb_4').bind('click', function(){
	  resetBanners();
	  $(this).removeClass('fade');
	  $('#banner_4').fadeIn(fade);
  });
  $('#thumb_5').bind('click', function(){
	  resetBanners();
	  $(this).removeClass('fade');
	  $('#banner_5').fadeIn(fade);
  });
  $('#thumb_6').bind('click', function(){
	  resetBanners();
	  $(this).removeClass('fade');
	  $('#banner_6').fadeIn(fade);
  });
  $('#thumb_7').bind('click', function(){
	  resetBanners();
	  $(this).removeClass('fade');
	  $('#banner_7').fadeIn(fade);
  });
  $('#thumb_8').bind('click', function(){
	  resetBanners();
	  $(this).removeClass('fade');
	  $('#banner_8').fadeIn(fade);
  });
  $('#thumb_9').bind('click', function(){
	  resetBanners();
	  $(this).removeClass('fade');
	  $('#banner_9').fadeIn(fade);
  });
  setTimeout('slider()',2000);
});
