function toggle( targetId ){
  if (document.getElementById){
        target = document.getElementById( targetId );
           if (target.style.display == "none"){
              target.style.display = "block";
           } else {
              target.style.display = "none";
           }
     }
}

var actualWidth=0;
var actualHeight=0;
var startWidth=0;
var startHeight=0;
var abajo=0;
var ratio=1.1;

function zoom(inout){
	var obj=document.getElementById('juegoswf');
	var obja=document.getElementById('zoom');
	if(actualWidth==0||actualHeight==0){
		actualWidth=obj.width.replace(/px/i,'');
		actualHeight=obj.height.replace(/px/i,'');
		startWidth=actualWidth;
		startHeight=actualHeight;
	}
	if(actualWidth>850 && inout==1 || actualWidth<300 && inout==-1) {
		alert("Llegaste al tope del ZOOM.");
		return;
	}
	switch(inout){
	case 1:
		var temp=actualWidth;
		abajo=Math.ceil(abajo*abajo);
		actualWidth=Math.ceil(ratio*actualWidth);
		actualHeight=Math.ceil((actualHeight*actualWidth)/temp);
		break;
	case-1:
		var temp=actualWidth;
		abajo=Math.ceil(abajo/ratio);
		actualWidth=Math.ceil(actualWidth/ratio);
		actualHeight=Math.ceil((actualHeight*actualWidth)/temp);
		break;
	}
	obj.width=actualWidth+'px';
	obj.height=actualHeight+'px';
}

function getFlashMovieObject(movieName){
  if (window.document[movieName]) 
  {
    return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function preloadJuego(){
	var flashMovie=getFlashMovieObject("juegoswf");
	if (flashMovie.PercentLoaded() == 100)
	{
		document.getElementById("Game").style.visibility = 'visible';
		document.getElementById("cargaJuego").style.display = 'none';
	}
	else
	{
		progBar(3*flashMovie.PercentLoaded());
	}
}

function progBar(i){
   if (i<=(300))
   {
	  if (i>40)
	  {
	  	document.getElementById("porcentaje").innerHTML=parseInt(i/3)+"%";
	  }
      document.getElementById("barra").style.width=i+"px";
   }
}