var ns4 = (document.layers)? true:false
var ie4 = (document.all)? true:false

var t=0;
var v=50;
var k=1;
var nm=1;
var modo;
var imagenes;
var x=1;
var y=1;
var control=0;
var pag;
var camb=0;
var todos;
var actual;
var digito=0;
var d,w,j;

PreCarga ('boton1','menu1.gif')
PreCarga ('boton1_b','menu1_p.gif')
PreCarga ('boton2','menu2.gif')
PreCarga ('boton2_b','menu2_p.gif')
PreCarga ('boton3','menu3.gif')
PreCarga ('boton3_b','menu3_p.gif')
PreCarga ('boton4','menu4.gif')
PreCarga ('boton4_b','menu4_p.gif')
PreCarga ('boton5','menu5.gif')
PreCarga ('boton5_b','menu5_p.gif')
PreCarga ('boton6','menu6.gif')
PreCarga ('boton6_b','menu6_p.gif')
PreCarga ('boton7','cabecera_proyec.jpg')
PreCarga ('boton8','general.jpg')
PreCarga ('boton9','encimeras.jpg')
PreCarga ('boton10','mbano.jpg')
PreCarga ('boton11','proyecto.jpg')
PreCarga ('boton12','up.gif')
PreCarga ('boton13','dn.gif')
PreCarga ('boton14','logo.jpg')
PreCarga ('boton15','punto_verde.jpg')


function PreCarga (objetoImagen, rutaImagen) 
{
    if (document.images)
    {
	eval (objetoImagen +' = new Image()')
	eval (objetoImagen +'.src = "' + rutaImagen + '"')
    }
}

img= ["image1.src", "image2.src", "image3.src", "image4.src", "image5.src", "image6.src", "image7.src", "image8.src", "image9.src", "image10.src", "image11.src", "image12.src", "image13.src", "image14.src", "image15.src", "image16.src", "image17.src", "image18.src", "image19.src", "image20.src", "image21.src", "image22.src", "image23.src", "image24.src", "image25.src", "image26.src", "image27.src", "image28.src", "image29.src", "image30.src", "image31.src", "image32.src"]
var image = new Array(32);
if (document.images) {
  image1 = new Image();
  image1.src = "proyectos/zapateira/zapateira12.jpg";
  image2 = new Image();
  image2.src = "proyectos/alfredo/alfredo1.jpg";
  image3 = new Image();
  image3.src = "proyectos/bastiagueiro/bastiagueiro7.jpg";
  image4 = new Image();
  image4.src = "proyectos/general_sanjurjo/general_sanjurjo_1.jpg";
  image5 = new Image();
  image5.src = "proyectos/cambre/cambre6.jpg";
  image6 = new Image();
  image6.src = "proyectos/celas/celas1.jpg";
  image7 = new Image();
  image7.src = "proyectos/montrove/montrove0.jpg";
  image8 = new Image();
  image8.src = "proyectos/perbes/perbes7.jpg";
  image9 = new Image();
  image9.src = "proyectos/stacruz/stacruz15.jpg";
  image10 = new Image();
  image10.src = "proyectos/emilia1/emilia2.jpg";  
  image11 = new Image();
  image11.src = "proyectos/emilia2/emilia2.jpg";
  image12 = new Image();
  image12.src = "proyectos/himacs/himacs1.jpg";
  image13 = new Image();
  image13.src = "proyectos/nave/nave_industrial1.jpg";
  image14 = new Image();
  image14.src = "proyectos/meirama/meirama2.jpg";
  image15 = new Image();
  image15.src = "proyectos/armario/armario_empotrado_2.jpg";   
  image16 = new Image();
  image16.src = "proyectos/mueble_bano/mueble_bano2.jpg";
  image17 = new Image();
  image17.src = "proyectos/lopez/lopez4.jpg";    
  image18 = new Image();
  image18.src = "proyectos/zamora/zamora1.jpg";
  image19 = new Image();
  image19.src = "proyectos/casal/casal3.jpg";
  image20 = new Image();
  image20.src = "proyectos/betanzos/betanzos1.jpg";  
  image21 = new Image();
  image21.src = "proyectos/oficina/oficinag1.jpg";
  image22 = new Image();
  image22.src = "proyectos/panadeiro/o_panadeiro6.jpg";
  image23 = new Image();
  image23.src = "proyectos/optica_lopsy/optica_lopsyg_5.jpg";
  image24 = new Image();
  image24.src = "proyectos/ordes/ordes1.jpg";
  image25 = new Image();
  image25.src = "proyectos/meixigo/meixigo4.jpg";   
  image26 = new Image();
  image26.src = "proyectos/puertas_interior/puerta_interior_1.jpg";
  image27 = new Image();
  image27.src = "proyectos/xalo/xalo2.jpg";    
  image28 = new Image();
  image28.src = "proyectos/mariapita/mariapita4.jpg";
  image29 = new Image();
  image29.src = "proyectos/riveiro/riveiro8.jpg";
  image30 = new Image();
  image30.src = "proyectos/piso/piso9.jpg";  
  image31 = new Image();
  image31.src = "proyectos/vilaboa/vilaboa1.jpg";
  image32 = new Image();
  image32.src = "proyectos/wengue/wengue1.jpg";
  }
  


