

function cambiarFotoTira(foto, desc, tam) {
    var objFoto = document.getElementById("foto_grande");
    objFoto.src = foto;
    objFoto.alt = desc;
    if (objFoto.width > tam) {
        objFoto.width = tam;
    }
}


function realizarCompra(referencia, id_familia){
	var colores, pagina;
	var obj = eval("document.getElementById('" + referencia + "-color')");
	if(obj){
		colores = obj.value;
	}
	else{
		colores = "";
	}
	if(colores == ""){
		colores = "SINCOLOR";
	}
	pagina = "{HOST_URL}iluminacion/comprar/" + id_familia + "/{PAGINA}/" + referencia + "/" + colores + "/";			
	document.location.href = pagina;
}
	
function mostrarCapa(capa){
 document.getElementById(capa).style.display="inline";
}

function ocultarCapa(nombreCapa){
 document.getElementById(nombreCapa).style.display="none";
}

function calcular_total_productos(elemento) {
	var i = 0, y = 0, nombre, result="", total = 0, aux;
	var todos = document.form_referencias.length;
	for(i = 0; i < todos; i++){
		nombre = document.form_referencias.elements[i].id;
		result = "";
		for (y = 0; y < 3 ; y++) {		
    		result += nombre.charAt(y);			
		} 
		if(result == "re_"){
			aux = new Number(document.form_referencias.elements[i].value);
			total = total + aux;
		}	
	}
	document.getElementById('num_productos').value = total;
}

