//funcion que hace la validacion del formulario de registro de nuevo usuario //y que hace la llamada ajax la plantilla que procesa la funcionalidad function validateContactForm(){ var name = document.contact_form.name.value; var surname = document.contact_form.surname.value; var company = document.contact_form.company.value; var job = document.contact_form.job.value; var mail = document.contact_form.mail.value; var phone = document.contact_form.phone.value; var country = document.contact_form.country.value; var obs = document.contact_form.message.value; var empty = ''; var error_non_numeric = ''; var error_numeric = ''; var wrong_format = ''; var name_label = ''; var surname_label = ''; var company_label = ''; var phone_label = ''; /***************************** name validation *************************/ if(name == ''){ if($('#contact-name-empty-error').size()== 0){ if($('#contact-name-non-numeric-error').size() > 0){ $('#contact-name-non-numeric-error').remove(); } $('#contact-form-name-input').attr("style","border: 1px solid #ff0000"); $('#contact-form-name-row').append(''); } } else{ $('#contact-form-name-input').attr("style","border: 1px solid #a9a9a9"); $('#contact-name-empty-error').remove(); var validName = validaCaracteresAlfabeticos(name); if(validName == true){ if($('#contact-name-empty-error').size()== 0){ if($('#contact-name-non-numeric-error').size()== 0){ $('#contact-form-name-row').append(''); } $('#contact-form-name-input').attr("style","border: 1px solid #ff0000"); } } else{ if(name == ''){ } else{ $('#contact-form-name-input').attr("style","border: 1px solid #a9a9a9"); $('#contact-name-non-numeric-error').remove(); /***************************** surname validation *************************/ if(surname == ''){ if($('#contact-surname-empty-error').size()== 0){ if($('#contact-surname-non-numeric-error').size() > 0){ $('#contact-surname-non-numeric-error').remove(); } $('#contact-form-surname-input').attr("style","border: 1px solid #ff0000"); $('#contact-form-surname-row').append(''); } } else{ $('#contact-form-surname-input').attr("style","border: 1px solid #a9a9a9"); $('#contact-surname-empty-error').remove(); var validSurname = validaCaracteresAlfabeticos(surname); if(validSurname == true){ if($('#contact-surname-empty-error').size()== 0){ if($('#contact-surname-non-numeric-error').size()== 0){ $('#contact-form-surname-row').append(''); } $('#contact-form-surname-input').attr("style","border: 1px solid #ff0000"); } } else{ if(surname == ''){ } else{ $('#contact-form-surname-input').attr("style","border: 1px solid #a9a9a9"); $('#contact-surname-non-numeric-error').remove(); /***************************** company validation *************************/ if(company == ''){ if($('#contact-company-empty-error').size()== 0){ $('#contact-form-company-input').attr("style","border: 1px solid #ff0000"); $('#contact-form-company-row').append(''); } } else{ $('#contact-form-company-input').attr("style","border: 1px solid #a9a9a9"); $('#contact-company-empty-error').remove(); /***************************** mail validation *************************/ if(mail == ''){ if($('#contact-mail-empty-error').size()== 0){ if($('#contact-mail-format-error').size() > 0){ $('#contact-mail-format-error').remove(); } $('#contact-form-mail-input').attr("style","border: 1px solid #ff0000"); $('#contact-form-mail-row').append(''); } } else{ $('#contact-form-mail-input').attr("style","border: 1px solid #a9a9a9"); $('#contact-mail-empty-error').remove(); if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)){ if($('#contact-mail-empty-error').size()== 0){ if($('#contact-mail-format-error').size()== 0){ $('#contact-form-mail-row').append(''); } $('#contact-form-mail-input').attr("style","border: 1px solid #ff0000"); } } else{ $('#contact-form-mail-input').attr("style","border: 1px solid #a9a9a9"); $('#contact-mail-format-error').remove(); /***************************** phone validation *************************/ var validPhone = validaCaracteresNumericos(phone); if (validPhone == true){ if($('#contact-phone-numeric-error').size()== 0){ $('#contact-form-phone-input').attr("style","border: 1px solid #ff0000"); $('#contact-form-phone-row').append(''); } } else{ $('#contact-form-phone-input').attr("style","border: 1px solid #a9a9a9"); $('#contact-phone-numeric-error').remove(); var currentForm = $('#contact_form'); $('#Msg').remove(); $.ajax({ url: "/contact/send.php", cache: false, type: "POST", data: ($(currentForm).serializeArray()), beforeSend: function(){ $('#contact-button-cell').prepend(''); }, complete: function(){ $('#loading-msg').remove(); }, success: function(data){ $('body').append(data); if($('#errorMessage').size() > 0 ){ $('#contact-button-cell').prepend('
'); $('#errorMessage').remove(); } else{ $('#contact-button-cell').prepend(''); $('#successMessage').remove(); document.getElementById('contact_form').reset(); } }, error: function(){ alert(""); } }); } } } } } } } } } } } //funcion que hace la validacion del formulario de registro de nuevo usuario //y que hace la llamada ajax la plantilla que procesa la funcionalidad function validateRegisterForm(){ $('#Msg').remove(); var name = document.register_form.name.value; var surname = document.register_form.surname.value; var company = document.register_form.company.value; var job = document.register_form.job.value; var mail = document.register_form.mail.value; var phone = document.register_form.phone.value; var country = document.register_form.country.value; var obs = document.register_form.observations.value; var empty = ''; var error_non_numeric = ''; var error_numeric = ''; var wrong_format = ''; var name_label = ''; var surname_label = ''; var company_label = ''; var phone_label = ''; /***************************** name validation *************************/ if(name == ''){ if($('#name-empty-error').size()== 0){ if($('#name-non-numeric-error').size() > 0){ $('#name-non-numeric-error').remove(); } $('#register-form-name-input').attr("style","border: 1px solid #ff0000"); $('#register-message-cell').html(''); $('#register-form-name-input').focus(); } } else{ $('#register-form-name-input').attr("style","border: 1px solid #a9a9a9"); $('#name-empty-error').remove(); var validName = validaCaracteresAlfabeticos(name); if(validName == true){ if($('#name-empty-error').size()== 0){ if($('#name-non-numeric-error').size()== 0){ $('#register-message-cell').html(''); } $('#register-form-name-input').attr("style","border: 1px solid #ff0000"); $('#register-form-name-input').focus(); } } else{ if(name == ''){ } else{ $('#register-form-name-input').attr("style","border: 1px solid #a9a9a9"); $('#name-non-numeric-error').remove(); /***************************** surname validation *************************/ if(surname == ''){ if($('#surname-empty-error').size()== 0){ if($('#surname-non-numeric-error').size() > 0){ $('#surname-non-numeric-error').remove(); } $('#register-form-surname-input').attr("style","border: 1px solid #ff0000"); $('#register-message-cell').append(''); $('#register-form-surname-input').focus() } } else{ $('#register-form-surname-input').attr("style","border: 1px solid #a9a9a9"); $('#surname-empty-error').remove(); var validSurname = validaCaracteresAlfabeticos(surname); if(validSurname == true){ if($('#surname-empty-error').size()== 0){ if($('#surname-non-numeric-error').size()== 0){ $('#register-message-cell').append(''); } $('#register-form-surname-input').attr("style","border: 1px solid #ff0000"); $('#register-form-surname-input').focus() } } else{ if(surname == ''){ } else{ $('#register-form-surname-input').attr("style","border: 1px solid #a9a9a9"); $('#surname-non-numeric-error').remove(); /***************************** company validation *************************/ if(company == ''){ if($('#company-empty-error').size()== 0){ $('#register-form-company-input').attr("style","border: 1px solid #ff0000"); $('#register-message-cell').append(''); $('#register-form-company-input').focus(); } } else{ $('#register-form-company-input').attr("style","border: 1px solid #a9a9a9"); $('#company-empty-error').remove(); /***************************** mail validation *************************/ if(mail == ''){ if($('#mail-empty-error').size()== 0){ if($('#mail-format-error').size() > 0){ $('#mail-format-error').remove(); } $('#register-form-mail-input').attr("style","border: 1px solid #ff0000"); $('#register-message-cell').append(''); $('#register-form-mail-input').focus(); } } else{ $('#register-form-mail-input').attr("style","border: 1px solid #a9a9a9"); $('#mail-empty-error').remove(); if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)){ if($('#mail-empty-error').size()== 0){ if($('#mail-format-error').size()== 0){ $('#register-message-cell').append(''); } $('#register-form-mail-input').attr("style","border: 1px solid #ff0000"); $('#register-form-mail-input').focus(); } } else{ $('#register-form-mail-input').attr("style","border: 1px solid #a9a9a9"); $('#mail-format-error').remove(); /***************************** phone validation *************************/ var validPhone = validaCaracteresNumericos(phone); if (validPhone == true){ if($('#phone-numeric-error').size()== 0){ $('#register-form-phone-input').attr("style","border: 1px solid #ff0000"); $('#register-message-cell').append(''); $('#register-form-phone-input').focus(); } } else{ $('#register-form-phone-input').attr("style","border: 1px solid #a9a9a9"); $('#phone-numeric-error').remove(); var currentPopup = PopupManager.getActive(); var currentForm = $(currentPopup.getSelector() + ' #register_form')[0]; $.ajax({ url: "/users/register_mail.php", cache: false, type: "POST", data: ($(currentForm).serializeArray()), beforeSend: function(){ $('#register-button-cell').prepend('
');
},
complete: function(){
$('#loading-msg').remove();
},
success: function(data){
$('body').append(data);
if($('#errorMessage').size() > 0 ){
$('#register-message-cell').html('');
$('#errorMessage').remove();
}
else{
$('#register-message-cell').html('');
$('#successMessage').remove();
currentForm.reset();
}
},
error: function(){
alert("");
}
});
}
}
}
}
}
}
}
}
}
}
}
//funcion que hace la validacion del formulario de recordar password
//y que hace la llamada ajax para la plantilla que procesa esta funcion
function validateForgotForm(){
$('#Msg').remove();
var mail = document.forgot_password_form.mail.value;
var wrong_format = '';
var empty = '';
if(mail == ''){
if($('#forgot-mail-empty-error').size()== 0){
if($('#forgot-mail-format-error').size() > 0){
$('#forgot-mail-format-error').remove();
}
$('#forgot-form-mail-input').attr("style","border: 1px solid #ff0000");
$('#forgot-message-cell').append('');
$('#forgot-form-mail-input').focus();
}
}
else{
$('#forgot-form-mail-input').attr("style","border: 1px solid #a9a9a9");
$('#forgot-mail-empty-error').remove();
if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)){
if($('#forgot-mail-empty-error').size()== 0){
if($('#forgot-mail-format-error').size()== 0){
$('#forgot-message-cell').append('');
}
$('#forgot-form-mail-input').attr("style","border: 1px solid #ff0000");
$('#forgot-form-mail-input').focus();
}
}
else{
$('#forgot-form-mail-row').attr("style","border: 1px solid #a9a9a9");
$('#forgot-mail-format-error').remove();
var currentPopup = PopupManager.getActive();
var currentForm = $(currentPopup.getSelector() + ' #forgot_password_form')[0];
$.ajax({
url: "/users/forgot_mail.php",
cache: false,
type: "POST",
data: ($(currentForm).serializeArray()),
beforeSend: function(){
$('#forgot-pass-cell').prepend('
');
},
complete: function(){
$('#loading-msg').remove();
},
success: function(data){
$('body').append(data);
if($('#errorMessage').size() > 0 ){
$('#forgot-message-cell').html('');
$('#errorMessage').remove();
}
else{
$('#forgot-message-cell').html('');
$('#successMessage').remove();
currentForm.reset();
}
},
error: function(){
alert("");
}
});
}
}
}
function confirmUnregister(){
var p = PopupManager.create();
p.configure({
type: "users",
modal: true,
width: 572,
height: 250,
bg: "light",
url: "/users/unregister_form.php"
});
p.draw();
}
//funcion que hace la llamada ajax a la plantilla que procesa la baja de un usuario
function unregister(){
var currentPopup = PopupManager.getActive();
var currentForm = $(currentPopup.getSelector() + ' #unregister_form')[0];
$('#Msg').remove();
$.ajax({
url: "/users/unregister.php",
cache: false,
beforeSend: function(){
$('#unregister_button').append('
');
},
complete: function(){
$('#loading-msg').remove();
},
success: function(data){
$('body').append(data);
if($('#errorMessage').size() > 0 ){
$('#unregister-message-cell').html('');
$('#errorMessage').remove();
}
else{
$('#unregister-message-cell').html('');
$('#successMessage').remove();
//document.getElementById('unregister_button').style.display = 'none';
}
},
error: function(){
alert("");
}
});
}
//funcion que muestra la ventana de login en un popup
function autentication(current_url){
/*
if (window.showModalDialog) {
window.showModalDialog("login_form.php","Login",
"dialogWidth:370px;dialogHeight:180px");
}
else {
window.open('login_form.php','Login',
'height=180,width=370,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes');
}
*/
var p = PopupManager.create();
p.configure({
type: "users",
modal: true,
width: 572,
height: 370,
bg: "light",
curr_url: current_url,
url: "/users/login_form.php"
});
p.draw();
$('div#login').pngFix();
}
//funcion que carga el formulario de registro en un popup
function register(){
var p = PopupManager.create();
p.configure({
type: 'users',
modal: true,
width: 572,
height: 630,
top: 40,
bg: 'light',
url:'/users/register_form.php'
});
p.draw();
}
//funcion que carga el formulario de recordar password en un popup
function forgot_password(){
var p = PopupManager.create();
p.configure({
type: 'users',
modal: true,
width: 572,
height: 340,
bg: 'light',
url:'/users/forgot_password.php'
});
p.draw();
}
//funcion que muestra el aviso legal en un popup
function legalAdvise(){
var p = PopupManager.create();
p.configure({
type: 'legal',
modal: true,
width: 572,
height: 600,
bg: 'light',
url:'/src/legal.php'
});
p.draw();
}
//funciones para ocultar o mostrar un elemento
function desplegar(elemento){
document.getElementById(elemento).style.display = 'block';
}
function ocultar(elemento){
document.getElementById(elemento).style.display = 'none';
}
//funciones para ocultar o mostrar un elemento
function desplegarExtras(elemento,div,mensaje,mensaje2){
document.getElementById(elemento).style.display = 'block';
document.getElementById(div).innerHTML = ' '+mensaje+''
}
function ocultarExtras(elemento,div,mensaje,mensaje2){
document.getElementById(elemento).style.display = 'none';
document.getElementById(div).innerHTML = ' '+mensaje+''
}
//funcion para el incremento de fuentes de la pagina
$(document).ready(function(){
//var originalFontSize = parseFloat($('html').css('font-size'),10);
//var originalFontSize = parseFloat($('html').css('font-size'));
$('#current-font-size').html(16);
$('#current-font-size-em').html(1);
});
function increaseFont(increment,option){
//alert(increment+' '+option);
//var currFont = parseInt($('#current-font-size').html());
var currEm = parseFloat($('#current-font-size-em').html());
//alert(currEm);
if (typeof increment == 'undefined'){
newSize = '1em';
}
else{
if(option == 'decrease'){
var newEm = currEm - increment;
}
else{
var newEm = currEm + increment;
}
//alert(newEm);
//var currentFontSize = parseFloat(currFont);
//var currentFontSize2 = currentFontSize / parseFloat(currFont);
//alert('Newem'+newEm+' currentfontsize 1 y 2: '+currentFontSize+' '+currentFontSize2);
//var currentFontSizeInt = parseFloat(currentFontSize2);
//alert(currentFontSizeInt);
if(newEm > 1.54 || newEm < 0.46){
newSize = currEm+'em';
}
else{
//newFontSize = parseFloat(currentFontSize,10) * increment;
var newFontSize = newEm;
newSize = newFontSize+'em';
}
}
//alert(newSize);
$('body').css('font-size', newSize );
$('#current-font-size-em').html(newSize);
}
//funcion que muestra la hora en la barra de herramientas
function reloj() {
// Obtiene la fecha actual
var fObj = new Date() ;
// Obtiene la hora
var horas = fObj.getHours() ;
// Obtiene los minutos
var minutos = fObj.getMinutes() ;
// Obtiene los segundos
var segundos = fObj.getSeconds() ;
// Si es menor o igual a 9 le concatena un 0
if (horas <= 9) horas = "0" + horas;
// Si es menor o igual a 9 le concatena un 0
if (minutos <= 9) minutos = "0" + minutos;
// Si es menor o igual a 9 le concatena un 0
if (segundos <= 9) segundos = "0" + segundos;
// Asigna la hora actual a la caja de texto reloj
$('#date').html('');
$('#date').html(''+horas+':'+minutos+':'+segundos+'');
// Cada segundo invoca a si mismo
setTimeout("reloj()",1000);
}
//funcion que muestra el formulario de recomendacion en un popup
function recommend(){
var p = PopupManager.create();
p.configure({
type: 'users',
modal: true,
width: 572,
height: 400,
bg: 'light',
url:'/src/recommend.php'
});
p.draw();
}
//funcion que valida el formulario de recomendacion y envia la informacion con ajax
function sendRecommendation(){
$('#Msg').remove();
var to_mail = $('#recommend-form-to-mail-input').val();
var from_mail = $('#recommend-form-mail-from-input').val();
var to_name = $('#recommend-form-to-name-input').val();
var from_name = $('#recommend-form-name-from-input').val();
var wrong_format = '';
var empty = '';
var error_non_numeric = '';
var name_label = '';
/********************** from_name validation *************************/
if(from_name == ''){
if($('#recommend-namefrom-empty-error').size()== 0){
if($('#recommend-namefrom-non-numeric-error').size() > 0){
$('#recommend-namefrom-non-numeric-error').remove();
}
$('#recommend-form-name-from-input').attr("style","border: 1px solid #ff0000");
$('#recommend-message-cell').append('');
$('#recommend-form-name-from-input').focus();
}
}
else{
$('#recommend-form-name-from-input').attr("style","border: 1px solid #a9a9a9");
$('#recommend-namefrom-empty-error').remove();
var validName = validaCaracteresAlfabeticos(from_name);
if(validName == true){
if($('#recommend-namefrom-empty-error').size()== 0){
if($('#recommend-namefrom-non-numeric-error').size()== 0){
$('#recommend-message-cell').append('');
}
$('#recommend-form-name-from-input').attr("style","border: 1px solid #ff0000");
$('#recommend-form-name-from-input').focus();
}
}
else{
if(from_name == ''){
}
else{
$('#recommend-form-name-from-input').attr("style","border: 1px solid #a9a9a9");
$('#recommend-namefrom-non-numeric-error').remove();
/********************** to_name validation *************************/
if(to_name == ''){
if($('#recommend-nameto-empty-error').size()== 0){
if($('#recommend-nameto-non-numeric-error').size() > 0){
$('#recommend-nameto-non-numeric-error').remove();
}
$('#recommend-form-to-name-input').attr("style","border: 1px solid #ff0000");
$('#recommend-message-cell').append('');
$('#recommend-form-to-name-input').focus();
}
}
else{
$('#recommend-form-to-name-input').attr("style","border: 1px solid #a9a9a9");
$('#recommend-nameto-empty-error').remove();
var validName = validaCaracteresAlfabeticos(to_name);
if(validName == true){
if($('#recommend-nameto-empty-error').size()== 0){
if($('#recommend-nameto-non-numeric-error').size()== 0){
$('#recommend-message-cell').append('');
}
$('#recommend-form-to-name-input').attr("style","border: 1px solid #ff0000");
$('#recommend-form-to-name-input').focus();
}
}
else{
if(to_name == ''){
}
else{
$('#recommend-form-to-name-input').attr("style","border: 1px solid #a9a9a9");
$('#recommend-nameto-non-numeric-error').remove();
/**********************from_mail validation************************/
if(from_mail == ''){
if($('#recommend-mailfrom-empty-error').size()== 0){
if($('#recommend-mailfrom-format-error').size() > 0){
$('#recommend-mailfrom-format-error').remove();
}
$('#recommend-form-mail-from-input').attr("style","border: 1px solid #ff0000");
$('#recommend-message-cell').append('');
$('#recommend-form-mail-from-input').focus();
}
}
else{
$('#recommend-form-mail-from-input').attr("style","border: 1px solid #a9a9a9");
$('#recommend-mailfrom-empty-error').remove();
if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(from_mail)){
if($('#recommend-mailfrom-empty-error').size()== 0){
if($('#recommend-mailfrom-format-error').size()== 0){
$('#recommend-message-cell').append('');
}
$('#recommend-form-mail-from-input').attr("style","border: 1px solid #ff0000");
$('#recommend-form-mail-from-input').focus();
}
}
else{
$('#recommend-form-mail-from-input').attr("style","border: 1px solid #a9a9a9");
$('#recommend-mailfrom-format-error').remove();
/**********************to_mail validation************************/
if(to_mail == ''){
if($('#recommend-mailto-empty-error').size()== 0){
if($('#recommend-mailto-format-error').size() > 0){
$('#recommend-mailto-format-error').remove();
}
$('#recommend-form-to-mail-input').attr("style","border: 1px solid #ff0000");
$('#recommend-message-cell').append('');
$('#recommend-form-to-mail-input').focus();
}
}
else{
$('#recommend-form-to-mail-input').attr("style","border: 1px solid #a9a9a9");
$('#recommend-mailto-empty-error').remove();
if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(to_mail)){
if($('#recommend-mailto-empty-error').size()== 0){
if($('#recommend-mailto-format-error').size()== 0){
$('#recommend-message-cell').append('');
}
$('#recommend-form-to-mail-input').attr("style","border: 1px solid #ff0000");
$('#recommend-form-to-mail-input').focus();
}
}
else{
$('#recommend-form-to-mail-input').attr("style","border: 1px solid #a9a9a9");
$('#recommend-mailto-format-error').remove();
var currentPopup = PopupManager.getActive();
var currentForm = $(currentPopup.getSelector() + ' #recommend_form')[0];
$.ajax({
url: "/src/recommend_mail.php",
cache: false,
type: "POST",
data: ($(currentForm).serializeArray()),
beforeSend: function(){
$('#recommend-cell').prepend('
');
},
complete: function(){
$('#loading-msg').remove();
},
success: function(data){
$('body').append(data);
if($('#errorMessage').size() > 0 ){
$('#recommend-message-cell').html('');
$('#errorMessage').remove();
}
else{
$('#recommend-message-cell').html('');
$('#successMessage').remove();
$('#recommend-form-to-mail-input').val('');
$('#recommend-form-to-name-input').val('');}
},
error: function(){
alert("");
}
});
}
}
}
}
}
}
}
}
}
}
}
//funcion que muestra el formulario de compra en un popup
function buySO(){
var p = PopupManager.create();
p.configure({
type: 'users',
modal: true,
width: 572,
height: 660,
top: 40,
bg: 'light',
url:'/src/buy_SO.php'
});
p.draw();
}
//funcion que valida el formulario de compra y envia la informacion con ajax
function sendBuyOrder(){
$('#Msg').remove();
var name = document.buySO_form.name.value;
var surname = document.buySO_form.surname.value;
var company = document.buySO_form.company.value;
var job = document.buySO_form.job.value;
var mail = document.buySO_form.mail.value;
var phone = document.buySO_form.phone.value;
var country = document.buySO_form.country.value;
var obs = document.buySO_form.observations.value;
var empty = '';
var error_non_numeric = '';
var error_numeric = '';
var wrong_format = '';
var name_label = '';
var surname_label = '';
var company_label = '';
var phone_label = '';
if(name == ''){
if($('#buyso-name-empty-error').size()== 0){
if($('#buyso-name-non-numeric-error').size() > 0){
$('#buyso-name-non-numeric-error').remove();
}
$('#buyso-form-name-input').attr("style","border: 1px solid #ff0000");
$('#buySO-message-cell').append('');
$('#buyso-form-name-input').focus();
}
}
else{
$('#buyso-form-name-input').attr("style","border: 1px solid #a9a9a9");
$('#buyso-name-empty-error').remove();
var validName = validaCaracteresAlfabeticos(name);
if(validName == true){
if($('#buyso-name-empty-error').size()== 0){
if($('#buyso-name-non-numeric-error').size()== 0){
$('#buySO-message-cell').append('');
}
$('#buyso-form-name-input').attr("style","border: 1px solid #ff0000");
$('#buyso-form-name-input').focus();
}
}
else{
if(name == ''){
}
else{
$('#buyso-form-name-input').attr("style","border: 1px solid #a9a9a9");
$('#buyso-name-non-numeric-error').remove();
/***************************** surname validation *************************/
if(surname == ''){
if($('#buyso-surname-empty-error').size()== 0){
if($('#buyso-surname-non-numeric-error').size() > 0){
$('#buyso-surname-non-numeric-error').remove();
}
$('#buyso-form-surname-input').attr("style","border: 1px solid #ff0000");
$('#buySO-message-cell').append('');
$('#buyso-form-surname-input').focus();
}
}
else{
$('#buyso-form-surname-input').attr("style","border: 1px solid #a9a9a9");
$('#buyso-surname-empty-error').remove();
var validSurname = validaCaracteresAlfabeticos(surname);
if(validSurname == true){
if($('#buyso-surname-empty-error').size()== 0){
if($('#buyso-surname-non-numeric-error').size()== 0){
$('#buySO-message-cell').append('');
}
$('#buyso-form-surname-input').attr("style","border: 1px solid #ff0000");
$('#buyso-form-surname-input').focus();
}
}
else{
if(surname == ''){
}
else{
$('#buyso-form-surname-input').attr("style","border: 1px solid #a9a9a9");
$('#buyso-surname-non-numeric-error').remove();
/***************************** company validation *************************/
if(company == ''){
if($('#buyso-company-empty-error').size()== 0){
$('#buyso-form-company-input').attr("style","border: 1px solid #ff0000");
$('#buySO-message-cell').append('');
$('#buyso-form-company-input').focus();
}
}
else{
$('#buyso-form-company-input').attr("style","border: 1px solid #a9a9a9");
$('#buyso-company-empty-error').remove();
/***************************** mail validation *************************/
if(mail == ''){
if($('#buyso-mail-empty-error').size()== 0){
if($('#buyso-mail-format-error').size() > 0){
$('#buyso-mail-format-error').remove();
}
$('#buyso-form-mail-input').attr("style","border: 1px solid #ff0000");
$('#buySO-message-cell').append('');
$('#buyso-form-mail-input').focus();
}
}
else{
$('#buyso-form-mail-input').attr("style","border: 1px solid #a9a9a9");
$('#buyso-mail-empty-error').remove();
if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)){
if($('#buyso-mail-empty-error').size()== 0){
if($('#buyso-mail-format-error').size()== 0){
$('#buySO-message-cell').append('');
}
$('#buyso-form-mail-input').attr("style","border: 1px solid #ff0000");
$('#buyso-form-mail-input').focus();
}
}
else{
$('#buyso-form-mail-input').attr("style","border: 1px solid #a9a9a9");
$('#buyso-mail-format-error').remove();
/***************************** phone validation *************************/
var validPhone = validaCaracteresNumericos(phone);
if (validPhone == true){
if($('#buyso-phone-numeric-error').size()== 0){
$('#buyso-form-phone-input').attr("style","border: 1px solid #ff0000");
$('#buySO-message-cell').append('');
$('#buyso-form-phone-input').focus();
}
}
else{
$('#buyso-form-phone-input').attr("style","border: 1px solid #a9a9a9");
$('#buyso-phone-numeric-error').remove();
var currentPopup = PopupManager.getActive();
var currentForm = $(currentPopup.getSelector() + ' #buySO_form')[0];
$.ajax({
url: "/src/buySO_mail.php",
cache: false,
type: "POST",
data: ($(currentForm).serializeArray()),
beforeSend: function(){
$('#buySO-cell').prepend('
');
},
complete: function(){
$('#loading-msg').remove();
},
success: function(data){
$('body').append(data);
if($('#errorMessage').size() > 0 ){
$('#buySO-message-cell').html('');
$('#errorMessage').remove();
}
else{
$('#buySO-message-cell').html('');
$('#successMessage').remove();
currentForm.reset();
}
},
error: function(){
alert("");
}
});
}
}
}
}
}
}
}
}
}
}
}
//funcion que pagina en el modulo de partners
function paginarPartners(pagina){
$.ajax({
url: "/partners/partners.php?page="+pagina,
cache: false,
type: "GET",
beforeSend: function(){
$('#partners-list').html('');
$('#partners').append('
');
},
complete: function(){
$('#loading-msg').remove();
},
success: function(data){
$('#partners').html(data);
},
error: function(){
alert("");
}
});
}
//funcion que muestra el detalle de la noticia
function detalleNoticia(idnoticia,numrows){
$.ajax({
url: "/news/news_detail.php?pfwid="+idnoticia+"&numrows="+numrows,
cache: false,
type: "GET",
beforeSend: function(){
$('#list-noticia').html('');
$('#list-noticia').append('
');
},
complete: function(){
$('#loading-msg').remove();
},
success: function(data){
$('#list-noticia').html(data);
},
error: function(){
alert("");
}
});
}
//funcion que muestra el detalle de la hemeroteca
function detalleHemero(idhemero){
$.ajax({
url: "/hemeroteca/hemero_detail.php?pfwid="+idhemero,
cache: false,
type: "GET",
beforeSend: function(){
$('#especific-content').html('');
$('#especific-content').append('
');
},
complete: function(){
$('#loading-msg').remove();
},
success: function(data){
$('#especific-content').html(data);
},
error: function(){
alert("");
}
});
}
//funcion generica de paginacion
function paginar(pagina,archivo,div){
$.ajax({
url: archivo+"?page="+pagina,
cache: false,
type: "GET",
beforeSend: function(){
$('#'+div).html('');
$('#'+div).append('
');
},
complete: function(){
$('#loading-msg').remove();
},
success: function(data){
$('#'+div).html(data);
},
error: function(){
alert("");
}
});
}
//funcion que valida el formulario del help center y envia los datos con ajax
function enviarPregunta(){
var name = document.helpcenter_form.name.value;
var mail = document.helpcenter_form.mail.value;
var question = document.helpcenter_form.question.value;
var empty = '';
var error_non_numeric = '';
var error_numeric = '';
var wrong_format = '';
var name_label = '';
var question_label = '';
if(question == ''){
if($('#helpc-question-empty-error').size()== 0){
if($('#helpc-question-non-numeric-error').size() > 0){
$('#helpc-question-non-numeric-error').remove();
}
$('#helpc-form-question-input').attr("style","border: 1px solid #ff0000");
$('#helpc-form-question-row').append('');
}
}
else {
$('#helpc-form-question-input').attr("style","border: 1px solid #a9a9a9");
$('#helpc-question-empty-error').remove();
if(name == ''){
if($('#helpc-name-empty-error').size()== 0){
if($('#helpc-name-non-numeric-error').size() > 0){
$('#helpc-name-non-numeric-error').remove();
}
$('#helpc-form-name-input').attr("style","border: 1px solid #ff0000");
$('#helpc-form-name-row').append('');
}
}
else{
$('#helpc-form-name-input').attr("style","border: 1px solid #a9a9a9");
$('#helpc-name-empty-error').remove();
var validName = validaCaracteresAlfabeticos(name);
if(validName == true){
if($('#helpc-name-empty-error').size()== 0){
if($('#helpc-name-non-numeric-error').size()== 0){
$('#helpc-form-name-row').append('');
}
$('#helpc-form-name-input').attr("style","border: 1px solid #ff0000");
}
}
else{
if(name == ''){
}
else{
$('#helpc-form-name-input').attr("style","border: 1px solid #a9a9a9");
$('#helpc-name-non-numeric-error').remove();
/********************************* Mail validation *************************************/
if(mail == ''){
if($('#helpc-mail-empty-error').size()== 0){
if($('#helpc-mail-format-error').size() > 0){
$('#helpc-mail-format-error').remove();
}
$('#helpc-form-mail-input').attr("style","border: 1px solid #ff0000");
$('#helpc-form-mail-row').append('');
}
}
else{
$('#helpc-form-mail-input').attr("style","border: 1px solid #a9a9a9");
$('#helpc-mail-empty-error').remove();
if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)){
if($('#helpc-mail-empty-error').size()== 0){
if($('#helpc-mail-format-error').size()== 0){
$('#helpc-form-mail-row').append('');
}
$('#helpc-form-mail-input').attr("style","border: 1px solid #ff0000");
}
}
else{
$('#helpc-form-mail-input').attr("style","border: 1px solid #a9a9a9");
$('#helpc-mail-format-error').remove();
var currentForm = $('#helpcenter_form');
$('#Msg').remove();
$.ajax({
url: "/help_center/send_question.php",
cache: false,
type: "POST",
data: ($(currentForm).serializeArray()),
beforeSend: function(){
$('#question-cell').append('
');
},
complete: function(){
$('#loading-msg').remove();
},
success: function(data){
$('body').append(data);
if($('#errorMessage').size() > 0 ){
$(currentForm).prepend('');
$('#errorMessage').remove();
}
else{
$(currentForm).prepend('');
$('#successMessage').remove();
document.getElementById('helpcenter_form').reset();
//paginar(0,'/help_center/help_center.php','especific-content');
}
},
error: function(){
alert("");
}
});
}
}
}
}
}
}
}
//funcion que amplia una imagen en un popup
function ampliaImagen(imgsrc,width,height){
var p = PopupManager.create();
p.configure({
type: 'image',
modal: true,
width: width,
height: height,
bg: 'light',
url: imgsrc
});
p.draw();
}
function validaCaracteresEspeciales(x)
{
var vale=0;
var aceptadas=[32,39,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,95,45];
//[65-90--> A...Z][97-122--->a..b][48-57--->0...9][-_]
for (i=0; i
');
},
complete: function(){
$('#loading-msg').remove();
},
success: function(data){
$('#proyeccion-movie').html('');
$('#proyeccion-movie').html(data);
},
error: function(){
alert("");
}
});
}