// JavaScript Document
window.addEvent('domready', function() { 
									 
	$('previous').fade(0);
	


	
 });

	function change_sphere(n){
		for (s=1;s<=3;s++){
			var el = $('sphere' + s).style.visibility;
			if (el == 'visible'){
				$('sphere' + s).fade(0);
				
			}
			$('N' + s).src = 'images/' + s + '_nor.png';
		}
		$('sphere' + n).fade(1);
		$('N' + n).src = 'images/' + n + '_over.png';
		check_button(n);
	}
	
	function forwardes(){
		for (s=1;s<=3;s++){
			var el = $('sphere' + s).style.visibility;
			if (el == 'visible'){
				var pr_item = s;	
			}
		}
	
		pr_item ++;
		if ((pr_item>0)&&(pr_item<4)){
			for (s=1;s<=3;s++){
				var el = $('sphere' + s).style.visibility;
				if (el == 'visible'){
					$('sphere' + s).fade(0);
					
				}
				$('N' + s).src = 'images/' + s + '_nor.png';
			}
			check_button(pr_item);
			$('N' + pr_item).src = 'images/' + pr_item + '_over.png';
			$('sphere' + pr_item).fade(1);
			
								
			
		}
	}
	
	function backward(){
		for (s=1;s<=3;s++){
			var el = $('sphere' + s).style.visibility;
			if (el == 'visible'){
				var pr_item = s;	
			}
		}	
		pr_item = pr_item-1;
			
			if ((pr_item>0)&&(pr_item<4)){
			for (s=1;s<=3;s++){
				var el = $('sphere' + s).style.visibility;
				if (el == 'visible'){
					$('sphere' + s).fade(0);
				
				}
				$('N' + s).src = 'images/' + s + '_nor.png';
			}
			
			check_button(pr_item);
			$('sphere' + pr_item).fade(1);
			$('N' + pr_item).src = 'images/' + pr_item + '_over.png';			
			
		}
	}
	
	function check_button(s){
		var p = $('previous').style.visibility;
		var n = $('next').style.visibility;
		if (s == 1){
			if (p !='hidden'){
				$('previous').fade(0);
			}	
		}
		if (s > 1){
			if (p !='visible'){
			$('previous').fade(1);
			}
		}
		if (s == 3){
			if (n !='hidden'){
				$('next').fade(0);
			}
		}
		if (s<3){
			if (n !='visible'){
				$('next').fade(1);
			}
		}
		
	}
	
	
	

