var context=0;
var eltexto="En información llegamos más lejos . . .";

function siguiente() { document.location.href="menugral.html"; }

function ponTexto1() {
	aponer=eltexto.substr(0,context+1)+"_";
	document.getElementById("texto1").innerHTML=aponer+"\n";
	setTimeout('ponTexto2()',50);
}

function ponTexto2() {
	aponer=eltexto.substr(0,context+1);
	document.getElementById("texto1").innerHTML=aponer+"\n";
	context++;
	if(context<eltexto.length) setTimeout('ponTexto1()',50);else setTimeout('siguiente()',3000);
}

var escala=75;
var contador=1;

function parabola(x,y,obj,xDistance,yDistance,xDirection,yDirection,xinc,speed){
	this.obj=document.getElementById(obj);
	this.obj.style.left=x+"px";
	this.obj.style.top=y+"px";
	this.xDistance=xDistance;
	this.yDistance=yDistance;
	this.xDirection=xDirection;
	this.yDirection=yDirection;
	this.xinc=xinc;
	this.speed=speed;
	this.active=0;
	this.i=0;
	this.multiplier=this.yDistance/Math.pow(this.xDistance/2,2);
	this.startX=parseInt(this.obj.style.left);
	this.startY=parseInt(this.obj.style.top);
	this.x=this.startX;
	this.y=this.startY;
	this.xdec=25;
	this.ydec=50;
	this.move=moveParabola;
}

function zoomin(){
	ancho=(244/escala)*contador;
	alto=(85/escala)*contador;
	document.getElementById("logo").width=ancho;
	document.getElementById("logo").height=alto;
	contador++;
}

function moveParabola(){
	this.i+=this.xDirection*this.xinc;
	this.x=this.startX+this.i;
	this.obj.style.left=this.x+"px";
	this.y=this.startY-this.yDirection*this.multiplier*Math.pow(this.xDistance/2-Math.abs(this.i),2)+this.yDirection*this.yDistance;
	this.obj.style.top=this.y+"px";
	zoomin();
}

function bounce1(){
	if(ball.active){
		if(Math.abs(ball.i)<ball.xDistance){
			ball.move();
			setTimeout("bounce1()",ball.speed);
		} else ponTexto1();
	}
}

function init(){
	ball=new parabola(120,70,"balldiv",210,370,1,1,3,50);
	ball.active=1; bounce1();
}
