// JavaScript Document
<!--
function desplegarContraer(cual,desde) 
{ 
var elElemento=document.getElementById(cual);          
if(elElemento.className == 'elementoVisible') 
{
elElemento.className = 'elementoOculto';
desde.className = 'linkExpandido';          
} else 
{               
elElemento.className = 'elementoVisible';               
desde.className = 'linkContraido';         
}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->

<!--
function qdesplegarContraer(cual,desde) 
{ 
var elElemento=document.getElementById(cual);          
if(elElemento.className == 'qelementoVisible') 
{
elElemento.className = 'qelementoOculto';
desde.className = 'qlinkExpandido';          
} else 
{               
elElemento.className = 'qelementoVisible';               
desde.className = 'qlinkContraido';          
}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->


//FUNCIÓN RECUPERAR PASSWORD
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httprequestPass = getXMLHTTPRequest();


function requestPass() {
var email;
email = document.getElementById('email').value; 
antirand='cero';
  
  var myurlrequestPass = '../ajax/response_forgot_password.php?email=' + email +'&antirand='+ antirand;
  myRandrequestPass = parseInt(Math.random()*999999999999999);
  var modurlrequestPass = myurlrequestPass+"?rand="+myRandrequestPass;
  httprequestPass.open("GET", modurlrequestPass, true);
  httprequestPass.onreadystatechange = useHttpResponserequestPass;
  httprequestPass.send(null);
}

function useHttpResponserequestPass() {
   if (httprequestPass.readyState == 4) {
    if(httprequestPass.status == 200) {
      var miTextorequestPass = httprequestPass.responseText;
      document.getElementById('recuperar_forgot_password').innerHTML = miTextorequestPass;
    }
  } else {
  document. getElementById('recuperar_forgot_password').innerHTML = '<img src="../img/loading_p.gif" />';
  }
}
//FIN FUNCIÓN RECUPERAR PASSWORD



//FUNCIÓN ACTUALIZAR DATOS PERSONALES
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpdataDatos = getXMLHTTPRequest();


function dataDatos() {
var email,nombre,apellidos,dni,direccion,provincia,poblacion,pais,codigo_postal,nombre_usuario,passwd;
email = document.getElementById('email').value;
nombre = document.getElementById('nombre').value;
apellidos = document.getElementById('apellidos').value;
dni = document.getElementById('dni').value;
direccion = document.getElementById('direccion').value;
provincia = document.getElementById('provincia').value;
poblacion = document.getElementById('poblacion').value;
pais = document.getElementById('pais').value;
codigo_postal = document.getElementById('codigo_postal').value;
nombre_usuario = document.getElementById('nombre_usuario').value;
passwd = document.getElementById('passwd').value;
antirand='cero';
  
  var myurldataDatos = '../../ajax/response_users_datos_personales.php?email=' + email +'&nombre='+ nombre +'&apellidos='+ apellidos 
  +'&dni='+ dni +'&direccion='+ direccion +'&provincia='+ provincia +'&poblacion='+ poblacion
  +'&pais='+ pais +'&codigo_postal='+ codigo_postal +'&nombre_usuario='+ nombre_usuario
   +'&passwd='+ passwd +'&antirand='+ antirand;
  myRanddataDatos = parseInt(Math.random()*999999999999999);
  var modurldataDatos = myurldataDatos+"?rand="+myRanddataDatos;
  httpdataDatos.open("GET", modurldataDatos, true);
  httpdataDatos.onreadystatechange = useHttpResponsedataDatos;
  httpdataDatos.send(null);
}

function useHttpResponsedataDatos() {
   if (httpdataDatos.readyState == 4) {
    if(httpdataDatos.status == 200) {
      var miTextodataDatos = httpdataDatos.responseText;
      document.getElementById('central_divisions_generic_response').innerHTML = miTextodataDatos;
    }
  } else {
  document. getElementById('central_divisions_generic_response').innerHTML = '<img src="../../img/loading.gif" />';
  }
}
//FIN FUNCIÓN ACTUALIZAR DATOS PERSONALES




//FUNCIÓN SEGUIMIENTO DE COMPRA
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpseguimientoCompra = getXMLHTTPRequest();


function seguimientoCompra() {
var id;
id = document.getElementById('id').value;
antirand='cero';
  
  var myurlseguimientoCompra = '../../ajax/response_users_seguimiento_compra.php?id=' + id +'&antirand='+ antirand;
  myRandseguimientoCompra = parseInt(Math.random()*999999999999999);
  var modurlseguimientoCompra = myurlseguimientoCompra+"?rand="+myRandseguimientoCompra;
  httpseguimientoCompra.open("GET", modurlseguimientoCompra, true);
  httpseguimientoCompra.onreadystatechange = useHttpResponseseguimientoCompra;
  httpseguimientoCompra.send(null);
}

function useHttpResponseseguimientoCompra() {
   if (httpseguimientoCompra.readyState == 4) {
    if(httpseguimientoCompra.status == 200) {
      var miTextoseguimientoCompra = httpseguimientoCompra.responseText;
      document.getElementById('central_divisions_generic_response').innerHTML = miTextoseguimientoCompra;
    }
  } else {
  document. getElementById('central_divisions_generic_response').innerHTML = '';
  }
}
//FIN FUNCIÓN SEGUIMIENTO DE COMPRA






//FUNCIÓN REQUEST GIFT CARD
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httprequestCard = getXMLHTTPRequest();


function requestCard() {
var destinatario,remitente,mensaje,nombre_usuario;
destinatario = document.getElementById('destinatario').value;
remitente = document.getElementById('remitente').value;
mensaje = document.getElementById('mensaje').value;
nombre_usuario = document.getElementById('nombre_usuario').value;
antirand='cero';
  
  var myurlrequestCard = '../ajax/response_gift_cards.php?destinatario=' + destinatario +
  '&remitente='+ remitente +'&mensaje='+ mensaje +'&nombre_usuario='+ nombre_usuario +'&antirand='+ antirand;
  myRandrequestCard = parseInt(Math.random()*999999999999999);
  var modurlrequestCard = myurlrequestCard+"?rand="+myRandrequestCard;
  httprequestCard.open("GET", modurlrequestCard, true);
  httprequestCard.onreadystatechange = useHttpResponserequestCard;
  httprequestCard.send(null);
}

function useHttpResponserequestCard() {
   if (httprequestCard.readyState == 4) {
    if(httprequestCard.status == 200) {
      var miTextorequestCard = httprequestCard.responseText;
      document.getElementById('response_gift').innerHTML = miTextorequestCard;
    }
  } else {
  document. getElementById('response_gift').innerHTML = '';
  }
}
//FIN REQUEST GIFT CARD




//FUNCIÓN GUARDAR GIFT CARD
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httprequestCard = getXMLHTTPRequest();


function requestCard() {
var destinatario,remitente,mensaje,nombre_usuario;
destinatario = document.getElementById('destinatario').value;
remitente = document.getElementById('remitente').value;
mensaje = document.getElementById('mensaje').value;
nombre_usuario = document.getElementById('nombre_usuario').value;
antirand='cero';
  
  var myurlrequestCard = '../ajax/response_gift_cards.php?destinatario=' + destinatario +
  '&remitente='+ remitente +'&mensaje='+ mensaje +'&nombre_usuario='+ nombre_usuario +'&antirand='+ antirand;
  myRandrequestCard = parseInt(Math.random()*999999999999999);
  var modurlrequestCard = myurlrequestCard+"?rand="+myRandrequestCard;
  httprequestCard.open("GET", modurlrequestCard, true);
  httprequestCard.onreadystatechange = useHttpResponserequestCard;
  httprequestCard.send(null);
}

function useHttpResponserequestCard() {
   if (httprequestCard.readyState == 4) {
    if(httprequestCard.status == 200) {
      var miTextorequestCard = httprequestCard.responseText;
      document.getElementById('response_gift').innerHTML = miTextorequestCard;
    }
  } else {
  document. getElementById('response_gift').innerHTML = '';
  }
}
//FUNCIÓN REQUEST GIFT CARD
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httprequestCard = getXMLHTTPRequest();


function saveCard() {
var destinatario,remitente,mensaje,nombre_usuario;
destinatario = document.getElementById('destinatario').value;
remitente = document.getElementById('remitente').value;
mensaje = document.getElementById('mensaje').value;
nombre_usuario = document.getElementById('nombre_usuario').value;
antirand='cero';
  
  var myurlrequestCard = '../ajax/response_gift_cards_save.php?destinatario=' + destinatario +
  '&remitente='+ remitente +'&mensaje='+ mensaje +'&nombre_usuario='+ nombre_usuario +'&antirand='+ antirand;
  myRandrequestCard = parseInt(Math.random()*999999999999999);
  var modurlrequestCard = myurlrequestCard+"?rand="+myRandrequestCard;
  httprequestCard.open("GET", modurlrequestCard, true);
  httprequestCard.onreadystatechange = useHttpResponserequestCard;
  httprequestCard.send(null);
}

function useHttpResponserequestCard() {
   if (httprequestCard.readyState == 4) {
    if(httprequestCard.status == 200) {
      var miTextorequestCard = httprequestCard.responseText;
      document.getElementById('response_gift').innerHTML = miTextorequestCard;
    }
  } else {
  document. getElementById('response_gift').innerHTML = '';
  }
}
//FIN REQUEST GIFT CARD



//FUNCIÓN CARGAR TARJETA GUARDADA
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httploadCard = getXMLHTTPRequest();


function loadCard(id) {

idtarjeta = id;
antirand='cero';
  
  var myurlloadCard = '../../ajax/response_gift_cards_load.php?idtarjeta=' + idtarjeta +'&antirand='+ antirand;
  myRandloadCard = parseInt(Math.random()*999999999999999);
  var modurlloadCard = myurlloadCard+"?rand="+myRandloadCard;
  httploadCard.open("GET", modurlloadCard, true);
  httploadCard.onreadystatechange = useHttpResponseloadCard;
  httploadCard.send(null);
}

function useHttpResponseloadCard() {
   if (httploadCard.readyState == 4) {
    if(httploadCard.status == 200) {
      var miTextoloadCard = httploadCard.responseText;
      document.getElementById('central_divisions_generic_response').innerHTML = miTextoloadCard;
    }
  } else {
  document. getElementById('central_divisions_generic_response').innerHTML = '';
  }
}
//FIN CARGAR TARJETA GUARDADA



//FUNCIÓN BORRAR TARJETA
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpdeleteCard = getXMLHTTPRequest();


function deleteCard(id) {

idtarjeta = id;
antirand='cero';
  
  var myurldeleteCard = '../../ajax/response_gift_cards_deleted.php?idtarjeta=' + idtarjeta +'&antirand='+ antirand;
  myRanddeleteCard = parseInt(Math.random()*999999999999999);
  var modurldeleteCard = myurldeleteCard+"?rand="+myRanddeleteCard;
  httpdeleteCard.open("GET", modurldeleteCard, true);
  httpdeleteCard.onreadystatechange = useHttpResponsedeleteCard;
  httpdeleteCard.send(null);
}

function useHttpResponsedeleteCard() {
   if (httpdeleteCard.readyState == 4) {
    if(httpdeleteCard.status == 200) {
      var miTextodeleteCard = httpdeleteCard.responseText;
      document.getElementById('central_divisions_generic_response').innerHTML = miTextodeleteCard;
	  setTimeout("location.href='http://www.zamoramarket.com/gift_cards/'",2000);
    }
  } else {
  document. getElementById('central_divisions_generic_response').innerHTML = '';
  }
}
//FIN BORRAR TARJETA


<!--// SECCIÓN ALTA CLIENTES \\-->

//FUNCIÓN COMPROBAR NOMBRE DE USUARIO
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpPass = getXMLHTTPRequest();


function comprobarPass() {
var nombre_usuario,registro;
registro = document.getElementById('registro');
nombre_usuario = document.getElementById('nombre_usuario').value; 
antirand='cero';
  
  var myurlPass = '../ajax/comprobar_pass.php?nombre_usuario=' + nombre_usuario +'&antirand='+ antirand;
  myRandPass = parseInt(Math.random()*999999999999999);
  var modurlPass = myurlPass+"?rand="+myRandPass;
  httpPass.open("GET", modurlPass, true);
  httpPass.onreadystatechange = useHttpResponsePass;
  httpPass.send(null);
}

function useHttpResponsePass() {
   if (httpPass.readyState == 4) {
    if(httpPass.status == 200) {
      var miTextoPass = httpPass.responseText;
      document.getElementById('comprobar_usuario').innerHTML = miTextoPass;
    }
  } else {
  document. getElementById('comprobar_usuario').innerHTML = '<img src="../img/loading.gif" />';
  }
}


//FIN FUNCIÓN COMPROBAR NOMBRE DE USUARIO


//FUNCIÓN VALIDAR DNI
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpDni = getXMLHTTPRequest();


function comprobarDni() {
var dni,registro;
registro = document.getElementById('registro');
dni = document.getElementById('dni').value; 
antirand='cero';
  
  var myurlDni = '../ajax/comprobar_dni.php?dni=' + dni +'&antirand='+ antirand;
  myRandDni = parseInt(Math.random()*999999999999999);
  var modurlDni = myurlDni+"?rand="+myRandDni;
  httpDni.open("GET", modurlDni, true);
  httpDni.onreadystatechange = useHttpResponseDni;
  httpDni.send(null);
}

function useHttpResponseDni() {
   if (httpDni.readyState == 4) {
    if(httpDni.status == 200) {
      var miTextoDni = httpDni.responseText;
      document.getElementById('comprobar_dni').innerHTML = miTextoDni;
    }
  } else {
  document. getElementById('comprobar_dni').innerHTML = '<img src="../img/loading.gif" />';
  }
}
//FIN FUNCIÓN VALIDAR DNI


//FUNCIÓN VALIDAR MAIL
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpMail = getXMLHTTPRequest();


function comprobarMail() {
var email;

email = document.getElementById('idemail').value; 
antirand='cero';
  
  var myurlMail = '../ajax/comprobar_email.php?email=' + email +'&antirand='+ antirand;
  myRandMail = parseInt(Math.random()*999999999999999);
  var modurlMail = myurlMail+"?rand="+myRandMail;
  httpMail.open("GET", modurlMail, true);
  httpMail.onreadystatechange = useHttpResponseMail;
  httpMail.send(null);
}

function useHttpResponseMail() {
   if (httpMail.readyState == 4) {
    if(httpMail.status == 200) {
      var miTextoMail = httpMail.responseText;
      document.getElementById('r_email').innerHTML = miTextoMail;
    }
  } else {
  document. getElementById('r_email').innerHTML = '<img src="../img/loading.gif" />';
  }
}
//FIN FUNCIÓN VALIDAR MAIL


//FUNCIÓN PROCESAR FORMULARIO
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpProcess = getXMLHTTPRequest();

function processForm() {
var provincia,pais,nombre_usuario,email,word,registro;
registro = document.getElementById('registro');
provincia = document.getElementById('provincia').value; 
pais = document.getElementById('pais').value; 
nombre_usuario = document.getElementById('nombre_usuario').value; 
word = document.getElementById('word').value;
email = document.getElementById('email').value;
antirand='cero';
  
  var myurlProcess = '../ajax/procesar_form.php?provincia=' + provincia + '&pais='+ pais + '&nombre_usuario='+ nombre_usuario + '&word='+ word + '&email='+ email +'&antirand='+ antirand;
  myRandProcess = parseInt(Math.random()*999999999999999);
  var modurlProcess = myurlProcess+"?rand="+myRandProcess;
  httpProcess.open("GET", modurlProcess, true);
  httpProcess.onreadystatechange = useHttpResponseProcess;
  httpProcess.send(null);
}

function useHttpResponseProcess() {
   if (httpProcess.readyState == 4) {
    if(httpProcess.status == 200) {
      var miTextoProcess = httpProcess.responseText;
      document.getElementById('response_procesar_form').innerHTML = miTextoProcess;
	 
    }
  } else {
  document. getElementById('response_procesar_form').innerHTML = '<img src="../img/loading_p.gif" />';
  }
}
//FIN FUNCIÓN PROCESAR FORMULARIO

<!--// FIN SECCIÓN ALTA CLIENTES \\-->




<!--// SECCIÓN SISTEMA DE COMPRA \\-->


//FUNCIÓN SUMAR CANTIDAD
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}
var http = getXMLHTTPRequest();
//FUNCIÓN SUMAR CANTIDAD
function sumar(id,items,precio,real,usuario,compra,nombre,empresa,puntos) {
 idnombre=nombre;
 idcompra=compra;
 idusuario=usuario;
 idproducto=id;
 idempresa=empresa;
 idpuntos=puntos;
 iditems = items;
 idprecio = precio;
 idreal = real;
  var myurl = '../ajax/respuesta_suma.php?idreal=' + idreal +'&iditems='+ iditems +'&idempresa='+ idempresa +'&idcompra='+ idcompra +'&idusuario='+idusuario+'&idpuntos='+idpuntos +'&idnombre='+idnombre+'&idprecio='+idprecio;
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"?rand="+myRand;
  http.open("GET", modurl, true);
  http.onreadystatechange = useHttpResponse;
  http.send(null);
}




function useHttpResponse() {
   if (http.readyState == 4) {
    if(http.status == 200) {
      var miTexto = http.responseText;
      document.getElementById(idproducto).innerHTML = miTexto;
    }
  } else {
  document. getElementById(idproducto).innerHTML = '';
  }
}
//FIN FUNCIÓN SUMAR CANTIDAD


//FUNCIÓN RESTAR CANTIDAD
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}
var http = getXMLHTTPRequest();

