// JavaScript Document
            var req;
            var target;
            var isIE;

            var reqd;
            var targetd;
            var isIEd;

            var reqt;
            var targett;
            var isIEt;
			
            function initRequestd(url) {
                if (window.XMLHttpRequest) {
                    reqd = new XMLHttpRequest();
                } else if (window.ActiveXObject) {
                    isIEd = true;
                    reqd = new ActiveXObject("Microsoft.XMLHTTP");
                }
            }
            function initRequest(url) {
                if (window.XMLHttpRequest) {
                    req = new XMLHttpRequest();
                } else if (window.ActiveXObject) {
                    isIE = true;
                    req = new ActiveXObject("Microsoft.XMLHTTP");
                }
            }
            function initRequestt(url) {
                if (window.XMLHttpRequest) {
                    reqt = new XMLHttpRequest();
                } else if (window.ActiveXObject) {
                    isIEt = true;
                    reqt = new ActiveXObject("Microsoft.XMLHTTP");
                }
            }

            function Cambiarp(opcion) {
				if(opcion==1){
					idp = document.getElementById("id1").value;
				}
							
				var url = "ajax.jsp?columna="+opcion+"&idp="+escape(idp)+"&idioma=1";   
				initRequestd(url);
		
				reqd.onreadystatechange = processRequestd;
				reqd.open("GET", url, true); 
				reqd.send(null);
            }
			
            function Cambiar(opcion) {
				if(opcion==2){
					idp = document.getElementById("id2").value;
				}
							
				var url = "ajax.jsp?columna="+opcion+"&idp="+escape(idp)+"&idioma=1";   
				initRequest(url);
		
				req.onreadystatechange = processRequest;
				req.open("GET", url, true); 
				req.send(null);
            }

            function Cambiart(opcion) {
				if(opcion==3){
					idp = document.getElementById("id3").value;
				}
							
				var url = "ajax.jsp?columna="+opcion+"&idp="+escape(idp)+"&idioma=1";   
				initRequestt(url);
		
				reqt.onreadystatechange = processRequestt;
				reqt.open("GET", url, true); 
				reqt.send(null);
            }

            function processRequest() {
                if (req.readyState == 4) {
                  if (req.status == 200) {
				  	var aux = ""+req.responseText;
					var publicidad = aux.substring(aux.indexOf("P"),aux.indexOf("*"));
					publicidad = publicidad.substring(2,publicidad.length);
					var tiempop = aux.substring(aux.indexOf("T"),aux.indexOf("#"));	
					tiempop = tiempop.substring(2,tiempop.length);

					var idp = aux.substring(aux.indexOf("I"),aux.indexOf("$"));					
					idp  = idp .substring(2,idp .length);

					aux = aux.substring(aux.indexOf("+")+1,aux.length);
					publicidad=publicidad*1;
					if(publicidad==2){
						document.getElementById("publicidad2").innerHTML=aux;
						document.getElementById("tiempo2").value=tiempop;
						document.getElementById("id2").value=idp;
					}
                  }
                }
            }
            function processRequestt() {
                if (reqt.readyState == 4) {
                  if (reqt.status == 200) {
				  	var aux = ""+reqt.responseText;
					var publicidad = aux.substring(aux.indexOf("P"),aux.indexOf("*"));
					publicidad = publicidad.substring(2,publicidad.length);
					var tiempop = aux.substring(aux.indexOf("T"),aux.indexOf("#"));	
					tiempop = tiempop.substring(2,tiempop.length);

					var idp = aux.substring(aux.indexOf("I"),aux.indexOf("$"));					
					idp  = idp .substring(2,idp .length);

					aux = aux.substring(aux.indexOf("+")+1,aux.length);
					publicidad=publicidad*1;
					if(publicidad==3){
						document.getElementById("publicidad3").innerHTML=aux;
						document.getElementById("tiempo3").value=tiempop;
						document.getElementById("id3").value=idp;
					}
                  }
                }
            }
            function processRequestd() {
                if (reqd.readyState == 4) {
                  if (reqd.status == 200) {
				  	var aux = ""+reqd.responseText;
					var publicidad = aux.substring(aux.indexOf("P"),aux.indexOf("*"));
					publicidad = publicidad.substring(2,publicidad.length);
					var tiempop = aux.substring(aux.indexOf("T"),aux.indexOf("#"));	
					tiempop = tiempop.substring(2,tiempop.length);

					var idp = aux.substring(aux.indexOf("I"),aux.indexOf("$"));					
					idp  = idp .substring(2,idp .length);

					aux = aux.substring(aux.indexOf("+")+1,aux.length);
					publicidad=publicidad*1;
					if(publicidad==1){
						document.getElementById("publicidad1").innerHTML=aux;
						document.getElementById("tiempo1").value=tiempop;
						document.getElementById("id1").value=idp;
					}
                  }
                }
            }

function ver(){
var aux;
	var t1 = document.getElementById("tiempou").value;
	t1 = t1*1;
	t1 = t1 + 5;
	document.getElementById("tiempou").value=t1;

	if(t1!=0){
		aux = document.getElementById("tiempo1").value;
		aux = aux * 1;
		if(aux==t1){
			Cambiarp(1);
			document.getElementById("tiempou").value=0;
		}
	}
}
function ver2(){
var aux;
	var t2 = document.getElementById("tiempod").value;
	t2 = t2*1;
	t2 = t2 + 5;
	document.getElementById("tiempod").value=t2;

	if(t2!=0){
		aux = document.getElementById("tiempo2").value;
		aux = aux * 1;
		if(aux==t2){
			Cambiar(2);
			document.getElementById("tiempod").value=0;
		}
	}
}
function ver3(){
var aux;
	var t3 = document.getElementById("tiempot").value;
	t3 = t3*1;
	t3 = t3 + 5;
	document.getElementById("tiempot").value=t3;

	if(t3!=0){
		aux = document.getElementById("tiempo3").value;
		aux = aux * 1;
		if(aux==t3){
			Cambiart(3);
			document.getElementById("tiempot").value=0;
		}
	}
}
function espera(direccion){
	setTimeout("espera()",2000);
}
function repeat(){
	ver();
	ver2();
	ver3();
	setTimeout("repeat()",5000);
}
			
