var pro = false;
var primerAnguloCamara = false;

function CambiaPro()
{
	pro = true;
}

function Camera(arrayMovie)
{
	var camera = ge.getView().copyAsCamera(ge.ALTITUDE_RELATIVE_TO_GROUND); 
	camera.set(arrayMovie[0],arrayMovie[1],arrayMovie[2],ge.ALTITUDE_RELATIVE_TO_GROUND,arrayMovie[3],arrayMovie[4],arrayMovie[5]);
	ge.getView().setAbstractView(camera);
}
function LookAt(arrayMovie)
{
	var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND); 
	lookAt.set(arrayMovie[0],arrayMovie[1],arrayMovie[2],ge.ALTITUDE_RELATIVE_TO_GROUND,arrayMovie[3],arrayMovie[4],arrayMovie[5]);
	ge.getView().setAbstractView(lookAt);
}
function ParamMovie(arrayMovie)
{
//si [0]==4
//	1-  0-nada  #0 valor de la velocidad
//	2-  0-nada  #0 valor de la escala
//	3-  0-nada  #0 valor del flyto
//  4-	0-nada  #0 valor de la size del Label
//  5-	valor del tipo vista 1-popa, 2-proa
//  6-	targetbarco = mmsi;o avion
//  7-  angulo de camara;
//	8-  distanciaCamara
//  9-  1 mueve;

	if(arrayMovie[5] != 6)
	{
		if((arrayMovie[2] != 0)&&(escalaGeneral != arrayMovie[2]))
		{
			SizeModelo(arrayMovie[2]);
		}
		if(arrayMovie[3] != 0) ge.getOptions().setFlyToSpeed(arrayMovie[3]);
		if(arrayMovie[4] != 0)
		{ 
			SizeLabelPeloto(arrayMovie[4]);
			document.getElementById("cursoresge").SizeLabel(arrayMovie[4]);
		}
		if(arrayMovie.length > 5)
		{
			tipoVista = arrayMovie[5];
			if((opcionesYLook[10] == 0)||(opcionesYLook[10] == 2))
			{
				targetBarco = arrayMovie[6];
				mmsiSelected = arrayMovie[6];
//				alert(targetBarco+"  "+opcionesYLook[10])
			}
			else if(opcionesYLook[10] == 1)
			{
				if(arrayMovie[6] == 0) targetAvion = "";
				else targetAvion = arrayMovie[6];
			}
			else alert(opcionesYLook[10])
			
			primerAnguloCamara = true;
		}
		if(arrayMovie.length >= 8)
		{
			primerAnguloCamara = false;
			anguloCamara = arrayMovie[7];
			if(arrayMovie[9] == 1) VistaSeguir(targetBarco,anguloCamara,arrayMovie[8]);
		}
		PasarControles(arrayMovie)
	}
}

function MakeMovie()
{
	var auxstr = "";
  	var camera = ge.getView().copyAsCamera(ge.ALTITUDE_RELATIVE_TO_GROUND);
	auxstr += camera.getLatitude().toFixed(5);
	auxstr += ","+camera.getLongitude().toFixed(5);
	auxstr += ","+camera.getAltitude().toFixed(2);
	auxstr += ","+camera.getHeading().toFixed(2);
	auxstr += ","+camera.getTilt().toFixed(2);
	auxstr += ","+camera.getRoll().toFixed(2);
	auxstr += ","+escalaGeneral;

	var auxstr2 = tipoVista+","+targetBarco;
	var auxstr3 = sizeLabelGeneral.toString();
 	document.getElementById(paramSWF).MakeMovie(auxstr,auxstr2,auxstr3);
}

function PlaceBalloon(tipoIndex,objIndex,strHTML)
{
	if(tipoIndex == 0)
	{
		ge.setBalloon(null);
	}
	else if(tipoIndex == 1)
	{
		if(marcasPlacemark[objIndex] != null)
		{
			var balloon = ge.createHtmlStringBalloon('');
			balloon.setFeature(marcasPlacemark[0]);
			balloon.setMaxWidth(350);
			balloon.setContentString(strHTML);
			ge.setBalloon(balloon);
			mmsiSelected = 0;
		}
	}
	else if(tipoIndex == 2)
	{
		if(pShipPlacemark[objIndex] != null)
		{
			var balloon = ge.createHtmlStringBalloon('');
			balloon.setFeature(pShipPlacemark[objIndex]);
			balloon.setMaxWidth(350);
			balloon.setContentString(strHTML);
			ge.setBalloon(balloon);
			targetBarco = objIndex;			//mueve las vistas cuando se mueve el barco
			mmsiSelected = 0;				//mueve el ballon cuando se mueve el barco
		}
	}
	else if(tipoIndex == 3)
	{
		if(pShipPlacemark[objIndex] != null)
		{
			var balloon = ge.createHtmlStringBalloon('');
			balloon.setFeature(pShipPlacemark[objIndex]);
			balloon.setMaxWidth(350);
			balloon.setContentString(" ");
			ge.setBalloon(balloon);
			targetBarco = objIndex;
			mmsiSelected = objIndex;
		}
	}
}