function restar(id,items,precio,real,usuario,compra,nombre,empresa,puntos) {
 idnombre=nombre;
 idcompra=compra;
 idusuario=usuario;
 idproducto=id;
 idempresa=empresa;
 idpuntos=puntos;
 iditems = items;
 idprecio = precio;
 idreal = real;
  var myurl = '../ajax/respuesta_resta.php?idreal=' + idreal +'&iditems='+ iditems +'&idempresa='+ idempresa+'&idpuntos='+ idpuntos +'&idcompra='+ idcompra +'&idusuario='+idusuario +'&idnombre='+idnombre+'&idprecio='+idprecio;
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"?rand="+myRand;
  http.open("GET", modurl, true);
  http.onreadystatechange = useHttpResponse;
  http.send(null);
}




function useHttpResponse() {
   if (http.readyState == 4) {
    if(http.status == 200) {
      var miTexto = http.responseText;
      document.getElementById(idproducto).innerHTML = miTexto;
    }
  } else {
  document. getElementById(idproducto).innerHTML = '';
  }
}
//FIN FUNCIÓN RESTAR CANTIDAD


//FUNCIÓN MOSTRAR CARRITO
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}




var httpCarrito = getXMLHTTPRequest();








function mostrar_carrito(usuario,compra) {
 
 idcompra=compra;
 idusuario=usuario;
 antirand="cero";
 
  var myurl_carrito = '../ajax/respuesta_carrito.php?idcompra='+ idcompra +'&idusuario='+ idusuario +'&antirand='+antirand;
  myRand_carrito = parseInt(Math.random()*999999999999999);
  var modurl_carrito = myurl_carrito+"?rand="+myRand_carrito;
  httpCarrito.open("GET", modurl_carrito, true);
  httpCarrito.onreadystatechange = useHttpResponse_carrito;
  httpCarrito.send(null);
}




