function cambiafoto(name,stado,ext,bajar,nameIMG) { ruta = ""; imgFoto = name; if(nameIMG) { imgFoto = nameIMG } if(bajar) { ruta = "../"; } document.images[imgFoto].src = ruta+"images/"+name+stado+"."+ext; } function showSobre(id) { dv = document.getElementById("sobre"+id); ast = document.getElementById("switch"+id); if(dv.style.display == "none") { dv.style.display = "block"; ast.setAttribute("class", "on"); }else{ dv.style.display = "none"; ast.setAttribute("class", "off"); } } function cambiaVideo(code) { document.getElementById("flashcontent").cargarVideo(code); //parent.helper.document.location = "updPhoto.php?n=La guarra de las galaxias&p="+imgToUPD; } function getXMLHttpRequest(){ var Versiones = [ "MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp","Microsoft.XMLHttp"]; var aVersions = [ "MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp","Microsoft.XMLHttp"]; if (window.XMLHttpRequest){ return new XMLHttpRequest(); } else if(window.ActiveXObject){ for(var i = 0; i < aVersions.length; i++){ try{ var oXmlHttp = new ActiveXObject(aVersions[i]); return oXmlHttp; } catch(error){ } } } } function paginaVideos(pag) { var xmlhttp = getXMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { document.getElementById("videosCatalogo").innerHTML = xmlhttp.responseText; } } xmlhttp.open("POST", "paginaVideos.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send("pagActual="+pag); } function paginaCatalogo(pag,tag) { var xmlhttp = getXMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { document.getElementById("Catalogo").innerHTML = xmlhttp.responseText; } } xmlhttp.open("POST", "paginaCatalogo.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send("pagActual="+pag+"&tag="+tag); } function paginaSearch(pag,word) { var xmlhttp = getXMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { document.getElementById("Catalogo").innerHTML = xmlhttp.responseText; } } xmlhttp.open("POST", "paginaSearch.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send("pagActual="+pag+"&word="+word); } function controlBoletin() { formu = document.fBoletin; if((formu.mail.value != "")&&(formu.mail.value != "email")&&(formu.password.value != "")&&(formu.password.value != "contraseña")) { var xmlhttp = getXMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { document.getElementById("datosBoletin").innerHTML = xmlhttp.responseText; } } xmlhttp.open("POST", "insertBoletin.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send("email="+formu.mail.value+"&pwd="+formu.password.value); } } function backBoletin() { html = '
' + '
' + '' + '' + '' + '
' + '
'; document.getElementById("datosBoletin").innerHTML = html; } function controlComment() { formu = document.fComent; divError = document.getElementById("ErrorCommentDIV"); divError.style.display = "none"; if((formu.nombre.value != "")&&(formu.email.value != "")&&(formu.comment.value != "")&&(formu.comment.value != "Tu opinión")) { if(isEMailAddr(formu.email.value)) { formu.submit(); }else{ divError.innerHTML = "El email no es correcto"; divError.style.display = "block"; } } } function showEstrellas(idestrella,to) { for(i=1;i<6;i++) { var stateStar = "Off"; if(i<=to) { stateStar = "On"; } var idStar = "star"+idestrella+"-"+i; document.images[idStar].src = "images/stel"+stateStar+".jpg"; } } var idMensajeMostrado = ""; function voteFilm(idpeli,tipo,votacion) { var xmlhttp = getXMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { if(idMensajeMostrado!="") { document.getElementById("sms"+idMensajeMostrado).style.display = "none"; } if(xmlhttp.responseText != "0") { document.getElementById("sms"+idpeli).innerHTML = "Voto registrado"; document.getElementById("sms"+idpeli).style.display = "block"; document.getElementById("stars"+idpeli).innerHTML = xmlhttp.responseText; }else{ document.getElementById("sms"+idpeli).innerHTML = "Ya has votado por esta película"; document.getElementById("sms"+idpeli).style.display = "block"; } idMensajeMostrado = idpeli; } } xmlhttp.open("POST", "votefilm.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send("id="+idpeli+"&tipo="+tipo+"&voto="+votacion); } /* FUNC CARRITO */ function showBTCarrito(id,estado) { if(estado) { document.getElementById("carrito"+id).className = "priceOn"; }else{ document.getElementById("carrito"+id).className = "price"; } } function addCart(idPelicula) { var xmlhttp = getXMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { document.getElementById("cestaBox").innerHTML = xmlhttp.responseText; } } xmlhttp.open("POST", "addCart.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send("id="+idPelicula); } function actCesta(idPelicula,inc) { /*var xmlhttp = getXMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { document.getElementById("cestaDIV").innerHTML = xmlhttp.responseText; } } xmlhttp.open("POST", "actCart.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send("id="+idPelicula+"&acc="+inc); */ document.fActCesta.idpelicula.value = idPelicula; document.fActCesta.acc.value = inc; document.fActCesta.submit(); } function controlDireccion(value) { form = document.datosUser; form.nombre_envio.value = ""; form.direccion_envio.value = ""; form.cp_envio.value = ""; form.ciudad_envio.value = ""; form.provincia_envio.value = ""; if(value) { form.nombre_envio.value = form.nombre.value; form.direccion_envio.value = form.direccion.value; form.cp_envio.value = form.cp.value; form.ciudad_envio.value = form.ciudad.value; form.provincia_envio.value = form.provincia.value; } } function controlDatosEnvio() { form = document.datosUser; divError = document.getElementById("ErrorID"); divError.style.display = "none"; if((form.nombre.value == "")||(form.direccion.value == "")||(form.cp.value == "")||(form.ciudad.value == "")||(form.mail.value == "")||(form.telf.value == "")||(form.nombre_envio.value == "")||(form.direccion_envio.value == "")||(form.cp_envio.value == "")||(form.ciudad_envio.value == "")) { divError.innerHTML = "Todos los datos son obligatorios"; divError.style.display = "block"; }else{ if(isEMailAddr(form.mail.value)) { form.submit(); }else{ divError.innerHTML = "El email no es correcto"; divError.style.display = "block"; } } } function isEMailAddr(elem) { var str = elem; var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/; if (!str.match(re)) { return false; } else { return true; } } function logoutUser() { var xmlhttp = getXMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { document.datosUser.idUser.value = ""; document.datosUser.mail.value = ""; divError = document.getElementById("ErrorID"); divError.style.display = "none"; divSafe = document.getElementById("guardaDatosDIV"); divSafe.style.display = "block"; document.getElementById("accesoDIV").innerHTML = xmlhttp.responseText; } } xmlhttp.open("POST", "logoutUser.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send(""); } function logoutUserCuenta() { document.location = "logoutUser.php?redirect=1"; } function loginUser() { if((document.fLogin.email.value != "")&&(document.fLogin.pass.value != "")) { var xmlhttp = getXMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { divError = document.getElementById("ErrorID"); divError.style.display = "none"; if(xmlhttp.responseText != "Error") { document.getElementById("accesoDIV").innerHTML = xmlhttp.responseText; divError = document.getElementById("ErrorID"); divError.style.display = "none"; divSafe = document.getElementById("guardaDatosDIV"); divSafe.style.display = "none"; getUserData(); }else{ divError.innerHTML = "Error en los datos de acceso"; divError.style.display = "block"; } } } xmlhttp.open("POST", "loginUser.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send("e="+document.fLogin.email.value+"&p="+document.fLogin.pass.value); } } function loginBox() { if((document.fCuenta.email.value != "")&&(document.fCuenta.password.value != "")&&(document.fCuenta.password.value != "contraseña")&&(document.fCuenta.email.value != "email")) { //alert("OK"); var xmlhttp = getXMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { //alert(xmlhttp.responseText); if(xmlhttp.responseText != "Error") { document.getElementById("userBOX").innerHTML = xmlhttp.responseText; } } } xmlhttp.open("POST", "loginUserBox.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send("e="+document.fCuenta.email.value+"&p="+document.fCuenta.password.value); } } function getUserData() { var xmlhttp = getXMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { document.getElementById("datosUserDIV").innerHTML = xmlhttp.responseText; var xmlhttp2 = getXMLHttpRequest(); xmlhttp2.onreadystatechange = function() { if (xmlhttp2.readyState == 4) { document.datosUser.provincia.value = xmlhttp2.responseText; } } xmlhttp2.open("POST", "getUserProvincia.php", true); xmlhttp2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp2.send(""); } } xmlhttp.open("POST", "getUserData.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send(""); } function requestUserData() { var xmlhttp = getXMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { divError = document.getElementById("ErrorID"); divError.style.display = "none"; if(xmlhttp.responseText!="Error") { document.getElementById("requestDiv").innerHTML = xmlhttp.responseText; }else{ divError.innerHTML = "Este email no está registrado"; divError.style.display = "block"; } } } xmlhttp.open("POST", "requestMail.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send("e="+document.fRequest.mail_recordar.value); } function showRegistro() { divForm = document.getElementById("datosUserDIV"); divForm.style.display = "none"; var innerH = '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '


' divForm.innerHTML = innerH; divForm.style.display = "block"; } function loginUserCuenta() { if((document.fLogin.email.value != "")&&(document.fLogin.pass.value != "")) { var xmlhttp = getXMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { divError = document.getElementById("ErrorID2"); divError.style.display = "none"; if(xmlhttp.responseText != "Error") { document.getElementById("datosUserDIV").innerHTML = xmlhttp.responseText; getFacturacion(); divDatos = document.getElementById("cuentaDIV"); divDatos.innerHTML = '



Bienvenido

Aquí tienes tus datos.

¿Quieres salir de esta cuenta?

Realiza la compra con otra cuenta diferente.

'; divError = document.getElementById("ErrorID2"); divError.style.display = "none"; //getUserData(); }else{ divError.innerHTML = "Error en los datos de acceso"; divError.style.display = "block"; } } } xmlhttp.open("POST", "loginUserCuenta.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send("e="+document.fLogin.email.value+"&p="+document.fLogin.pass.value); } } function getFacturacion() { var xmlhttp2 = getXMLHttpRequest(); xmlhttp2.onreadystatechange = function() { if (xmlhttp2.readyState == 4) { document.getElementById("datosFacturacion").style.display = "block"; document.getElementById("datosFacturacion").innerHTML = xmlhttp2.responseText; } } xmlhttp2.open("POST", "loginUserCuentaFactura.php", true); xmlhttp2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp2.send("e="+document.fLogin.email.value+"&p="+document.fLogin.pass.value); } function saveData() { formu = document.datosUser; divError = document.getElementById("ErrorID"); divError.style.display = "none"; if((formu.nombre.value == "")||(formu.direccion.value == "")||(formu.cp.value == "")||(formu.ciudad.value == "")||(formu.mail.value == "")||(formu.telf.value == "")) { divError.innerHTML = "Todos los datos son obligatorios"; divError.style.display = "block"; }else{ if(isEMailAddr(formu.mail.value)) { //Comprobamos que no exista el email. var xmlhttp = getXMLHttpRequest(); xmlhttp.onreadystatechange = function() { divError = document.getElementById("ErrorID"); divError.style.display = "none"; if (xmlhttp.readyState == 4) { if(xmlhttp.responseText!="Error") { document.datosUser.submit(); }else{ divError.innerHTML = "Este email ya está en uso"; divError.style.display = "block"; } } } xmlhttp.open("POST", "compruebaMail.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send("e="+formu.mail.value); }else{ divError.innerHTML = "El email no es correcto"; divError.style.display = "block"; } } } function modData() { formu = document.datosUser; divError = document.getElementById("ErrorID"); divError.style.display = "none"; if((formu.nombre.value == "")||(formu.direccion.value == "")||(formu.cp.value == "")||(formu.ciudad.value == "")||(formu.mail.value == "")||(formu.telf.value == "")||(formu.password.value == "")) { divError.innerHTML = "Todos los datos son obligatorios"; divError.style.display = "block"; }else{ if(isEMailAddr(formu.mail.value)) { //Comprobamos que no exista el email. var xmlhttp = getXMLHttpRequest(); xmlhttp.onreadystatechange = function() { divError = document.getElementById("ErrorID"); divError.style.display = "none"; if (xmlhttp.readyState == 4) { if(xmlhttp.responseText!="Error") { document.datosUser.submit(); }else{ divError.innerHTML = "Este email ya está en uso"; divError.style.display = "block"; } } } xmlhttp.open("POST", "compruebaMailCuenta.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send("e="+formu.mail.value+"&u="+formu.idUser.value); }else{ divError.innerHTML = "El email no es correcto"; divError.style.display = "block"; } } } function controlFactura() { formu = document.datosUser; divFact = document.getElementById("datosFactura"); if(divFact.style.display == "none") { divFact.style.display = "block"; }else{ divFact.style.display = "none"; formu.empresa.value = ""; formu.cif.value = ""; } } /* SEARCH TAG */ function searchTag(id) { document.fTags.idtag.value = id; document.fTags.submit(); } /*******************/ function hideShowValorInput(obj,def) { if(obj.value == def) { obj.value = ""; }else{ if(obj.value == "") { obj.value = def; } } }