function cargar_productos_asociados(imagen, capa) {
    var identificador = document.getElementById(capa);
    identificador.innerHTML = "<img src='/imagenes/"+imagen+"' alt='' />";
}

function popup(id, enlace, ancho, alto) {
	identificador = document.getElementById(id);
	var enlaces = identificador.getElementsByTagName("a").length;
	var array_enlaces = identificador.getElementsByTagName("a");
	for (i = 0; i < enlaces; i++) {
		if (array_enlaces[i].getAttribute("href") && array_enlaces[i].getAttribute("rel") == 'external') {
			array_enlaces[i].target = "popup"
			window.open(array_enlaces[i].href, array_enlaces[i].target, 'width='+ancho+', height='+alto+'');
		}
	}
}

function crear_xmlhttp() {
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch(e) {
			xmlhttp = false;
		 }
	 }
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function cargar_imagenes_asociados(script, capa) {
	crear_xmlhttp();
	var identificador = document.getElementById(capa);
	xmlhttp.open("GET", script);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			//identificador.style.display='block';
			identificador.innerHTML = xmlhttp.responseText;
		}
	}
	document.getElementById(capa).innerHTML = '<img src="img/loading.gif">';
	xmlhttp.send(null);
}