function useHttpResponse_carrito() {
   if (httpCarrito.readyState == 4) {
    if(httpCarrito.status == 200) {
      var miTextoCarrito = httpCarrito.responseText;
      document.getElementById('right_body_cart').innerHTML = miTextoCarrito;
    }
  } else {
  document. getElementById('right_body_cart').innerHTML = '';
  }
}
// FIN FUNCIÓN MOSTRAR CARRITO


//FUNCIÓN SUMAR CANTIDAD SUB_SUBCATEGORIAS
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}
var http = getXMLHTTPRequest();
//FUNCIÓN SUMAR CANTIDAD
function sumar_sub(id,items,precio,real,usuario,compra,nombre,empresa,puntos) {
 idnombre=nombre;
 idcompra=compra;
 idusuario=usuario;
 idproducto=id;
 idempresa=empresa;
 idpuntos=puntos;
 iditems = items;
 idprecio = precio;
 idreal = real;
  var myurl = '../../ajax/respuesta_suma.php?idreal=' + idreal +'&iditems='+ iditems +'&idempresa='+ idempresa +'&idcompra='+ idcompra +'&idusuario='+idusuario+'&idpuntos='+idpuntos +'&idnombre='+idnombre+'&idprecio='+idprecio;
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"?rand="+myRand;
  http.open("GET", modurl, true);
  http.onreadystatechange = useHttpResponse;
  http.send(null);
}




function useHttpResponse() {
   if (http.readyState == 4) {
    if(http.status == 200) {
      var miTexto = http.responseText;
      document.getElementById(idproducto).innerHTML = miTexto;
    }
  } else {
  document. getElementById(idproducto).innerHTML = '';
  }
}
//FIN FUNCIÓN SUMAR CANTIDAD SUB_SUBCATEGORIAS




//FUNCIÓN RESTAR CANTIDAD SUB_SUBCATEGORIAS
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}
var http = getXMLHTTPRequest();

function restar_sub(id,items,precio,real,usuario,compra,nombre,empresa,puntos) {
 idnombre=nombre;
 idcompra=compra;
 idusuario=usuario;
 idproducto=id;
 idempresa=empresa;
 idpuntos=puntos;
 iditems = items;
 idprecio = precio;
 idreal = real;
  var myurl = '../../ajax/respuesta_resta.php?idreal=' + idreal +'&iditems='+ iditems +'&idempresa='+ idempresa+'&idpuntos='+ idpuntos +'&idcompra='+ idcompra +'&idusuario='+idusuario +'&idnombre='+idnombre+'&idprecio='+idprecio;
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"?rand="+myRand;
  http.open("GET", modurl, true);
  http.onreadystatechange = useHttpResponse;
  http.send(null);
}