var texto= new Array(17);
	texto[1]="Vista de tarima flotante.";
	texto[2]="Encimera de baño tipo corian.";
	texto[3]="Mueble de baño tipo corian";
	texto[4]="Vista sistema apertura mueble de baño.";
	texto[5]="Armario empotrado de corredera.";
	texto[6]="Vista de interior armario empotrado.";
	texto[7]="Distribución interior de vestidor.";
	texto[8]="Vista desde abajo de tarima flotante en techo.";
	texto[9]="Puerta lacada en blanco, de techo a suelo.";
	texto[10]="Vista de baño LG -HI-MACS sin uniones";
	texto[11]="Puerta de corredera lacada en blanco.";
	texto[12]="Encimera de baño en LG HI-MACS.";
	texto[13]="Armario empotrado de corredera.";
	texto[14]="Puerta de corredera de baño.";
	texto[15]="Puerta de entrada con parkles";
	texto[16]="Mueble de baño.";
	texto[17]="Armario empotrado con puertas de corredera.";
	
function cambio(imagen,boton)
	{
	    if (ns4)
		document.divImagen.document.images[boton].src = eval(imagen);
	    else
		document.images[boton].src = eval(imagen);
}

function alternar(Seccion){
	if (Seccion.style.display=="none")
	     {Seccion.style.display=""}
	else{Seccion.style.display="none"}
}

function abrir(pagina)
{noticia1=window.open(pagina,"principal","toolbar=no,scrollbars=yes,width=780,height=600,directories=no,status=yes,left=10,top=10");}

function makevisible(cur,cura,which){
if (which==0 & cur.filters.alpha.opacity<100) 
{  cur.filters.alpha.opacity=99 
    cura.filters.alpha.opacity=99 }
  
else if(cur.filters.alpha.opacity<100)
{
 cur.filters.alpha.opacity=50 
  cura.filters.alpha.opacity=50}}

function fijo(cur,cura,nm)
{

nm = nm + camb;

if(screen.width>640)
{   
for(t=1;t<9;t++)
	 {
        eval('thumb_' + t).filters.alpha.opacity=50	
        eval('thum' + t).filters.alpha.opacity=50	
 		 }
  cur.filters.alpha.opacity=100;
  cura.filters.alpha.opacity=100;
  visor.filters.alpha.opacity=50;
  visor.src= eval("image"+[nm] + ".src");
  contenido.innerText = texto[nm]
  
  comprobar();  	
   
   high(visor)
}

else
visor.src= eval("image"+[nm] + ".src");
  }
  
