$(function() {});

function createsquares(){
	codi="";
			
	for(j=0;j<thiscapes.length;j++){
		
		var capas = thiscapes[j][1];
		
		for(i=0;i<capas.length;i++){
			
			position = "top:"+capas[i][0]+"px;left:"+capas[i][1]+"px;height:"+capas[i][2]+"px;width:"+capas[i][3]+"px;";
			border = "border:1px solid white;";
	
			if(capas[i][5]==0) bgimage = "background:url(css/images/lupa.png) no-repeat center center";
			if(capas[i][5]==1) bgimage = "background:url(css/images/raigx.png) no-repeat center center";
			if (capas[i][5] == 2) bgimage = "background:url(css/images/text.png) no-repeat center center";
			if (capas[i][5] == 3) bgimage = "background:url(css/images/text.png) no-repeat center center";
	
			onmover = "onmouseover='JavaScript:divmover(\"capa_" + j + "_" + i + "\")'";
			onmout = "onmouseout='JavaScript:divmout(\"capa_" + j + "_" + i + "\")'";
			contenido = "<a href='"+capas[i][4]+"'><img id='detalls' src='images/dot.gif' height='"+capas[i][2]+"' width='"+capas[i][3]+"' border=0></a>"
			
			codi += "<div id='capa_" + j + "_" + i + "' style='display:none;position:absolute;"+position+border+bgimage+"' "+onmover+" "+onmout+">"+contenido+"</div>";
		}

		document.getElementById(thiscapes[j][0]).innerHTML = codi;

	}

	for (j = 0; j < thiscapes.length; j++) {
	
		var capas = thiscapes[j][1];
		
		for (i = 0; i < capas.length; i++) {
			if (capas[i][5] != 2) 
				$(function(){
					$('#capa_' + j + '_' + i + ' a').lightBox();
				});
		}
	}

}		

function showdivs(){
	for (j = 0; j < thiscapes.length; j++) {
		var capas = thiscapes[j][1];
		for (i = 0; i < capas.length; i++) {
			document.getElementById('capa_'+j+'_'+i).style.display = "block";
		}
	}

}

function hidedivs(){
	for (j = 0; j < thiscapes.length; j++) {
		var capas = thiscapes[j][1];
		for (i = 0; i < capas.length; i++) {
			document.getElementById('capa_'+j+'_'+i).style.display = "none";
		}
	}
}

function divmover(capaid){
	document.getElementById(capaid).style.border = "1px solid gray";
}
function divmout(capaid){
	document.getElementById(capaid).style.border = "1px solid white";
}