function useHttpResponse() {
   if (http.readyState == 4) {
    if(http.status == 200) {
      var miTexto = http.responseText;
      document.getElementById(idproducto).innerHTML = miTexto;
    }
  } else {
  document. getElementById(idproducto).innerHTML = '';
  }
}
//FIN FUNCIÓN RESTAR CANTIDAD SUB_SUBCATEGORIAS


//FUNCIÓN MOSTRAR CARRITO SUB_SUBCATEGORIAS
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}




var httpCarrito = getXMLHTTPRequest();








function mostrar_carrito_sub(usuario,compra) {
 
 idcompra=compra;
 idusuario=usuario;
 antirand="cero";
 
  var myurl_carrito = '../../ajax/respuesta_carrito_subcategorias.php?idcompra='+ idcompra +'&idusuario='+ idusuario +'&antirand='+antirand;
  myRand_carrito = parseInt(Math.random()*999999999999999);
  var modurl_carrito = myurl_carrito+"?rand="+myRand_carrito;
  httpCarrito.open("GET", modurl_carrito, true);
  httpCarrito.onreadystatechange = useHttpResponse_carrito;
  httpCarrito.send(null);
}




function useHttpResponse_carrito() {
   if (httpCarrito.readyState == 4) {
    if(httpCarrito.status == 200) {
      var miTextoCarrito = httpCarrito.responseText;
      document.getElementById('right_body_cart').innerHTML = miTextoCarrito;
    }
  } else {
  document. getElementById('right_body_cart').innerHTML = '';
  }
}
// FIN FUNCIÓN MOSTRAR CARRITO SUB_SUBCATEGORIAS


<!--// FIN SECCIÓN SISTEMA DE COMPRA \\-->


//FUNCIÓN MANDAR MENSAJE CONTACTO
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpmensajeContacto = getXMLHTTPRequest();


function mensajeContacto() {
var email,asunto,mensaje,code;
email = document.getElementById('email').value;
asunto = document.getElementById('asunto').value;
mensaje = document.getElementById('mensaje').value;
code = document.getElementById('code').value;
antirand='cero';
  
  var myurlmensajeContacto = '../ajax/response_contacto.php?email=' + email +'&asunto='+ asunto +'&mensaje='+ mensaje 
  +'&code='+ code +'&antirand='+ antirand;
  myRandmensajeContacto = parseInt(Math.random()*999999999999999);
  var modurlmensajeContacto = myurlmensajeContacto+"?rand="+myRandmensajeContacto;
  httpmensajeContacto.open("GET", modurlmensajeContacto, true);
  httpmensajeContacto.onreadystatechange = useHttpResponsemensajeContacto;
  httpmensajeContacto.send(null);
}

function useHttpResponsemensajeContacto() {
   if (httpmensajeContacto.readyState == 4) {
    if(httpmensajeContacto.status == 200) {
      var miTextomensajeContacto = httpmensajeContacto.responseText;
      document.getElementById('central_divisions_generic_response').innerHTML = miTextomensajeContacto;
    }
  } else {
  document. getElementById('central_divisions_generic_response').innerHTML = '<img src="../img/loading_p.gif">';
  }
}
//FIN FUNCIÓN MANDAR MENSAJE CONTACTO



//CARRUSEL OFERTAS
// JavaScript Document