function high(which2)
{
theobject=which2;
highlighting=setInterval("highlightit(theobject)",50);
}

function low(which2)
{
clearInterval(highlighting);
which2.filters.alpha.opacity=50;
}

function highlightit(cur2)
{
if(cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=5;
else if(window.highlighting)
clearInterval(highlighting)
}  

function avance(control)
{

 if (y<pag & control>0)
   {

	   x+1;
	   y++;
	   nm=nm+8;
     
	  menos.style.visibility = 'visible';
      camb = camb + 8;
	  if(y==pag)
         mas.style.visibility = 'hidden';
	   else 
	     mas.style.visibility = 'visible';			   

	   }
 else
   {
	   x=x-16;
	   y--;
	   nm=nm-8;
	     mas.style.visibility = 'visible';
       camb = camb - 8;		 
	   if(y==1)
	     menos.style.visibility = 'hidden';
	   else
	     menos.style.visibility = 'visible';	   
	   }

carga()		
}

function calcula()
{
  if(screen.width>640)
    bscroll.style.height = 218;
	}

function carga()
{ 
 if(screen.width>640)
 {  	   
  for(t=1;t<9;t++)
	 {
        eval('thumb_' + t).filters.alpha.opacity=50	
        eval('thum' + t).filters.alpha.opacity=50			
 		 }
	 thumb_1.filters.alpha.opacity=100	
	 thum1.filters.alpha.opacity=100		 
	}
	
 for(k=1;k<9;k++)
    {
 	 if(x<imagenes+1)	
	 {
		 if(screen.width>640)  
	           eval('thum' + k).style.background= "#FF9900"		 
     eval('thumb_' + k).src=eval("image"+[x] + ".src");
	 x++; }
	  
	 else
	   vacio(k)
	 } 
    
     visor.src= eval("image"+[nm] + ".src");
	 contenido.innerText = texto[nm]	 
	comprobar();
 	
  }
 
function comprobar()
{
	if(visor.width<400)
    {
     contenido.style.width= visor.width-4;
	 contenido.style.left=81;
	 detalles.style.left=98;
	}	

   else
    {
     contenido.style.width= 448;
	 contenido.style.left=-1;
	 detalles.style.left=18;	 
	} 	
	return;
	}

function vacio(control)
{
	for(k=control;k<9;k++)
    {	   
     eval('thumb_' + k).src='nada.gif';
	    if(screen.width>640)
     	 eval('thum' + k).style.background= "#FFFFFF"
	 x++; }   
	   }	
	   
function previa(todos)	   
     {
	 actual=visor.src;
     visor.src=todos;
	 comprobar();
	return;
		 }
		 

function volver()
   {
	visor.src=actual;
	comprobar();
	return;
	   }


function verScroll(dir, spd, loop) {
loop = true;
direction = "up";
speed = 10;
scrolltimer = null;
if (document.layers) {
var page = eval(document.contenido);
}
else {
if (document.getElementById) {
var page= eval("document.getElementById('contenido').style");
}
else {
if (document.all) {
var page = eval(document.all.contenido.style);
      }
   }
}
direction = dir;
speed = parseInt(spd);
var y_pos = parseInt(page.top);

if (loop == true) {
   if (direction == "dn")
   {  
     if(parseInt(page.top)>2)
	 {
      page.top = (y_pos - (speed));
scrolltimer = setTimeout("verScroll(direction,speed)", 1);	  
	  }
	  
	 else
	   {
	   	stopScroll();}
	   
   } 
   else 
   {
	if (direction == "up" && y_pos > 1 && y_pos<40)
	  {       
	    page.top = (y_pos + (speed));
scrolltimer = setTimeout("verScroll(direction,speed)", 1);		
    	}
	else  {
	stopScroll()
   }
}

   }
}

function stopScroll() {
loop = false;
clearTimeout(scrolltimer);
}

