//CONTACTO //RUTINAS //destEmail var destEmail:String; //MANEJO DE LA TECLA "TAB" nombre_txt.tabIndex = 1; email_txt.tabIndex = 2; asunto_txt.tabIndex = 3; mensaje_txt.tabIndex = 4; //CAMBIO DE ESTADO EN LOS CAMPOS TEXTINPUT nombre_txt.onChanged = function(obj) { aplicarFormato("normal",nombre_txt); }; email_txt.onChanged = function(obj) { aplicarFormato("normal",email_txt); }; asunto_txt.onChanged = function(obj) { aplicarFormato("normal",asunto_txt); }; mensaje_txt.onChanged = function(obj) { aplicarFormato("normal",mensaje_txt); }; //APLICAR FORMATO A MENSAJES function aplicarFormato(modo:String, elemento:TextField) { var my_fmt:TextFormat = new TextFormat(); switch (modo) { case "normal" : my_fmt.color = 0x131E37; desplegableCerrar(); break; case "resaltado" : my_fmt.color = 0xFFFFFF; break; } elemento.setTextFormat(my_fmt); informe_txt.text = ""; } //CLICK ENVIAR enviar_btn.onRelease = function() { comprobarErrores(); }; //COMPROBAR ERRORES function comprobarErrores() { var error:Boolean; error = false; informe_txt.text = ""; if ((nombre_txt.text == "") || (nombre_txt.text == " ") || (nombre_txt.text == textoNombre)) { nombre_txt.text = textoNombre; aplicarFormato("resaltado",nombre_txt); error = true; } if ((email_txt.text == "") || (email_txt.text == " ") || (email_txt.text == textoEmail)) { email_txt.text = textoEmail; aplicarFormato("resaltado",email_txt); error = true; } else { var ismail:IsMail = new IsMail(); if (!ismail.comprobar(email_txt.text)) { email_txt.text = textoEmailInc; aplicarFormato("resaltado",email_txt); error = true; } } if ((asunto_txt.text == "") || (asunto_txt.text == " ") || (asunto_txt.text == textoAsunto)) { asunto_txt.text = textoAsunto; aplicarFormato("resaltado",asunto_txt); error = true; } if (desplegable_mc.mail_dest.text == textoDestinat) { aplicarFormato("resaltado",desplegable_mc.mail_dest); error = true; } desplegableCerrar(); if ((mensaje_txt.text == "") || (mensaje_txt.text == " ") || (mensaje_txt.text == textoMensaje)) { mensaje_txt.text = textoMensaje; aplicarFormato("resaltado",mensaje_txt); error = true; } //error? if (!error) { //trace("sin errores"); _root.botones_capa_mc._visible = true; informe_txt.text = textoEnviando; enviarMensaje(); } else { //trace("con errores"); } } //DESPLEGABLE CERRAR function desplegableCerrar () { desplegable_mc.gotoAndStop(1); } //ENVIAR MENSAJE var submitListener:Object = new Object(); function enviarMensaje() { var result_lv:LoadVars = new LoadVars(); result_lv.onLoad = function(success:Boolean) { // //informe_txt.text = success; if (success) { _parent.banner_contacto._visible = true; clearInterval(aux_continuar); aux_continuar = setInterval(Continuar, 3000); } else { } }; function Continuar() { clearInterval(aux_continuar); _root.archivo = new Main(); _root.archivo.llamar(1,"home.swf"); } // function debug(msg) { getURL("javascript:alert(\'" + msg + "\');", ""); } // End of the function // debug(_parent.banner_contacto); informe_txt.text = ""; _root.botones_capa_mc._visible = false; // var send_lv:LoadVars = new LoadVars(); send_lv.sitioUrl = sitioUrl; send_lv.sitioIdioma = sitioIdioma; send_lv.rtteNombre = nombre_txt.text; send_lv.rtteEmail = email_txt.text; send_lv.asunto = asunto_txt.text; send_lv.mensaje = mensaje_txt.text; send_lv.destEmail = destEmail; send_lv.sendAndLoad(rutaArch,result_lv,"POST"); /* trace("Contacto - Variables a enviar:"); trace("send_lv.sitioUrl: "+send_lv.sitioUrl); trace("send_lv.sitioIdioma: "+send_lv.sitioIdioma); trace("send_lv.rtteNombre: "+send_lv.rtteNombre); trace("send_lv.rtteEmail: "+send_lv.rtteEmail); trace("send_lv.asunto: "+send_lv.asunto); trace("send_lv.mensaje: "+send_lv.mensaje); trace("send_lv.destEmail: "+send_lv.destEmail); */ }