function home() {

flag=0;

document.getElementById('box-inner').style.height  = document.getElementById('box-text').offsetHeight - 60 + 'px';
document.getElementById('plashka').style.width  = document.getElementById('box-text').offsetWidth + 'px';


j = 0;
num = 1;

satellite_go = setInterval(function() {


	var satellite_y_coord = (1-Math.sin((j+100)*2*3.14159/2400))*296-5;	
	var satellite_x_coord = (1-Math.cos((j+100)*2*3.14159/2400))*296-10;

	var satellite_y_coord_r = Math.round(satellite_y_coord);	
	var satellite_x_coord_r = Math.round(satellite_x_coord);

	
	document.getElementById("point").style.left = satellite_x_coord_r + 'px';
	document.getElementById("point").style.top = satellite_y_coord_r + 'px';

	if (satellite_y_coord_r > satellite_y_coord) {vert = 'bottom';} else {vert = 'top';}
	if (satellite_x_coord_r > satellite_x_coord) {horiz = 'left';} else {horiz = 'right';}

	document.getElementById("point").style.backgroundPosition = horiz + ' ' + vert;

	if ((j/100) >= num) {

		num = Math.round(j/100)+1;
		//alert(num);
		earth_to(num);
	}

	if (play==1) j++;
	if (j > 2400) {j = 1; num = 1;}


}, 50);



}

function earth_to(next) {

if (flag==0) {

flag=1;
document.getElementById("earth_front").style.background = "url(img/earth/" + next + ".jpg)";


	j = (next-1)*100;
	num = Math.round(j/100)+1;
	
//	var y_coord = (1-Math.sin((j+100)*2*3.14159/2400))*296-6;	
//	var x_coord = (1-Math.cos((j+100)*2*3.14159/2400))*296-10;
	
//	document.getElementById("point").style.left = x_coord + 'px';
//	document.getElementById("point").style.top = y_coord + 'px';

var from = 0; // Начальная координата X
var to = 1; // Конечная координата X
var duration = 800; // Длительность - 1 секунда
var start = new Date().getTime(); // Время старта
 
	setTimeout(function fade() {
		var now = (new Date().getTime()) - start; // Текущее время
    	var progress = now / duration; // Прогресс анимации
 
    	var result = (to - from) * progress + from;

    	document.getElementById("earth_front").style.opacity = result; 
    	document.getElementById("earth_front").style.filter='alpha(opacity='+result*100+')';
  
    	if (progress < 1) { // Если анимация не закончилась, продолжаем
        		setTimeout(arguments.callee, 100);
			} else { // Если всё, кладём новый кадр фоном
				document.getElementById("earth_back").style.background = "url(img/earth/" + next + ".jpg)";
    				document.getElementById("earth_front").style.opacity = 0; 
    				document.getElementById("earth_front").style.filter='alpha(opacity=0)'; 
				document.getElementById("point").style.display='block';
				i=next;
				flag=0;	
			}
	}, 100);
}
}
