function onProgress(e)
 {
  porc.innerHTML = TEXTOS['cargando']+' '+Math.round((e.position / e.totalSize)*100)+' %';
 }

function onError(e)
 {
  //alert("Error " + e.target.status + " occurred while receiving the document.");
  alert("Error");
 }

var search = document.location.search ? document.location.search+'&' : '?';

function mostrar_error(codError)
 {
  while(porc.firstChild != null)
	porc.removeChild(porc.firstChild);
  //porc.innerHTML = TEXTOS['reqFlash']+'<br \/><ul><li><a href="http://www.adobe.com/go/getflash" target="_blank">'+TEXTOS['descFlash']+'<\/a><\/li><li><a href="'+document.location.pathname+search+'nav_flash=no">'+TEXTOS['navNoFlash']+'<\/a><\/li><\/ul>';
  porc.appendChild(document.createElement('br'));
  var ul = document.createElement('ul');
  var li = document.createElement('li');
  var a = document.createElement('a');
  a.setAttribute('href', document.location.pathname+search+'nav_flash=no');
  a.appendChild(document.createTextNode(TEXTOS['navNoFlash']));
  porc.appendChild(ul);
  ul.appendChild(li);
  li.appendChild(a);
 }

function cargar(e)
 {
  var fo = new SWFObject(peliculaFlash, "pelicula", "100%", "100%", "8");
  fo.addVariable('v', '&amp;'+variablesFlash);
  //fo.addVariable("seccion", " < ? = $seccion_act ? > ");
  fo.addParam("scale", "exactfit");
  fo.addParam("menu", "false");
  //fo.addParam("wmode", "transparent");
  //var respuesta =
  respuesta = fo.write("flashcontent3");
  if(respuesta == false)
   {
   	porc.innerHTML = TEXTOS['reqFlash']+'<br \/><ul><li><a href="http://www.adobe.com/go/getflash" target="_blank">'+TEXTOS['descFlash']+'<\/a><\/li><li><a href="'+document.location.pathname+search+'nav_flash=no">'+TEXTOS['navNoFlash']+'<\/a><\/li><\/ul>';
   }
 }

var req;
var porc = document.createElement('p');
function cargarXml(url, hand)
 {
  req = false;
  if(window.ActiveXObject)
   {
    try
     { req = new ActiveXObject("Msxml2.XMLHTTP"); }
    catch(e)
     {
      try
       { req = new ActiveXObject("Microsoft.XMLHTTP"); }
      catch(e)
       { req = false; }
	 }
   }
  else if(window.XMLHttpRequest)
   {
	try
	 { req = new XMLHttpRequest(); }
    catch(e)
     { req = false; }
   }
  if(req)
   {
	if(typeof req.onprogress == 'undefined')
	 {
	  porc.appendChild(document.createTextNode(TEXTOS['cargando']+' '+TEXTOS['aguarde']));
	 }
	else
   	 { req.onprogress = onProgress; }

	try
	 { req.onload = hand; }
	catch(e)
	 {
	  req.onreadystatechange = function()
	   {
	 	if(req.readyState == 4)
	 	 {
		  if(req.status == 200)
			hand();
		  //else

	 	 }
	   }
	 }
    //
	//req.onerror = onError;
    req.open("GET", url, true);
    req.send(null);
   }
  else
   { alert(TEXTOS['reqNavegador']); }
  return;
 }

function iniciarCarga()
 {
  porc.className = 'porc';
  var cont = document.getElementById('flashcontent3');
  while(cont.childNodes[1] != null)
	cont.removeChild(cont.childNodes[1]);
  cont.appendChild(porc);
  //cont.style.background = '#C0AD82 url(/img/fondo.jpg) repeat scroll top center';
  if(preloadFlash != false)
   {
	var fo = new SWFObject(preloadFlash, "pelicula", "100%", "100%", "8");
	fo.addParam("scale", "exactfit");
	fo.addParam("menu", "false");
	var respuesta = fo.write("flashcontent3");
	if(respuesta == false)
	 {
	  mostrar_error(1);
	  //var search = document.location.search ? document.location.search+'&' : '?';
	  //porc.innerHTML = TEXTOS['reqFlash']+'<br \/><ul><li><a href="http://www.adobe.com/go/getflash" target="_blank">'+TEXTOS['descFlash']+'<\/a><\/li><li><a href="'+document.location.pathname+search+'nav_flash=no">'+TEXTOS['navNoFlash']+'<\/a><\/li><\/ul>';
	 }
   }
  else
	cargarXml(peliculaFlash, cargar);
  return;
 }
