//Necesita 3 arrays para hacer las precargas de las imagenes
var fondos = Array();
var encimas= Array(); //encimas de ponerse encima :D
var botones= Array();
fondos[0] = new Image;
fondos[0].src = 'http://www.intecna.es/images/piezas/01.jpg'; //imagen grande por defecto
//bucle para cargar las 3 imagenes,para las 4 capas
for (i=1; i<4; i++){
	fondos[i+1] = new Image;
	botones[i]  = new Image;
	encimas[i]  = new Image;
	fondos[i+1].src = 'http://www.intecna.es/images/piezas/0'+(i+1)+'.jpg';	
	botones[i].src  = 'http://www.intecna.es/images/piezas/b'+i+'.png';	
	encimas[i].src  = 'http://www.intecna.es/images/piezas/b'+i+'-roll.png';
}

function puzzle(n,e){
	if (e=='on'){
	 document.getElementById('puzzle_ppal').src = fondos[n+1].src;
	 document.getElementById('puzzle_'+n).src   = encimas[n].src;
	} else {
	 document.getElementById('puzzle_ppal').src = fondos[0].src;
	 document.getElementById('puzzle_'+n).src   = botones[n].src;	 
	}
	
}

window.onload = function (){
	if (document.getElementById('menu_interior')){
		cmDrawFromText ('menu_interior', 'vbr', cmThemePanel, 'ThemePanel');
	}
	if (document.getElementById('arbol_interno') && contenidoArbol){
		ctDraw ('arbol_interno', contenidoArbol, ctThemeXP1, 'ThemeXP', 2, 0);
	}
}