function login(){ var username = document.getElementById('user').value; var userpass = document.getElementById('password').value; $("#estados").load("index.php?login",{user: username, pass: userpass, login: 1},function(txt) { if(txt=="1") $("#nologin").slideDown("slow"); else window.location=txt; }); }; function addFileInput( elem ) { if($("#file_list li").size()>9) { alert("Solo podrá subir hasta 10 archivos por vez.\nPara subir más archivos vuelva a esta pagina luego de haber cargado estos archivos."); } else { if ( false != elem ) { filepath = elem.value.split("\\"); filename = filepath[filepath.length-1]; extensionpath = filename.split("."); extension = extensionpath[extensionpath.length-1]; if( !extension.match(/(jpg)|(jpeg)|(JPEG)|(JPG)|(Jpeg)|(Jpg)/) ) { alert ( "Sólo se permite subir imágenes en formato JPG" ); return false; } $(elem).hide(); $("#file_list").append("
  • • "+filename+" [x]
  • \n"); $("#file_list li:last").slideDown("slow"); } $("#Submit").get(0).disabled = false; $("#file_inputs").append('\n'); } } function delFile ( el, file ){ $(el.parentNode).remove(); $("#file"+file).remove(); } function submitForm() { $("#submitbt").remove(); $("#load").show(); } function viewImg(pid) { window.open("?previeImage&pid="+pid,"previeImage","width=400,height=407"); }; function addPic(pid) { combo_size = document.getElementById('size-'+pid); combo_paper = document.getElementById('paper-'+pid); combo_copies = document.getElementById('copies-'+pid); sizex = combo_size.options[combo_size.selectedIndex].value; paperx = combo_paper.options[combo_paper.selectedIndex].value; copiesx = combo_copies.options[combo_copies.selectedIndex].value; $("div#copias-"+pid).append('
    Cargando...
    '); $.post("index.php?addCopy",{size: sizex, paper: paperx, copies: copiesx, id: pid},function(txt) { $("div#copias-"+pid).find("div#cargando").remove(); valores = txt.split("@"); $("div#copias-"+pid).append(valores[0]); $("div#preciototal-"+pid).html('$'+valores[2]); }); }; function delPic(pid) { if(confirm('Esta seguro que desea eliminar esta foto?')) { $.post("index.php?delPic",{id: pid},function() { $("div#divpic-"+pid).remove(); }); } }; function delCopy(copyID) { $("div#copy-"+copyID).remove(); }; function delCopy(copyID,pid) { $.post("index.php?delCopy",{cid: copyID, picid: pid},function(txt) { $("div#preciototal-"+pid).html('$'+txt); $("div#copy-"+copyID).remove(); }); }; function register(){ var nombre = document.getElementById('nombre').value; var apellido = document.getElementById('apellido').value; var email = document.getElementById('email').value; var email2 = document.getElementById('emaill').value; var direccion = document.getElementById('direccion').value; var telefono = document.getElementById('telefono').value; var org = document.getElementById('empresa').value; var sex = document.getElementById('sexo').value; var dnii = document.getElementById('dni').value; $("#td_register").html("
    Enviando datos
    "); $.post("index.php?register",{firstname: nombre, lastname: apellido, mail: email, mail2: email2, addr: direccion, tel: telefono, empresa: org, sexo: sex, dni: dnii},function(txt) { if(txt=="1") $("#td_register").html("
    Se te ha enviado un email a tu casilla
    de coreo con la contraseña de acceso
    "); if(txt=="2") $("#td_register").html("
    La dirección de email ingresada ya se
    encuentra registrada por un usuario.
    "); if(txt=="3") $("#td_register").html("
    La dirección de email ingresada no
    es una dirección de email válida.
    "); if(txt=="4") $("#td_register").html("
    Todos los campos son obligatorios.
    "); if(txt=="5") $("#td_register").html("
    Las direcciones de email ingresadas no coinciden.
    "); }); }; function recoverPass() { var mail = document.getElementById('email2').value; $.post("index.php?login",{email: mail, recoveryPasswd: 1},function(txt) { if(txt=="1") $("#passrecovery").html("Se te ha enviado un email a tu casilla de
    coreo con la contraseña de acceso.
    "); else $("#passrecovery").html("El email ingresado no es correcto o no pertenece a un usuario."); }); }; function changePass() { var pass1 = document.getElementById('ps1').value; var pass2 = document.getElementById('ps2').value; if(pass1==pass2) { $.post("index.php?psw",{psw: pass1, changePass: 1},function(txt) { if(txt=="1") $("#newpass").html("
    La contraseña ha sido cambiada.
    "); }); } else { alert("Las contraseñas ingresadas no coinciden"); } }; function sendOrder() { $("div#checking").html("Cargando... Por favor, espere."); $.post("index.php?checkOrder",{oid: '1'},function(txt) { if(txt=="1") { document.getElementById('orderForm').submit(); } else { document.getElementById('branch').selectedIndex=0; alert('Debe agregar al menos una copia por foto o eliminar las fotos que no desea enviar.'); $("div#checking").html(""); } }); };