var IE = /*@cc_on!@*/false;	
var interval = 5000;
var imageDir;


function anadirImagenes(carpeta,n)
{
	for(i=1;i<=n;i++)
	{
		imageArray[imageNum++]=carpeta+(i<100 ? (i<10 ? "00" :"0") : "")+i.toString()+".jpg";
	}
}

function CargarImagenes() {
	BorrarArray(imageArray);
	imageNum=0;
	anadirImagenes("fotos/aislamientos/",10);
	anadirImagenes("fotos/aislamientos/ignifugaciones/",9);
	anadirImagenes("fotos/cubiertas/",51);
	anadirImagenes("fotos/cubiertas/tectum/",41);
	anadirImagenes("fotos/pladur/",112);
	anadirImagenes("fotos/techos/",85);
	anadirImagenes("fotos/infin/",20);
	anadirImagenes("fotos/infin/eh/",13);
	imageNum=0;
	totalImages = imageArray.length;
}

function CargarImagenesPladur() {
	BorrarArray(imageArray);
	imageNum=0;
	anadirImagenes("fotos/pladur/",112);
	imageNum=0;
	totalImages = imageArray.length;
}

function CargarImagenesTechos() {
	BorrarArray(imageArray);
	imageNum=0;
	anadirImagenes("../../fotos/techos/",85);
	imageNum=0;
	totalImages = imageArray.length;
}

function CargarImagenesCubiertas() {
	BorrarArray(imageArray);
	imageNum=0;
	anadirImagenes("fotos/cubiertas/",51);
	imageNum=0;
	totalImages = imageArray.length;
}

function CargarImagenesTectum() {
	BorrarArray(imageArray);
	imageNum=0;
	anadirImagenes("fotos/cubiertas/tectum/",41);
	imageNum=0;
	totalImages = imageArray.length;
}

function CargarImagenesAislamientos() {
	BorrarArray(imageArray);
	imageNum=0;
	anadirImagenes("fotos/aislamientos/",10);
	imageNum=0;
	totalImages = imageArray.length;
}

function CargarImagenesIgnifugados() {
	BorrarArray(imageArray);
	imageNum=0;
	anadirImagenes("fotos/aislamientos/ignifugaciones/",9);
	imageNum=0;
	totalImages = imageArray.length;
}

function CargarImagenesInstalaciones() {
	BorrarArray(imageArray);
	imageNum=0;
	anadirImagenes("fotos/infin/",20);
	imageNum=0;
	totalImages = imageArray.length;
}

function CargarImagenesEH() {
	BorrarArray(imageArray);
	imageNum=0;
	anadirImagenes("fotos/infin/eh/",13);
	imageNum=0;
	totalImages = imageArray.length;
}


/* DESVANECER y EMERGER*/

function desvanecerEntrada()
{
if ( typeof Transp == 'undefined' )
{
Transp=100;
	
}
Transp2=100-Transp;	
//  if (navigator.appName.indexOf("Microsoft")!= -1)
  if(IE)
  {
	document.getElementById('inicio').style.filter="alpha(opacity="+Transp.toString()+")";
	document.getElementById('todo').style.filter="alpha(opacity="+Transp2.toString()+")";
  }
  else
  {
    document.getElementById('inicio').style.opacity=Transp/100;
	document.getElementById('todo').style.opacity=Transp2/100;
  }
  if(Transp>0)
  {
    T= --Transp>90 ? 300 : Transp>80 ? 150 : Transp>60 ? 75 : 20 ;
	var recur_call = "desvanecerEntrada()";
    timerID = setTimeout(recur_call, T);
  }
  else document.location="infin.htm";
}

function escalarimagen()
{
	var W=document.getElementById("imagen").style.width;
	W = W=="464px" ? "776px" : "464px";
	document.getElementById("imagen").style.width= W;
/*	document.write(document.getElementById("imagen").style.width);
*/	
}

function popuppdf(archivo)
{
//  document.getElementById("pdf").data = archivo+"#navpanes=1&amp;toolbar=1";
  document.getElementById("pdfcontainer").innerHTML = "<object id='pdf' type='application/pdf' data='"+archivo+"#navpanes=1;toolbar=1'></object>"; 
  document.getElementById("opaquediv").style.display="block";
  document.getElementById("popupdiv").style.display="block";
//  "<object style='position:absolute; top:20px; left:0px; height:100%; width:100%' type='application/pdf' data='"+archivo+"#navpanes=0&amp;toolbar=0'></object>";
  
}

function closepopuppdf()
{
  document.getElementById("popupdiv").style.display="none";
  document.getElementById("opaquediv").style.display="none";
//  .data=  "<object style='position:absolute; top:20px; left:0px; height:100%; width:100%' type='application/pdf' data='"+archivo+"#navpanes=0&amp;toolbar=0'></object>";
  
}

function showobject(tipo, archivo)
{
  document.getElementById("object").style.display="block";
  switch(tipo)
  {
  	case 0:
      document.getElementById("object").innerHTML = "<object class='innerobject' type='text/html' data='"+archivo+"'></object>";
      break;
  	case 1:
      document.getElementById("object").innerHTML = "<object class='innerobject' type='application/pdf' data='"+archivo+"#navpanes=1;toolbar=1'></object>";
      break;
  }	
  resizeobject(); 
}


window.onresize = resizeobject;

function resizeobject()
{
  var h = document.documentElement.clientHeight - 140;
  changecss('.innerobject','height',h.toString()+'px');
     
}

