// llamar a la ventana nuevamente para cargar menu
function pasarVariables(pagina) {
  location.href=pagina;
}

// cargar el e-mail para enviarlo okis
function opennewsletter(numero){
	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', 'windowfiles/mailhard.php?id='+numero, 'Contacto Computer Design', 'width=650px,height=500px,center=1,resize=0,scrolling=1')
}


function getXMLHTTPRequest()
{
var req = false;
try
  {
    req = new XMLHttpRequest(); /* p.e. Firefox */
  }
catch(err1)
  {
  try
    {
     req = new ActiveXObject("Msxml2.XMLHTTP");
  /* algunas versiones IE */
    }
  catch(err2)
    {
    try
      {
       req = new ActiveXObject("Microsoft.XMLHTTP");
  /* algunas versiones IE */
      }
      catch(err3)
        {
         req = false;
        }
    }
  }
return req;
}

var miPeticion = getXMLHTTPRequest();

function llamarAjax(uno) {
var url = "trabaxml.php";
miPeticion.open("GET", url, true);
miPeticion.onreadystatechange = respuestaAjax;
miPeticion.send(null);
}

function respuestaAjax() {
if(miPeticion.readyState == 4) {
if(miPeticion.status == 200) {
 var nodoSaludo = miPeticion.responseXML;
			product = nodoSaludo.getElementsByTagName("producto");
			var contodo;
			for( var c = 0; c < product.length; c++){
				var id = '';
				var titulo = '';
				var texto = '';
				var fecha = '';
				var dpdf = '';
				var epigrafe = '';
				var icono = '';
				
				contodo = '<br>';
				var id = product[c].getElementsByTagName("id")[0].firstChild.nodeValue;
				var titulo = product[c].getElementsByTagName("titulo")[0].firstChild.nodeValue;
				var texto = product[c].getElementsByTagName("texto")[0].firstChild.nodeValue;
				var fecha = product[c].getElementsByTagName("fecha")[0].firstChild.nodeValue;
				var dpdf = product[c].getElementsByTagName("dpdf")[0].firstChild.nodeValue;
				var epigrafe = product[c].getElementsByTagName("epigrafe")[0].firstChild.nodeValue;
				var icono = product[c].getElementsByTagName("icono")[0].firstChild.nodeValue;
				// con esto estraigo los archivos adjuntos.
				
				contodo = contodo + '<span class="cuerpo_memo">' + texto + '</samp><br>';
				
				if(dpdf != "null"){
					contodo = contodo + '<img src="imagenes/' + icono + '" hspace="2" vspace="2" align="absmiddle" />&nbsp;<a href="bajar.php?archivos=' + dpdf + '" class="miclik">'+ epigrafe +'</a><br>';
				}
				
				contodo = contodo + fecha;
				// este saca el titulo si es nuevo promocion o tan solo no tiene nada
				var titulacho_arriba = '';
				
				titulacho_arriba = titulo;
				
				var til = "titulo_" + id; // ve los id de los titulos
				var conte = "texto_" + id; // ve los id de los contenidos
				
				document.getElementById(til).innerHTML = (titulacho_arriba);
				document.getElementById(conte).innerHTML = (contodo);
			
			}
			} else {
		document.getElementById('sal').innerHTML = '<img src="windowfiles/loading.gif">';
        } 
    }
}

// inicio de contenido

var Peticion = getXMLHTTPRequest();

function llamarContenido(uno) {
var url = "cottrabaxml.php?si=si";
Peticion.open("GET", url, true);
Peticion.onreadystatechange = respuestaConte;
Peticion.send(null);
}

function respuestaConte() {
if(Peticion.readyState == 4) {
if(Peticion.status == 200) {
 var nodoRelleno = Peticion.responseXML;
			contenido = nodoRelleno.getElementsByTagName("inicio")[0];
			var resultadoR = '';

				var Rtitulo = contenido.getElementsByTagName("titulo")[0].firstChild.nodeValue;
				var Rtexto = contenido.getElementsByTagName("texto")[0].firstChild.nodeValue;
				var Rimagen = contenido.getElementsByTagName("imag")[0].firstChild.nodeValue;
				var Ralto = contenido.getElementsByTagName("alto")[0].firstChild.nodeValue;
				var Rancho = contenido.getElementsByTagName("ancho")[0].firstChild.nodeValue;
				
				//lisRtexto = Rtexto.replace('\n','<br><br>');

				resultadoR = resultadoR + '<span class="titulo_gris_cuadro">' + Rtitulo + '</span></p>';
				if(Rimagen != "null"){
				resultadoR = resultadoR + '<p><div align="center"><img src="imagJuagar2/'+ Rimagen + '" width="'+Rancho+'px" height="'+Ralto+'px" /></div></p>';
				}
				resultadoR = resultadoR + '<p><span class="texto_gris_cuadro">' + Rtexto + '</span></p>';
				
				document.getElementById('espacio').innerHTML = (resultadoR);

			} else {
		document.getElementById('espacio').innerHTML = '<img src="windowfiles/loading.gif">';
        } 
    }
}