function objetoAjax(){
 var xmlhttp=false;
  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 Pagina(nropagina){
 //donde se mostrará los registros
 divContenido = document.getElementById('contenido');
 
 ajax=objetoAjax();
 //uso del medoto GET
 //indicamos el archivo que realizará el proceso de paginar
 //junto con un valor que representa el nro de pagina
 ajax.open("GET", "ajax/paginador.php?pag="+nropagina);
 divContenido.innerHTML= '<img src="img/loading.gif">';
 ajax.onreadystatechange=function() {
  if (ajax.readyState==4) {
   //mostrar resultados en esta capa, en este caso la llamada con el Id 'contenido'
   divContenido.innerHTML = ajax.responseText
  }
 }
 //como hacemos uso del metodo GET
 //colocamos null ya que enviamos 
 //el valor por la url ?pag=nropagina
 ajax.send(null)
}
// FIN CARRUSEL OFERTAS


//FUNCIÓN CANJEAR PUNTOS REGALO
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httprequestPoints = getXMLHTTPRequest();


function canjear_puntos(usuario,tipo,porcentaje,codigo,points) {

idusuario = usuario;
idtipo = tipo;
idporcentaje = porcentaje;
idcodigo = codigo;
idpoints = points;
antirand='cero';
  
  var myurlrequestPoints = '../../ajax/response_canjear_puntos.php?idusuario=' + idusuario +
  '&idtipo='+ idtipo +'&idporcentaje='+ idporcentaje +'&idpoints='+ idpoints +'&idcodigo='+ idcodigo +'&antirand='+ antirand;
  myRandrequestPoints = parseInt(Math.random()*999999999999999);
  var modurlrequestPoints = myurlrequestPoints+"?rand="+myRandrequestPoints;
  httprequestPoints.open("GET", modurlrequestPoints, true);
  httprequestPoints.onreadystatechange = useHttpResponserequestPoints;
  httprequestPoints.send(null);
}

function useHttpResponserequestPoints() {
   if (httprequestPoints.readyState == 4) {
    if(httprequestPoints.status == 200) {
      var miTextorequestPoints = httprequestPoints.responseText;
      document.getElementById(idcodigo).innerHTML =miTextorequestPoints;
    }
  } else {
  document. getElementById(idcodigo).innerHTML = '';
  }
}
//FUNCIÓN CANJEAR PUNTOS REGALO








//FUNCIÓN SELECCIONAR DESCUENTO
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpselectDescuento = getXMLHTTPRequest();


function selectDescuento(usuario,total) {

idusuario = usuario;
idtotal = total;
antirand='cero';
  
  var myurlselectDescuento = '../ajax/response_descuento.php?idusuario=' + idusuario +'&idtotal='+ idtotal +'&antirand='+ antirand;
  myRandselectDescuento = parseInt(Math.random()*999999999999999);
  var modurlselectDescuento= myurlselectDescuento+"?rand="+myRandselectDescuento;
  httpselectDescuento.open("GET", modurlselectDescuento, true);
  httpselectDescuento.onreadystatechange = useHttpResponseselectDescuento;
  httpselectDescuento.send(null);
}

function useHttpResponseselectDescuento() {
   if (httpselectDescuento.readyState == 4) {
    if(httpselectDescuento.status == 200) {
      var miTextoselectDescuento = httpselectDescuento.responseText;
      document.getElementById('central_divisions_generic_q_three').innerHTML = miTextoselectDescuento;
    }
  } else {
  document. getElementById('central_divisions_generic_q_three').innerHTML = '';
  }
}
//FIN SELECCIONAR DESCUENTO





//FUNCIÓN CARGAR TARJETA GUARDADA
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httploadCard = getXMLHTTPRequest();


function loadCard(id) {

idtarjeta = id;
antirand='cero';
  
  var myurlloadCard = '../../ajax/response_gift_cards_load.php?idtarjeta=' + idtarjeta +'&antirand='+ antirand;
  myRandloadCard = parseInt(Math.random()*999999999999999);
  var modurlloadCard = myurlloadCard+"?rand="+myRandloadCard;
  httploadCard.open("GET", modurlloadCard, true);
  httploadCard.onreadystatechange = useHttpResponseloadCard;
  httploadCard.send(null);
}

function useHttpResponseloadCard() {
   if (httploadCard.readyState == 4) {
    if(httploadCard.status == 200) {
      var miTextoloadCard = httploadCard.responseText;
      document.getElementById('central_divisions_generic_response').innerHTML = miTextoloadCard;
    }
  } else {
  document. getElementById('central_divisions_generic_response').innerHTML = '';
  }
}
//FIN CARGAR TARJETA GUARDADA




<!-- CLUB DE VINOS -->

//FUNCIÓN PROCESAR FORMULARIO
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpFormVinos = getXMLHTTPRequest();

function procesarFormVinos() {
var nombre,direccion,provincia,poblacion,pais,codigopostal,telefono,email,apellidos,modo_pago,registro;
registro = document.getElementById('registro');
nombre = document.getElementById('nombre').value;
direccion = document.getElementById('direccion').value; 
provincia = document.getElementById('provincia').value; 
poblacion = document.getElementById('poblacion').value;
pais = document.getElementById('pais').value;
codigopostal = document.getElementById('codigopostal').value; 
telefono = document.getElementById('telefono').value; 
email = document.getElementById('email').value; 
apellidos = document.getElementById('apellidos').value;
antirand='cero';
  
  var myurlFormVinos = '../../ajax/procesar_form_club_vinos.php?nombre=' + nombre +'&direccion='+ direccion + '&provincia='+ provincia + '&poblacion='+ poblacion + '&pais='+ pais + '&codigopostal='+ codigopostal + '&telefono='+ telefono + '&email='+ email +'&apellidos='+ apellidos +'&antirand='+ antirand;
  myRandFormVinos = parseInt(Math.random()*999999999999999);
  var modurlFormVinos = myurlFormVinos+"?rand="+myRandFormVinos;
  httpFormVinos.open("GET", modurlFormVinos, true);
  httpFormVinos.onreadystatechange = useHttpResponseFormVinos;
  httpFormVinos.send(null);
}

function useHttpResponseFormVinos() {
   if (httpFormVinos.readyState == 4) {
    if(httpFormVinos.status == 200) {
      var miTextoFormVinos = httpFormVinos.responseText;
      document.getElementById('central_divisions_generic_response').innerHTML = miTextoFormVinos;
	 
    }
  } else {
  document. getElementById('central_divisions_generic_response').innerHTML = '<img src="../../img/loading_p.gif" />';
  }
}
//FIN FUNCIÓN PROCESAR FORMULARIO






<!-- CLUB DE QUESOS -->

//FUNCIÓN PROCESAR FORMULARIO
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpFormQuesos = getXMLHTTPRequest();

function procesarFormQuesos() {
var nombre,direccion,provincia,poblacion,pais,codigopostal,telefono,email,apellidos,modo_pago,registro;
registro = document.getElementById('registro');
nombre = document.getElementById('nombre').value;
direccion = document.getElementById('direccion').value; 
provincia = document.getElementById('provincia').value; 
poblacion = document.getElementById('poblacion').value;
pais = document.getElementById('pais').value;
codigopostal = document.getElementById('codigopostal').value; 
telefono = document.getElementById('telefono').value; 
email = document.getElementById('email').value; 
apellidos = document.getElementById('apellidos').value;
antirand='cero';
  
  var myurlFormQuesos = '../../ajax/procesar_form_club_quesos.php?nombre=' + nombre +'&direccion='+ direccion + '&provincia='+ provincia + '&poblacion='+ poblacion + '&pais='+ pais + '&codigopostal='+ codigopostal + '&telefono='+ telefono + '&email='+ email +'&apellidos='+ apellidos +'&antirand='+ antirand;
  myRandFormQuesos = parseInt(Math.random()*999999999999999);
  var modurlFormQuesos = myurlFormQuesos+"?rand="+myRandFormQuesos;
  httpFormQuesos.open("GET", modurlFormQuesos, true);
  httpFormQuesos.onreadystatechange = useHttpResponseFormQuesos;
  httpFormQuesos.send(null);
}

function useHttpResponseFormQuesos() {
   if (httpFormQuesos.readyState == 4) {
    if(httpFormQuesos.status == 200) {
      var miTextoFormQuesos = httpFormQuesos.responseText;
      document.getElementById('central_divisions_generic_response').innerHTML = miTextoFormQuesos;
	 
    }
  } else {
  document. getElementById('central_divisions_generic_response').innerHTML = '<img src="../../img/loading_p.gif" />';
  }
}
//FIN FUNCIÓN PROCESAR FORMULARIO





//FUNCIÓN VALIDAR MAIL
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpMail = getXMLHTTPRequest();


function comprobarMailClubs() {
var email,registro;
registro = document.getElementById('registro');
email = document.getElementById('email').value; 
antirand='cero';
  
  var myurlMail = '../../ajax/comprobar_email_clubs.php?email=' + email +'&antirand='+ antirand;
  myRandMail = parseInt(Math.random()*999999999999999);
  var modurlMail = myurlMail+"?rand="+myRandMail;
  httpMail.open("GET", modurlMail, true);
  httpMail.onreadystatechange = useHttpResponseMail;
  httpMail.send(null);
}

function useHttpResponseMail() {
   if (httpMail.readyState == 4) {
    if(httpMail.status == 200) {
      var miTextoMail = httpMail.responseText;
      document.getElementById('comprobar_email').innerHTML = miTextoMail;
    }
  } else {
  document. getElementById('comprobar_email').innerHTML = '<img src="../../img/loading.gif" />';
  }
}
//FIN FUNCIÓN VALIDAR MAIL




//FUNCIÓN VALIDAR TELÉFONO
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpDni = getXMLHTTPRequest();


function comprobarTelefono() {
var telefono,registro;
registro = document.getElementById('registro');
telefono = document.getElementById('telefono').value; 
antirand='cero';
  
  var myurlDni = '../../ajax/comprobar_telefono.php?telefono=' + telefono +'&antirand='+ antirand;
  myRandDni = parseInt(Math.random()*999999999999999);
  var modurlDni = myurlDni+"?rand="+myRandDni;
  httpDni.open("GET", modurlDni, true);
  httpDni.onreadystatechange = useHttpResponseDni;
  httpDni.send(null);
}

function useHttpResponseDni() {
   if (httpDni.readyState == 4) {
    if(httpDni.status == 200) {
      var miTextoDni = httpDni.responseText;
      document.getElementById('comprobar_telefono').innerHTML = miTextoDni;
    }
  } else {
  document. getElementById('comprobar_telefono').innerHTML = '<img src="../../img/loading.gif" />';
  }
}
//END FUNCIÓN VALIDAR TELÉFONO


<!-- END CLUB DE VINOS -->


<!-- SISTEMA DE COMENTARIOS 

if ( typeof XMLHttpRequest == "undefined" )
XMLHttpRequest = function(){
return new ActiveXObject(
navigator.userAgent.indexOf("MSIE 5?") >= 0 ?
"Microsoft.XMLHTTP" : "Msxml2.XMLHTTP"
);
};

var ajax=new XMLHttpRequest();

function procesarComentario()
{
	
var idopinion=document.getElementById("tuidopinion").value;
var idproducto = document.getElementById('tuidproducto').value;
var usuario = document.getElementById('tunombre').value;
var comentario=document.getElementById("tucomentario").value;
var code = document.getElementById('code').value; 
var antirand="1";

ajax.open("POST","../ajax/procesar_comentario.php",true);
ajax.onreadystatechange=function(){
if(ajax.readyState==4)
{
var respuesta=ajax.responseText;
document.getElementById("respuesta_comentario").innerHTML=respuesta;
}
}
ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ajax.send('../ajax/procesar_comentario.php?antirand=' + antirand +'&idopinion='+ idopinion +'&idproducto='+ idproducto +'&usuario='+ usuario +'&comentario='+ comentario +'&code='+ code);
}
//FIN ENVIAR COMENTARIO







<!-- SISTEMA DE OPINIONES 

if ( typeof XMLHttpRequest == "undefined" )
XMLHttpRequest = function(){
return new ActiveXObject(
navigator.userAgent.indexOf("MSIE 5?") >= 0 ?
"Microsoft.XMLHTTP" : "Msxml2.XMLHTTP"
);
};

var ajax=new XMLHttpRequest();


function procesarOpinion()
{
	

var idproducto = document.getElementById('miidproducto').value;
var nombredeusuario = document.getElementById('minombredeusuario').value;
var titulo=document.getElementById("mititulo").value;
var opinion=document.getElementById("miopinion").value;
var categoria=document.getElementById("micategoria").value;
var nombreproducto=document.getElementById("minombreproducto").value;
var empresa=document.getElementById("miempresa").value;
var user_name=document.getElementById("miuser_name").value;
var calificacion=document.getElementById("calif").value;
var code = document.getElementById('code').value; 
var antirand="1";

ajax.open("POST","../ajax/procesar_opinion.php",true);
ajax.onreadystatechange=function(){
if(ajax.readyState==4)
{
var respuesta=ajax.responseText;
document.getElementById("respuesta_opinion").innerHTML=respuesta;
}
}
ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ajax.send('../ajax/procesar_opinion.php?antirand=' + antirand +'&idproducto='+ idproducto +'&nombredeusuario='+ nombredeusuario +'&titulo='+ titulo +'&user_name='+ user_name +'&opinion='+ opinion +'&categoria='+ categoria +'&nombreproducto='+ nombreproducto +'&empresa='+ empresa +'&calificacion='+ calificacion +'&code='+ code);
}

//FIN ENVIAR OPINIÓN



//LIMITAR CARACTERES
function checklength()
{

var max = 200;
var txt;
txt=document.getElementById('comentario');
var n = txt.value.length;
if (n>max) //i is the maxlength of textarea which we have set to 80
{ 
txt.value = txt.value.substring(0, max); 
return false;
}
}

//LIMITAR CARACTERES
function checklengthforo()
{

var max = 500;
var txt;
txt=document.getElementById('comentario');
var n = txt.value.length;
if (n>max) //i is the maxlength of textarea which we have set to 80
{ 
txt.value = txt.value.substring(0, max); 
return false;
}
}




//FUNCIÓN VOTAR PRODUCTO
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpVoto = getXMLHTTPRequest();


function comprobarVoto(idproductovoto,idusuario_voto) {

productovoto = idproductovoto;
usuario_voto = idusuario_voto;
calificacion = document.getElementById('calif').value;
antirand='cero';
  
  var myurlVoto = '../ajax/response_voto.php?productovoto=' + productovoto +'&usuario_voto='+ usuario_voto +'&calificacion='+ calificacion +'&antirand='+ antirand;
  myRandVoto = parseInt(Math.random()*999999999999999);
  var modurlVoto = myurlVoto+"?rand="+myRandVoto;
  httpVoto.open("GET", modurlVoto, true);
  httpVoto.onreadystatechange = useHttpResponseVoto;
  httpVoto.send(null);
}

function useHttpResponseVoto() {
   if (httpVoto.readyState == 4) {
    if(httpVoto.status == 200) {
      var miTextoVoto = httpVoto.responseText;
      document.getElementById('votacion').innerHTML = miTextoVoto;
    }
  } else {
  document. getElementById('votacion').innerHTML = '<img src="../img/loading_p.gif" />';
  }
}
//END FUNCIÓN VOTAR PRODUCTO






//PAGINADOR AJAX

// JavaScript Document

function objetoAjax(){
 var xmlhttp=false;
  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 Pagina(nropagina,id){
 //donde se mostrará los registros
 divContenido = document.getElementById('central_divisions_generic_foro');
 id_producto=id;
 ajax=objetoAjax();
 //uso del medoto GET
 //indicamos el archivo que realizará el proceso de paginar
 //junto con un valor que representa el nro de pagina
 ajax.open("GET", "paginador.php?pag="+nropagina +'&id_producto='+ id_producto);
 divContenido.innerHTML= '<img src="../../img/loading.gif">';
 ajax.onreadystatechange=function() {
  if (ajax.readyState==4) {
   //mostrar resultados en esta capa, en este caso la llamada con el Id 'contenido'
   divContenido.innerHTML = ajax.responseText
  }
 }
 //como hacemos uso del metodo GET
 //colocamos null ya que enviamos 
 //el valor por la url ?pag=nropagina
 ajax.send(null)
}

// END PAGINADOR AJAX



<!-- SISTEMA DE AFILIADOS -->

//REGISTRO AFILIADOS
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpFormR = getXMLHTTPRequest();

function procesarFormR() {
var nombre_afiliado,password,email,url,registro;
registro = document.getElementById('registro');
nombre_afiliado = document.getElementById('nombre_afiliado').value;
email = document.getElementById('email').value; 
url = document.getElementById('url').value; 
password = document.getElementById('password').value; 
antirand='cero';
  
  var myurlFormR = 'procesar_form.php?nombre_afiliado=' + nombre_afiliado +'&email='+ email +'&url='+ url + '&password='+ password +'&antirand='+ antirand;
  myRandFormR = parseInt(Math.random()*999999999999999);
  var modurlFormR = myurlFormR+"?rand="+myRandFormR;
  httpFormR.open("GET", modurlFormR, true);
  httpFormR.onreadystatechange = useHttpResponseFormR;
  httpFormR.send(null);
}

function useHttpResponseFormR() {
   if (httpFormR.readyState == 4) {
    if(httpFormR.status == 200) {
      var miTextoFormR = httpFormR.responseText;
      document.getElementById('enviado').innerHTML = miTextoFormR;
    }
  } else {
  document. getElementById('enviado').innerHTML = '<img src="../img/loading_p.gif" />';
  }
}
//END REGISTRO AFILIADOS








//COMPONER PANEL
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpForma = getXMLHTTPRequest();

function procesarForma() {
var color_fondo,color_fuente,titulo_panel,fondo_titulo,color_titulo,color_borde,estilo_panel,fuente,id,registro;

registro = document.getElementById('registro');
color_fondo = document.getElementById('color_fondo').value;
color_fuente = document.getElementById('color_fuente').value;
color_titulo = document.getElementById('color_titulo').value;
color_borde = document.getElementById('color_borde').value;
estilo_panel = document.getElementById('estilo_panel').value;
titulo_panel = document.getElementById('titulo_panel').value;
fondo_titulo = document.getElementById('fondo_titulo').value;
id = document.getElementById('id').value;
fuente = document.getElementById('fuente').value; 
 
antirand='cero';
  
  var myurlForma = 'refresh.php?color_fondo=' + color_fondo +'&fuente='+ fuente +'&color_fuente='+ color_fuente +'&color_titulo='+ color_titulo +'&color_borde='+ color_borde +'&estilo_panel='+ estilo_panel+'&titulo_panel='+ titulo_panel +'&fondo_titulo='+ fondo_titulo +'&id='+ id +'&antirand='+ antirand;
  myRandForma = parseInt(Math.random()*999999999999999);
  var modurlForma = myurlForma+"?rand="+myRandForma;
  httpForma.open("GET", modurlForma, true);
  httpForma.onreadystatechange = useHttpResponseForma;
  httpForma.send(null);
}

function useHttpResponseForma() {
   if (httpForma.readyState == 4) {
    if(httpForma.status == 200) {
      var miTextoForma = httpForma.responseText;
      document.getElementById('vista_previa').innerHTML = miTextoForma;
    }
  } else {
  document. getElementById('vista_previa').innerHTML = '<img src="../img/loading.gif" />';
  }
}
// END COMPONER PANEL


<!-- END SISTEMA DE AFILIADOS -->







// <!-- VERSIÓN 2 -->




<!-- FUNCIÓN ALTA BOLETÍN-->
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpForm = getXMLHTTPRequest();

function altaBoletin() {
var email;


idemail = document.getElementById('email_boletin').value;
antirand='cero';
  
  var myurlForm = '../ajax/response_boletin.php?idemail=' + idemail +'&antirand='+ antirand;
  myRandForm = parseInt(Math.random()*999999999999999);
  var modurlForm = myurlForm+"?rand="+myRandForm;
  httpForm.open("GET", modurlForm, true);
  httpForm.onreadystatechange = useHttpResponseForm;
  httpForm.send(null);
}

function useHttpResponseForm() {
   if (httpForm.readyState == 4) {
    if(httpForm.status == 200) {
      var miTextoForm = httpForm.responseText;
      document.getElementById('response_boletin').innerHTML = miTextoForm;
    }
  } else {
  document. getElementById('response_boletin').innerHTML = '<img src="../img/loading_p.gif" />';
  }
}
<!-- END FUNCIÓN ALTA BOLETÍN-->




//FUNCIÓN VALORAR OPINIÓN
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpOpinion = getXMLHTTPRequest();


function valorarOpinion(iddiv,idopinion) {
div = iddiv;
opinion = idopinion;

antirand='cero';
  
  var myurlOpinion = '../ajax/response_opinion.php?opinion=' + opinion +'&antirand='+ antirand;
  myRandOpinion = parseInt(Math.random()*999999999999999);
  var modurlOpinion = myurlOpinion+"?rand="+myRandOpinion;
  httpOpinion.open("GET", modurlOpinion, true);
  httpOpinion.onreadystatechange = useHttpResponseOpinion;
  httpOpinion.send(null);
}

function useHttpResponseOpinion() {
   if (httpOpinion.readyState == 4) {
    if(httpOpinion.status == 200) {
      var miTextoOpinion = httpOpinion.responseText;
      document.getElementById(div).innerHTML = miTextoOpinion;
    }
  } else {
  document. getElementById(div).innerHTML = '<img src="../img/loading_p.gif" />';
  }
}
//END FUNCIÓN VALORAR OPINIÓN





// FUNCIÓN CRITIC OPINIÓN
function criticaOpinion(iddiv,idopinion) {
div = iddiv;
opinion = idopinion;

antirand='cero';
  
  var myurlOpinion = '../ajax/response_critica.php?opinion=' + opinion +'&antirand='+ antirand;
  myRandOpinion = parseInt(Math.random()*999999999999999);
  var modurlOpinion = myurlOpinion+"?rand="+myRandOpinion;
  httpOpinion.open("GET", modurlOpinion, true);
  httpOpinion.onreadystatechange = useHttpResponseOpinion;
  httpOpinion.send(null);
}

function useHttpResponseOpinion() {
   if (httpOpinion.readyState == 4) {
    if(httpOpinion.status == 200) {
      var miTextoOpinion = httpOpinion.responseText;
      document.getElementById(div).innerHTML = miTextoOpinion;
    }
  } else {
  document. getElementById(div).innerHTML = '<img src="../img/loading_p.gif" />';
  }
}









//FUNCIÓN VALORAR COMENTARIO
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpComentario = getXMLHTTPRequest();


function valorarComentario(iddiv,idcomentario) {
div = iddiv;
comentario = idcomentario;

antirand='cero';
  
  var myurlComentario = '../ajax/response_comentario.php?comentario=' + comentario +'&antirand='+ antirand;
  myRandComentario = parseInt(Math.random()*999999999999999);
  var modurlComentario = myurlComentario+"?rand="+myRandComentario;
  httpComentario.open("GET", modurlComentario, true);
  httpComentario.onreadystatechange = useHttpResponseComentario;
  httpComentario.send(null);
}

function useHttpResponseComentario() {
   if (httpComentario.readyState == 4) {
    if(httpComentario.status == 200) {
      var miTextoComentario = httpComentario.responseText;
      document.getElementById(div).innerHTML = miTextoComentario;
    }
  } else {
  document. getElementById(div).innerHTML = '<img src="../img/loading_p.gif" />';
  }
}
//END FUNCIÓN VALORAR COMENTARIO









//FUNCIÓN CRÍTICA COMENTARIO
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpComentario = getXMLHTTPRequest();


function criticaComentario(iddiv,idcomentario) {
div = iddiv;
comentario = idcomentario;

antirand='cero';
  
  var myurlComentario = '../ajax/critica_comentario.php?comentario=' + comentario +'&antirand='+ antirand;
  myRandComentario = parseInt(Math.random()*999999999999999);
  var modurlComentario = myurlComentario+"?rand="+myRandComentario;
  httpComentario.open("GET", modurlComentario, true);
  httpComentario.onreadystatechange = useHttpResponseComentario;
  httpComentario.send(null);
}

function useHttpResponseComentario() {
   if (httpComentario.readyState == 4) {
    if(httpComentario.status == 200) {
      var miTextoComentario = httpComentario.responseText;
      document.getElementById(div).innerHTML = miTextoComentario;
    }
  } else {
  document. getElementById(div).innerHTML = '<img src="../img/loading_p.gif" />';
  }
}
//END FUNCIÓN CRÍTICA COMENTARIO




//FUNCIÓN DELETE CARRITO
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpdelete = getXMLHTTPRequest();


function deleteCarrito(idcompra,idproducto,iduser,iddiv) {
id_compra = idcompra;
producto = idproducto;
user = iduser;
div=iddiv;
antirand='cero';
  
  var myurldelete = '../ajax/response_delete_carrito.php?id_compra=' + id_compra +'&producto='+ producto +'&user='+ user +'&antirand='+ antirand;
  myRanddelete = parseInt(Math.random()*999999999999999);
  var modurldelete = myurldelete+"?rand="+myRanddelete;
  httpdelete.open("GET", modurldelete, true);
  httpdelete.onreadystatechange = useHttpResponsedelete;
  httpdelete.send(null);
}

function useHttpResponsedelete() {
   if (httpdelete.readyState == 4) {
    if(httpdelete.status == 200) {
      var miTextodelete = httpdelete.responseText;
      document.getElementById(div).innerHTML = miTextodelete;
    }
  } else {
  document. getElementById(div).innerHTML = '<img src="../img/loading_p.gif" />';
  }
}
//END FUNCIÓN DELETE CARRITO







//FUNCIÓN ACTUALIZAR TOTAL COMPRA
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpact = getXMLHTTPRequest();


function actualizarCarrito(idcompra,iduser) {
id_compra = idcompra;
user = iduser;
antirand='cero';
  
  var myurlact = '../ajax/response_total_compra.php?id_compra=' + id_compra +'&user='+ user +'&antirand='+ antirand;
  myRandact = parseInt(Math.random()*999999999999999);
  var modurlact = myurlact+"?rand="+myRandact;
  httpact.open("GET", modurlact, true);
  httpact.onreadystatechange = useHttpResponseact;
  httpact.send(null);
}

function useHttpResponseact() {
   if (httpact.readyState == 4) {
    if(httpact.status == 200) {
      var miTextoact = httpact.responseText;
      document.getElementById("subtotal_compra").innerHTML = miTextoact;
    }
  } else {
  document. getElementById("subtotal_compra").innerHTML = '';
  }
}
//END FUNCIÓN ACTUALIZAR TOTAL COMPRA




//FUNCIÓN MODOS PAGO
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpdataPersonal = getXMLHTTPRequest();


function modoPago() {
var nombre,apellidos,direccion,telefono,provincia,poblacion,codigo_postal,idpais,idtotal,idemail,idcupon;

nombre=document.getElementById('nombre').value;
apellidos=document.getElementById('apellidos').value;
direccion=document.getElementById('direccion').value;
telefono=document.getElementById('telefono').value;
provincia=document.getElementById('provincia').value;
poblacion=document.getElementById('poblacion').value;
codigo_postal=document.getElementById('codigo_postal').value;
idpais=document.getElementById('pais').value;
idtotal=document.getElementById('idtotal').value;
idemail=document.getElementById('idemail').value;
idcupon=document.getElementById('cupon').value;
antirand='cero';
  
  var myurldataPersonal = '../ajax/response_modos_pago.php?idemail=' + idemail +'&nombre='+ nombre +'&apellidos='+ apellidos +'&direccion='+ direccion +'&telefono='+ telefono +'&provincia='+ provincia +'&poblacion='+ poblacion +'&codigo_postal='+ codigo_postal +'&idpais='+ idpais +'&idtotal='+ idtotal +'&idemail='+ idemail +'&idcupon='+ idcupon +'&antirand='+ antirand;
  myRanddataPersonal = parseInt(Math.random()*999999999999999);
  var modurldataPersonal = myurldataPersonal+"?rand="+myRanddataPersonal;
  httpdataPersonal.open("GET", modurldataPersonal, true);
  httpdataPersonal.onreadystatechange = useHttpResponsedataPersonal;
  httpdataPersonal.send(null);
}

function useHttpResponsedataPersonal() {
   if (httpdataPersonal.readyState == 4) {
    if(httpdataPersonal.status == 200) {
      var miTextodataPersonal = httpdataPersonal.responseText;
      document.getElementById('response_modos_pago').innerHTML = miTextodataPersonal;
    }
  } else {
  document. getElementById('response_modos_pago').innerHTML = '<img src="../img/loading_p.gif" />';
  }
}
//FIN FUNCIÓN MODOS PAGO





//FUNCIÓN RECLAMAR PAGO AFILIADOS
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httpdataRecl = getXMLHTTPRequest();


function ReclPago() {
var nombre,apellidos,direccion,telefono,idemail,idcuenta,idafiliado;

nombre=document.getElementById('nombre').value;
apellidos=document.getElementById('apellidos').value;
direccion=document.getElementById('direccion').value;
telefono=document.getElementById('telefono').value;
idemail=document.getElementById('idemail').value;
idcuenta=document.getElementById('idcuenta').value;
idafiliado=document.getElementById('idafiliado').value;
antirand='cero';
  
  var myurldataRecl = '../ajax/response_modos_afiliados.php?idemail=' + idemail +'&nombre='+ nombre +'&apellidos='+ apellidos +'&direccion='+ direccion +'&telefono='+ telefono +'&idemail='+ idemail +'&idafiliado='+ idafiliado +'&idcuenta='+ idcuenta +'&antirand='+ antirand;
  myRanddataRecl = parseInt(Math.random()*999999999999999);
  var modurldataRecl = myurldataRecl+"?rand="+myRanddataRecl;
  httpdataRecl.open("GET", modurldataRecl, true);
  httpdataRecl.onreadystatechange = useHttpResponsedataRecl;
  httpdataRecl.send(null);
}

function useHttpResponsedataRecl() {
   if (httpdataRecl.readyState == 4) {
    if(httpdataRecl.status == 200) {
      var miTextodataRecl = httpdataRecl.responseText;
      document.getElementById('response_modos_pago').innerHTML = miTextodataRecl;
    }
  } else {
  document. getElementById('response_modos_pago').innerHTML = '<img src="../img/loading_p.gif" />';
  }
}
//FIN FUNCIÓN RECLAMAR PAGO AFILIADOS

//FUNCIÓN RECOMENDAR PRODUCTO
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httprecomendarProducto = getXMLHTTPRequest();


function recomendarProducto() {
var idyourname,idyourmail,idhisname,idhismail,idyourmessage,idproducto;
idyourname = document.getElementById('yourname').value;
idyourmail = document.getElementById('yourmail').value;
idhisname = document.getElementById('hisname').value;
idhismail = document.getElementById('hismail').value;
idyourmessage = document.getElementById('yourmessage').value;
idproducto = document.getElementById('idproducto').value;
antirand='cero';
  
  var myurlrecomendarProducto = '../ajax/response_recomendar_producto.php?idyourname=' + idyourname +'&idyourmail='+ idyourmail +'&idhisname='+ idhisname 
  +'&idhismail='+ idhismail +'&idyourmessage='+ idyourmessage +'&idproducto='+ idproducto +'&antirand='+ antirand;
  myRandrecomendarProducto = parseInt(Math.random()*999999999999999);
  var modurlrecomendarProducto = myurlrecomendarProducto+"?rand="+myRandrecomendarProducto;
  httprecomendarProducto.open("GET", modurlrecomendarProducto, true);
  httprecomendarProducto.onreadystatechange = useHttpResponserecomendarProducto;
  httprecomendarProducto.send(null);
}

function useHttpResponserecomendarProducto() {
   if (httprecomendarProducto.readyState == 4) {
    if(httprecomendarProducto.status == 200) {
      var miTextorecomendarProducto = httprecomendarProducto.responseText;
      document.getElementById('central_divisions_generic_response').innerHTML = miTextorecomendarProducto;
    }
  } else {
  document. getElementById('central_divisions_generic_response').innerHTML = '';
  }
}
//FUNCIÓN RECOMENDAR PRODUCTO




//FUNCIÓN RECOMENDAR
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var httprecomendarPagina = getXMLHTTPRequest();


function recomendarPagina() {
var email1,email2,email3,idyourmessage;
email1 = document.getElementById('email1').value;
email2 = document.getElementById('email2').value;
email3 = document.getElementById('email3').value;
idyourmessage = document.getElementById('yourmessage').value;
antirand='cero';
  
  var myurlrecomendarPagina = '../ajax/respuesta_compartir_email.php?email1=' + email1 + '&email2='+ email2 + '&email3='+ email3 + '&idyourmessage='+ idyourmessage +'&antirand='+ antirand;
  myRandrecomendarPagina = parseInt(Math.random()*999999999999999);
  var modurlrecomendarPagina = myurlrecomendarPagina+"?rand="+myRandrecomendarPagina;
  httprecomendarPagina.open("GET", modurlrecomendarPagina, true);
  httprecomendarPagina.onreadystatechange = useHttpResponserecomendarPagina;
  httprecomendarPagina.send(null);
}

function useHttpResponserecomendarPagina() {
   if (httprecomendarPagina.readyState == 4) {
    if(httprecomendarPagina.status == 200) {
      var miTextorecomendarPagina = httprecomendarPagina.responseText;
      document.getElementById('central_divisions_generic_response').innerHTML = miTextorecomendarPagina;
    }
  } else {
  document. getElementById('central_divisions_generic_response').innerHTML = '';
  }
}
//FUNCIÓN RECOMENDAR 


