rolltime = 10000;
	step = 600;
	tm = 1000; 
   all = -1*step;
   qty = 0;
	n = 0;
	current = 1;

$(document).ready(function() {


   $('#top-bg img').each(function (){ 
		all = all + step;
		qty = qty + 1;
		$(this).css('top',all);
//		if (qty == current)
//			$('#circles').html($('#circles').html() + '<img src="i/circle-blue.png">')
//		else
//			$('#circles').html($('#circles').html() + '<img src="i/circle-grey.png">');
   });
   $('.white-space-content').each(function (){ 
		n = n + 1;
		$(this).attr('id','white-'+n);

   });
	auto = true;

//	$("#arrows-bg-right").click(function()
	$("#down-index").click(function()
	{
		man = true;
		auto = false;
//uncomment
		next();
      return false;

	});
//	$("#arrows-bg-left").click(function()
	$("#up-index").click(function()
	{
		man = true;
		auto = false;
//uncomment
		prev();
	
      return false;

	});


//   $('#arrows-bg-right').mouseover(function (e){ 
//uncomment
//      $("#next-slide, #circles").show(); 
//   });
//   $('#arrows-bg-right').mouseout(function (e){ 
//      $("#next-slide, #circles").hide(); 
//   });
//   $('#arrows-bg-right').mousemove(function (e){ 
//		move = true;
//		m_x = e.pageX-20;
//		m_y = e.pageY-25;
//		$("#next-slide").offset({ top: m_y, left: m_x });
//		$("#circles").offset({ top: m_y+20, left: m_x+30 });

//   });
//   $('#arrows-bg-left').mouseover(function (e){ 
//uncomment
//      $("#prev-slide, #circles").show(); 
//   });
//   $('#arrows-bg-left').mouseout(function (e){ 
//      $("#prev-slide, #circles").hide(); 
//   });
//   $('#arrows-bg-left').mousemove(function (e){ 
//		move = true;
//		m_x = e.pageX-30;
//		m_y = e.pageY-25;
//		$("#prev-slide").offset({ top: m_y, left: m_x });
//		$("#circles").offset({ top: m_y+20, left: m_x+50 });

//   });



})
	function prev()
	{
      if (($('#top-bg img:animated').length == 0)&&(auto||man))
		{
		      man = false;
				$('#top-bg img').each(function (){
					if (parseInt($(this).css('top')) == all)
						$(this).css('top',-1*step );
					$(this).animate({top: '+='+step }, tm);
				});
			$('#circles').html('');
			old = current;
			current = current - 1;
			if (current == 0)
				current = qty;
			for (i=1;i<=qty;i++)
				if (i == current)
					$('#circles').html($('#circles').html() + '<img src="i/circle-blue.png">')
				else
					$('#circles').html($('#circles').html() + '<img src="i/circle-grey.png">');
			$('#white-'+old).fadeOut(300, function() {
					$('#white-'+current).fadeIn();
		      });
	
		};

	};
	function next()
	{
      if (($('#top-bg img:animated').length == 0)&&(auto||man))
		{
		      man = false;
			$('#top-bg img').each(function (){
				$(this).animate({top: '-='+step }, tm,  
			     function (){
					if (parseInt($(this).css('top')) == -1*step)	{
						$(this).css('top',all);
					};
				});

			});
			$('#circles').html('');
			old = current;
			current = current + 1;
			if (current == qty + 1)
				current = 1;
			for (i=1;i<=qty;i++)
				if (i == current)
					$('#circles').html($('#circles').html() + '<img src="i/circle-blue.png">')
				else
					$('#circles').html($('#circles').html() + '<img src="i/circle-grey.png">');
			$('#white-'+old).fadeOut(300, function() {
					$('#white-'+current).fadeIn();
		      });

		};
		if (auto) setTimeout("next()",rolltime);
	};


//uncomment
   setTimeout('next()',rolltime);

