function get_html_translation_table (table, quote_style) { var entities = {}, hash_map = {}, decimal = 0, symbol = ''; var constMappingTable = {}, constMappingQuoteStyle = {}; var useTable = {}, useQuoteStyle = {}; // Translate arguments constMappingTable[0] = 'HTML_SPECIALCHARS'; constMappingTable[1] = 'HTML_ENTITIES'; constMappingQuoteStyle[0] = 'ENT_NOQUOTES'; constMappingQuoteStyle[2] = 'ENT_COMPAT'; constMappingQuoteStyle[3] = 'ENT_QUOTES'; useTable = !isNaN(table) ? constMappingTable[table] : table ? table.toUpperCase() : 'HTML_SPECIALCHARS'; useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT'; if (useTable !== 'HTML_SPECIALCHARS' && useTable !== 'HTML_ENTITIES') { throw new Error("Table: "+useTable+' not supported'); // return false; } entities['38'] = '&'; if (useTable === 'HTML_ENTITIES'){ entities['160'] = ' '; entities['161'] = '¡'; entities['162'] = '¢'; entities['163'] = '£'; entities['164'] = '¤'; entities['165'] = '¥'; entities['166'] = '¦'; entities['167'] = '§'; entities['168'] = '¨'; entities['169'] = '©'; entities['170'] = 'ª'; entities['171'] = '«'; entities['172'] = '¬'; entities['173'] = '­'; entities['174'] = '®'; entities['175'] = '¯'; entities['176'] = '°'; entities['177'] = '±'; entities['178'] = '²'; entities['179'] = '³'; entities['180'] = '´'; entities['181'] = 'µ'; entities['182'] = '¶'; entities['183'] = '·'; entities['184'] = '¸'; entities['185'] = '¹'; entities['186'] = 'º'; entities['187'] = '»'; entities['188'] = '¼'; entities['189'] = '½'; entities['190'] = '¾'; entities['191'] = '¿'; entities['192'] = 'À'; entities['193'] = 'Á'; entities['194'] = 'Â'; entities['195'] = 'Ã'; entities['196'] = 'Ä'; entities['197'] = 'Å'; entities['198'] = 'Æ'; entities['199'] = 'Ç'; entities['200'] = 'È'; entities['201'] = 'É'; entities['202'] = 'Ê'; entities['203'] = 'Ë'; entities['204'] = 'Ì'; entities['205'] = 'Í'; entities['206'] = 'Î'; entities['207'] = 'Ï'; entities['208'] = 'Ð'; entities['209'] = 'Ñ'; entities['210'] = 'Ò'; entities['211'] = 'Ó'; entities['212'] = 'Ô'; entities['213'] = 'Õ'; entities['214'] = 'Ö'; entities['215'] = '×'; entities['216'] = 'Ø'; entities['217'] = 'Ù'; entities['218'] = 'Ú'; entities['219'] = 'Û'; entities['220'] = 'Ü'; entities['221'] = 'Ý'; entities['222'] = 'Þ'; entities['223'] = 'ß'; entities['224'] = 'à'; entities['225'] = 'á'; entities['226'] = 'â'; entities['227'] = 'ã'; entities['228'] = 'ä'; entities['229'] = 'å'; entities['230'] = 'æ'; entities['231'] = 'ç'; entities['232'] = 'è'; entities['233'] = 'é'; entities['234'] = 'ê'; entities['235'] = 'ë'; entities['236'] = 'ì'; entities['237'] = 'í'; entities['238'] = 'î'; entities['239'] = 'ï'; entities['240'] = 'ð'; entities['241'] = 'ñ'; entities['242'] = 'ò'; entities['243'] = 'ó'; entities['244'] = 'ô'; entities['245'] = 'õ'; entities['246'] = 'ö'; entities['247'] = '÷'; entities['248'] = 'ø'; entities['249'] = 'ù'; entities['250'] = 'ú'; entities['251'] = 'û'; entities['252'] = 'ü'; entities['253'] = 'ý'; entities['254'] = 'þ'; entities['255'] = 'ÿ'; } if (useQuoteStyle !== 'ENT_NOQUOTES') { entities['34'] = '"'; } if (useQuoteStyle === 'ENT_QUOTES') { entities['39'] = '''; } entities['60'] = '<'; entities['62'] = '>'; // ascii decimals to real symbols for (decimal in entities) { symbol = String.fromCharCode(decimal); hash_map[symbol] = entities[decimal]; } return hash_map; } function html_entity_decode(string, quote_style) { var hash_map = {}, symbol = '', tmp_str = '', entity = ''; tmp_str = string.toString(); if (false === (hash_map = this.get_html_translation_table('HTML_ENTITIES', quote_style))){ return false; } hash_map['&'] = '&'; for (symbol in hash_map) { entity = hash_map[symbol]; tmp_str = tmp_str.split(entity).join(symbol); } tmp_str = tmp_str.split(''').join("'"); return tmp_str; } function actualizaLinks(){var elementos_array=['login-link','unregister-link','forgot-password-link','register-link','access-font-1','access-font-2','access-font-3','legal-advise-link','send-recommendation-link','buyso-link'];var item='';var item_split='';for(var i=0;i0){var elemento=$('#'+elementos_array[i]);elemento.attr('href','#');}}} function actualizaForms(){var elementos_array=['helpcenter_form','login-form','forgot_password_form','register_form','unregister_form','recommend_form','buySO_form','reset_password_form'];var item='';var item_split='';for(var i=0;i0){var elemento=$('#'+elementos_array[i]);elemento.removeAttr('action');elemento.removeAttr('method');}}} function coverAllDiv(){ $('body').append(''); myHeight = $(document).height(); $('.cover-all-div').css('height',myHeight+'px'); } function CreateBookmarkLink() { if (document.all) window.external.AddFavorite(location.href, document.title); else if (window.sidebar) window.sidebar.addPanel(document.title, location.href, ""); else { var message_errors = ''; errorMessage('/modules/tools/_views/error_popup.php',500,400,message_errors); } } function showLoadingButton(elem){ $('#loading-button-msg').remove(); $('#'+elem).append(''); } function bannerAnimation(){ $('.banner-rotation').css('display','block'); $('.banner-rotation').cycle({ fx: 'fade', speed: 1200, timeout: 0 }); } function errorMessage(url,width,height,message){ //Quito el foco del boton submit para evitar multiples envios del formulario. $("form:last input:text:first").focus(); var p=PopupManager.create(); p.configure({ type:'error', modal:true, width:width, height:height, bg:'light', url:url, message:message }); p.draw(); } function trim(str, chars) { return ltrim(rtrim(str, chars), chars); } function ltrim(str, chars) { chars = chars || "\\s"; return str.replace(new RegExp("^[" + chars + "]+", "g"), ""); } function rtrim(str, chars) { chars = chars || "\\s"; return str.replace(new RegExp("[" + chars + "]+$", "g"), ""); } function changeSite(){ var indice = document.getElementById("selectsites").selectedIndex; window.location="http://"+document.getElementById("selectsites").options[indice].value+"/"; } function clearActionsRightForm(){ $("#title_form_popup").val(""); $("#content_form_popup").val(""); $("#head_form_popup").val(""); } function openPrintPopUp(){ clearActionsRightForm(); $("#title_form_popup").val($("#title-section").html()); $("#content_form_popup").val($('div[class^=center-div]').html()); $("#head_form_popup").val($("head").html()); $('#actions_print_form').attr('action','/_components/popup_print.php'); $('#actions_print_form').submit(); clearActionsRightForm(); } function pdfExport(url){ clearActionsRightForm(); $("#title_form_popup").val($("#title-section").html()); $("#content_form_popup").val($("#center-div").html()); $("#head_form_popup").val($("head").html()); $('#actions_print_form').attr('action','/modules/tools/_components/pdfExport.php'); $('#actions_print_form').submit(); clearActionsRightForm(); } function validateContactsForm(url) { $('#errorMessage').remove(); $('#successMessage').remove(); $('#Msg').remove(); $('#contact-result-message').remove(); var name=document.contact_form.name.value; var surname=document.contact_form.surname.value; var mail=document.contact_form.mail.value; var phone=document.contact_form.phone.value; var address=document.contact_form.address.value; var postal_code=document.contact_form.postal_code.value; var city=document.contact_form.city.value; var country=document.contact_form['country']; var empty=''; var error_non_numeric=''; var error_numeric=''; var wrong_format=''; var select_an_option=''; var error_max_length=''; var name_label=''; var surname_label=''; var phone_label=''; var postal_label=''; var mail_label = ''; var country_label = ''; //var category_label = ''; var city_label = ''; var message_errors = ''; $('#contact-form-name-input').css("border","1px solid #72A7D1"); $('#contact-form-surname-input').css("border","1px solid #72A7D1"); $('#contact-form-country-input').css("border","1px solid #72A7D1"); $('#contact-form-mail-input').css("border","1px solid #72A7D1"); if (mail=='') { $('#contact-form-mail-input').css("border","1px solid #ff0000"); message_errors += mail_label + ': ' + empty + '
'; } if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)){ $('#contact-form-mail-input').css("border","1px solid #ff0000"); message_errors += mail_label + ': ' + wrong_format + '
'; } if (name=='') { $('#contact-form-name-input').css("border","1px solid #ff0000"); message_errors += name_label + ': ' + empty + '
'; } if (validaCaracteresAlfabeticos(name)) { $('#contact-form-name-input').css("border","1px solid #ff0000"); message_errors += name_label + ': ' + error_non_numeric + '
'; } if (surname=='') { $('#contact-form-surname-input').css("border","1px solid #ff0000"); message_errors += surname_label + ': ' + empty + '
'; } if (validaCaracteresAlfabeticos(surname)) { $('#contact-form-surname-input').css("border","1px solid #ff0000"); message_errors += surname_label + ': ' + error_non_numeric + '
'; } if (country.selectedIndex==-1) { $('#contact-form-country-input').css("border","1px solid #ff0000"); message_errors += country_label + ': ' + empty + '
'; } /* if(typeof(document.contact_form['category[]'])!='undefined'){ if (category.selectedIndex==-1) { $('#contact-form-category-input').css("border","1px solid #ff0000"); message_errors += category_label + ': ' + select_an_option + '
'; } }*/ /* if (phone != ''){ if(isNaN(phone)){ $('#contact-form-phone-input').css("border","1px solid #ff0000"); message_errors += phone_label + ': ' + error_numeric + '
'; } else{ $('#contact-form-phone-input').css("border","1px solid #72A7D1"); } } */ if (phone != ''){ if(phone.length>30){ $('#contact-form-phone-input').css("border","1px solid #ff0000"); message_errors += phone_label + ': ' + error_numeric + '
'; } else{ $('#contact-form-phone-input').css("border","1px solid #72A7D1"); } } if (postal_code != ''){ if(isNaN(postal_code)){ $('#contact-form-postal-input').css("border","1px solid #ff0000"); message_errors += postal_label + ': ' + error_max_length + '
'; } else{ $('#contact-form-postal-input').css("border","1px solid #72A7D1"); } } if(message_errors != ''){ errorMessage('/modules/tools/_views/error_popup.php',500,400,message_errors); return false; } else{ var currentForm=$('#contact_form');$('#Msg').remove(); $.ajax({ url: url, cache:false, type:"POST", data:($(currentForm).serializeArray()), beforeSend:function(){ $('#contact-button-cell').prepend('Loading...'); }, complete:function(){ $('#loading-msg').remove(); }, success:function(data){ $('#contact-button-cell').append(''); if($('#successMessage').size()>=1){ document.getElementById('contact_form').reset(); popup('/modules/contactform_investor/_views/confirmSend.php'); return true; } else{ $('#contact-button-cell').prepend($('#errorMessage').html()); return false; } }, error:function(){ alert("");} }); } } function validateContactForm() { $('#errorMessage').remove(); $('#successMessage').remove(); var name=document.contact_form.name.value; var surname=document.contact_form.surname.value; var mail=document.contact_form.mail.value; var phone=document.contact_form.phone.value; var country=document.contact_form.country.value; var company=document.contact_form.company.value; var obs=document.contact_form.contact_message.value; var empty=''; var error_non_numeric=''; var error_numeric=''; var wrong_format=''; var name_label=''; var surname_label=''; var phone_label=''; $('#contact-form-name-input').css("border","1px solid #72A7D1"); $('#contact-form-surname-input').css("border","1px solid #72A7D1"); $('#contact-form-company-input').css("border","1px solid #72A7D1"); $('#contact-form-mail-input').css("border","1px solid #72A7D1"); $('#contact-name-empty-error').remove(); $('#contact-name-non-numeric-error').remove(); $('#contact-surname-empty-error').remove(); $('#contact-surname-non-numeric-error').remove(); $('#contact-company-empty-error').remove(); $('#contact-mail-empty-error').remove(); $('#contact-mail-format-error').remove(); if (mail=='') { $('#contact-form-mail-input').css("border","1px solid #ff0000"); $('#contact-form-mail-row').append(''+empty+''); $('#contact-form-mail-input').focus(); return; } if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)){ $('#contact-form-mail-row').append(''+wrong_format+''); $('#contact-form-mail-input').css("border","1px solid #ff0000"); $('#contact-form-mail-input').focus(); return; } if (name=='') { $('#contact-form-name-input').css("border","1px solid #ff0000"); $('#contact-form-name-row').append(''+empty+''); $('#contact-form-name-input').focus(); return; } if (validaCaracteresAlfabeticos(name)) { $('#contact-form-name-row').append(''+error_non_numeric+''); $('#contact-form-name-input').css("border","1px solid #ff0000"); $('#contact-form-name-input').focus(); return; } if (surname=='') { $('#contact-form-surname-input').css("border","1px solid #ff0000"); $('#contact-form-surname-row').append(''+empty+''); $('#contact-form-surname-input').focus(); return; } if (validaCaracteresAlfabeticos(surname)) { $('#contact-form-surname-input').css("border","1px solid #ff0000"); $('#contact-form-surname-row').append(''+error_non_numeric+''); $('#contact-form-surname-input').focus(); return; } if (company=='') { $('#contact-form-company-input').css("border","1px solid #ff0000"); $('#contact-form-company-row').append(''+empty+''); $('#contact-form-company-input').focus(); return; } var currentForm=$('#contact_form');$('#Msg').remove(); $.ajax({ url:'/modules/tools/contact.php', cache:false, type:"POST", data:($(currentForm).serializeArray()), beforeSend:function(){$('#contact-button-cell').prepend('Loading...');}, complete:function(){$('#loading-msg').remove();}, success:function(data){$('body').append(data);if($('#errorMessage').size()>0){$('#contact-button-cell').prepend('
'+$('#errorMessage').attr('text')+'
');$('#errorMessage').remove();}else{$('#contact-button-cell').prepend('
'+$('#successMessage').attr('text')+'
');$('#successMessage').remove();document.getElementById('contact_form').reset();}}, Error:function(){alert("");} }); } function validateRegisterForm () { $('#Msg').remove(); $('#register-message-cell').html(''); $('#errorMessage').remove(); $('#successMessage').remove(); var mail=document.register_form.mail.value; var password=document.register_form.password.value; var passwordcheck=document.register_form.passwordcheck.value; var name=document.register_form.name.value; var surname=document.register_form.surname.value; var empty=''; var match=''; var error_non_numeric=''; var error_numeric=''; var wrong_format=''; var name_label=''; var surname_label=''; $('#register-form-mail-input').css("border","1px solid #72A7D1"); $('#register-form-name-input').css("border","1px solid #72A7D1"); $('#register-form-surname-input').css("border","1px solid #72A7D1"); $('#register-form-password-input').css("border","1px solid #72A7D1"); $('#register-form-passwordcheck-input').css("border","1px solid #72A7D1"); $('#mail-empty-error').remove(); $('#mail-format-error').remove(); $('#password-empty-error').remove(); $('#passwordcheck-empty-error').remove(); $('#password-match-error').remove(); $('#name-empty-error').remove(); $('#name-non-numeric-error').remove(); $('#surname-empty-error').remove(); $('#surname-non-numeric-error').remove(); // mail if(mail==''){ $('#register-form-mail-input').css("border","1px solid #ff0000"); $('#register-message-cell').append(''+empty+''); $('#register-form-mail-input').focus(); return; } else { if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)){ $('#register-message-cell').append(''+wrong_format+''); $('#register-form-mail-input').css("border","1px solid #ff0000"); $('#register-form-mail-input').focus(); return; } } // password if(password==''){ $('#register-form-password-input').css("border","1px solid #ff0000"); $('#register-message-cell').append(''+empty+''); $('#register-form-password-input').focus(); return; } // passwordcheck if(passwordcheck==''){ $('#register-form-passwordcheck-input').css("border","1px solid #ff0000"); $('#register-message-cell').append(''+empty+''); $('#register-form-passwordcheck-input').focus(); return; } // password match if(password!=passwordcheck){ $('#register-form-password-input').css("border","1px solid #ff0000"); $('#register-form-passwordcheck-input').css("border","1px solid #ff0000"); $('#register-message-cell').append(''+match+''); $('#register-form-password-input').focus(); return; } // name if (name=='') { $('#register-form-name-input').css("border","1px solid #ff0000"); $('#register-message-cell').html(''+empty+''); $('#register-form-name-input').focus(); return; } else { if (validaCaracteresAlfabeticos(name)){ $('#register-message-cell').html(''+error_non_numeric+''); $('#register-form-name-input').css("border","1px solid #ff0000"); $('#register-form-name-input').focus(); return; } } // surname if(surname==''){ $('#register-form-surname-input').css("border","1px solid #ff0000"); $('#register-message-cell').append(''+empty+''); $('#register-form-surname-input').focus() return; } else { if(validaCaracteresAlfabeticos(surname)){ $('#register-message-cell').append(''+error_non_numeric+''); $('#register-form-surname-input').css("border","1px solid #ff0000"); $('#register-form-surname-input').focus() return; } } var currentPopup=PopupManager.getActive(); var currentForm=$(currentPopup.getSelector()+' #register_form')[0]; $.ajax({ url:"/modules/users/register.php", cache:false, type:"POST", data:($(currentForm).serializeArray()), beforeSend:function(){ $('#register-button-cell').prepend('Loading...'); }, complete:function(){ $('#loading-msg').remove(); }, success:function(data){ $('body').append(data); if($('#errorMessage').size()>0){ $('#register-message-cell').html('
'+$('#errorMessage').attr('text')+'
'); $('#errorMessage').remove(); } else { $('#login2').html('
'+$('#successMessage').attr('text')+'
'); $('#successMessage').remove(); } }, error:function(){ alert(""); } }); } function paginar(pagina,archivo,div){$.ajax({url:archivo+"?page="+pagina,cache:false,type:"GET",beforeSend:function(){$('#'+div).html('');$('#'+div).append('Loading...');},complete:function(){$('#loading-msg').remove();},success:function(data){$('#'+div).html(data);},error:function(){alert("");}});} function paginarGal(pagina,seccion,archivo,div){$.ajax({url:archivo+"?pageGal="+pagina+"&seccion="+seccion,cache:false,type:"GET",beforeSend:function(){$('#'+div).html('');$('#'+div).append('Loading...');},complete:function(){$('#loading-msg').remove();},success:function(data){$('#'+div).html(data);},error:function(){alert("");}});} function validateForgotForm(){$('#errorMessage').remove();$('#successMessage').remove();$('#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').css("border","1px solid #ff0000");$('#forgot-message-cell').append(''+empty+'');$('#forgot-form-mail-input').focus();}} else{$('#forgot-form-mail-input').css("border","1px solid #72A7D1");$('#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(''+wrong_format+'');} $('#forgot-form-mail-input').css("border","1px solid #ff0000");$('#forgot-form-mail-input').focus();}} else{$('#forgot-form-mail-row').css("border","1px solid #72A7D1");$('#forgot-mail-format-error').remove();var currentPopup=PopupManager.getActive();var currentForm=$(currentPopup.getSelector()+' #forgot_password_form')[0];$.ajax({url:"/modules/users/restore.php",cache:false,type:"POST",data:($(currentForm).serializeArray()),beforeSend:function(){$('#forgot-pass-cell').prepend('Loading...');},complete:function(){$('#loading-msg').remove();},success:function(data){$('body').append(data);if($('#errorMessage').size()>0){$('#forgot-message-cell').html('
'+$('#errorMessage').attr('text')+'
');$('#errorMessage').remove();} else{$('#login').html('
'+$('#successMessage').attr('text')+'
');$('#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:"/modules/users/unregister.php"});p.draw();} function unregister(){$('#errorMessage').remove();$('#successMessage').remove();var currentPopup=PopupManager.getActive();var currentForm=$(currentPopup.getSelector()+' #unregister_form')[0];$('#Msg').remove();$.ajax({url:"/modules/users/unregister.php?confirm=1",cache:false,type:"POST",beforeSend:function(){$('#unregister_button').append('Loading...');},complete:function(){$('#loading-msg').remove();},success:function(data){$('body').append(data);if($('#errorMessage').size()>0){$('#unregister-message-cell').html('
'+$('#errorMessage').attr('text')+'
');$('#errorMessage').remove();} else{$('#unregister').html('
'+$('#successMessage').attr('text')+'
');$('#successMessage').remove();}},error:function(){alert("");}});} function autentication(current_url){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();} function register(){var p=PopupManager.create();p.configure({type:'users',modal:true,width:572,height:630,top:40,bg:'light',url:'/modules/users/register.php'});p.draw();} function gallery(image){var p=PopupManager.create();p.configure({type:'users',modal:true,width:572,height:630,top:40,bg:'light',url:'/modules/gallery/_components/popup.php?image='+image});p.draw();} function forgot_password(){var p=PopupManager.create();p.configure({type:'users',modal:true,width:572,height:340,bg:'light',url:'/modules/users/restore.php'});p.draw();} function legalAdvise(){var p=PopupManager.create();p.configure({type:'legal',modal:true,width:572,height:600,bg:'light',url:'/src/legal.php'});p.draw();} function desplegar(elemento){document.getElementById(elemento).style.display='block';} function ocultar(elemento){document.getElementById(elemento).style.display='none';} 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+''} $(document).ready(function(){$('#current-font-size').html(16);$('#current-font-size-em').html(1);});function increaseFont(increment,option){var currEm=parseFloat($('#current-font-size-em').html());if(typeof increment=='undefined'){newSize='1em';} else{if(option=='decrease'){var newEm=currEm-increment;} else{var newEm=currEm+increment;} if(newEm>1.54||newEm<0.46){newSize=currEm+'em';} else{var newFontSize=newEm;newSize=newFontSize+'em';}} $('body').css('font-size',newSize);$('#current-font-size-em').html(newSize);} function reloj(){var fObj=new Date();var horas=fObj.getHours();var minutos=fObj.getMinutes();var segundos=fObj.getSeconds();if(horas<=9)horas="0"+horas;if(minutos<=9)minutos="0"+minutos;if(segundos<=9)segundos="0"+segundos;$('#date').html('');$('#date').html(''+horas+':'+minutos+':'+segundos+'');setTimeout("reloj()",1000);} function recommend(){var p=PopupManager.create();p.configure({type:'users',modal:true,width:572,height:400,bg:'light',url:'/modules/tools/recommend.php'});p.draw();} function popup(url){var p=PopupManager.create();p.configure({type:'users',modal:true,width:572,height:400,bg:'light',url:url});p.draw();} function sendRecommendation(){$('#errorMessage').remove();$('#successMessage').remove();$('#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='';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 :text').css("border","1px solid #72A7D1");$('#recommend-form-name-from-input').css("border","1px solid #ff0000");$('#recommend-message-cell').html(''+empty+'');$('#recommend-form-name-from-input').focus();}} else{$('#recommend-form-name-from-input').css("border","1px solid #72A7D1");$('#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').html(''+error_non_numeric+'');} $('#recommend-form-name-from-input').css("border","1px solid #ff0000");$('#recommend-form-name-from-input').focus();}} else{if(from_name==''){} else{$('#recommend-form-name-from-input').css("border","1px solid #72A7D1");$('#recommend-namefrom-non-numeric-error').remove();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').css("border","1px solid #ff0000");$('#recommend-message-cell').html(''+empty+'');$('#recommend-form-to-name-input').focus();}} else{$('#recommend-form-to-name-input').css("border","1px solid #72A7D1");$('#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').html(''+error_non_numeric+'');} $('#recommend-form-to-name-input').css("border","1px solid #ff0000");$('#recommend-form-to-name-input').focus();}} else{if(to_name==''){} else{$('#recommend-form-to-name-input').css("border","1px solid #72A7D1");$('#recommend-nameto-non-numeric-error').remove();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').css("border","1px solid #ff0000");$('#recommend-message-cell').html(''+empty+'');$('#recommend-form-mail-from-input').focus();}} else{$('#recommend-form-mail-from-input').css("border","1px solid #72A7D1");$('#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').html(''+wrong_format+'');} $('#recommend-form-mail-from-input').css("border","1px solid #ff0000");$('#recommend-form-mail-from-input').focus();}} else{$('#recommend-form-mail-from-input').css("border","1px solid #72A7D1");$('#recommend-mailfrom-format-error').remove();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').css("border","1px solid #ff0000");$('#recommend-message-cell').html(''+empty+'');$('#recommend-form-to-mail-input').focus();}} else{$('#recommend-form-to-mail-input').css("border","1px solid #72A7D1");$('#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').html(''+wrong_format+'');} $('#recommend-form-to-mail-input').css("border","1px solid #ff0000");$('#recommend-form-to-mail-input').focus();}} else{$('#recommend-form-to-mail-input').css("border","1px solid #72A7D1");$('#recommend-mailto-format-error').remove();var currentPopup=PopupManager.getActive();var currentForm=$(currentPopup.getSelector()+' #recommend_form')[0];$.ajax({url:"/modules/tools/recommend.php",cache:false,type:"POST",data:($(currentForm).serializeArray()),beforeSend:function(){$('#recommend-cell').prepend('Loading...');},complete:function(){$('#loading-msg').remove();},success:function(data){$('body').append(data);if($('#errorMessage').size()>0){$('#recommend-message-cell').html('
'+$('#errorMessage').attr('text')+'
');$('#errorMessage').remove();} else{$('#recommend-message-cell').html('
'+$('#successMessage').attr('text')+'
');$('#successMessage').remove();$('#recommend-form-to-name-input').val('');$('#recommend-form-to-mail-input').val('');}},error:function(){alert("");}});}}}}}}}}}}} function enviarPregunta(){$('#errorMessage').remove();$('#successMessage').remove();var name=document.helpcenter_form.name.value;var mail=document.helpcenter_form.mail.value;var question=document.helpcenter_form.question.value;var company=document.helpcenter_form.company.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').css("border","1px solid #FF0000");$('#helpc-form-question-row').append(''+empty+'');$('#helpc-form-question-input').focus();}} else{$('#helpc-form-question-input').css("border","1px solid #72A7D1");$('#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').css("border","1px solid #FF0000");$('#helpc-form-name-row').append(''+empty+'');$('#helpc-form-name-input').focus();}} else{$('#helpc-form-name-input').css("border","1px solid #72A7D1");$('#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(''+error_non_numeric+'');} $('#helpc-form-name-input').css("border","1px solid #FF0000");$('#helpc-form-name-input').focus();}} else{if(name==''){} else{$('#helpc-form-name-input').css("border","1px solid #72A7D1");$('#helpc-name-non-numeric-error').remove();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').css("border","1px solid #FF0000");$('#helpc-form-mail-row').append(''+empty+'');$('#helpc-form-mail-input').focus();}} else{$('#helpc-form-mail-input').css("border","1px solid #72A7D1");$('#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(''+wrong_format+'');} $('#helpc-form-mail-input').css("border","1px solid #FF0000");$('#helpc-form-mail-input').focus();}} else{$('#helpc-form-mail-input').css("border","1px solid #72A7D1");$('#helpc-mail-format-error').remove();var validCompany=validaCaracteresAlfabeticos(company);if(validCompany==true){if($('#helpc-name-non-numeric-error').size()==0){$('#helpc-form-company-row').append(''+error_non_numeric+'');} $('#helpc-form-company-input').css("border","1px solid #FF0000");$('#helpc-form-company-input').focus();} else{$('#helpc-form-company-input').css("border","1px solid #72A7D1");$('#helpc-company-non-numeric-error').remove();var currentForm=$('#helpcenter_form');$('#Msg').remove();$.ajax({url:"/modules/help/index.php",cache:false,type:"POST",data:($(currentForm).serializeArray()),beforeSend:function(){$('#question-cell').append('Loading...');},complete:function(){$('#loading-msg').remove();},success:function(data){$('body').append(data);if($('#errorMessage').size()>0){$(currentForm).prepend('
'+$('#errorMessage').attr('text')+'
');$('#errorMessage').remove();} else{$(currentForm).prepend('
'+$('#successMessage').attr('text')+'
');$('#successMessage').remove();}},error:function(){alert("");}});}}}}}}}} 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=[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];for(i=0;i');},complete:function(){$('#loading-msg').remove();},success:function(data){$('#experimenta-content').html(data);},error:function(){alert("");}});} function displayProjection(fileid){$.ajax({url:"/projections/display_projection.php",cache:false,type:"POST",data:{pfwid:fileid},beforeSend:function(){$('#proyeccion-movie').html('');$('#proyeccion-movie').prepend('Loading...');},complete:function(){$('#loading-msg').remove();},success:function(data){$('#proyeccion-movie').html(data);},error:function(){alert("");}});} function PFWLOGIN_validate (theform) { var uservalue = theform.pfwlogin_user.value; var passwordvalue = theform.pfwlogin_password.value; var user_label = ''; var password_label = ''; var errors_found = ''; var empty = ''; if (uservalue == ""){ if($('#login-user-empty-error').size() == 0){ $('#login-user-input').attr("style","border: 1px solid #ff0000"); $('#login-message-cell').append(''+empty+''); $('#login-user-input').focus(); } return false; } else{ $('#login-user-input').attr("style","border: 1px solid #a9a9a9"); $('#login-user-empty-error').remove(); if (passwordvalue == ""){ if($('#login-password-empty-error').size() == 0){ $('#login-password-input').attr("style","border: 1px solid #ff0000"); $('#login-message-cell').append(''+empty+''); $('#login-password-input').focus(); } return false; } else{ $('#login-password-input').attr("style","border: 1px solid #a9a9a9"); $('#login-password-empty-error').remove(); return true; } } } function sendLoginForm(theform){ return PFWLOGIN_validate(theform); } function discriminebrowsers(){ var userAgent = navigator.userAgent.toLowerCase(); $.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase()); // Is this a version of IE? if($.browser.msie){ $('body').addClass('browserIE'); // Add the version number $('body').addClass('browserIE' + $.browser.version.substring(0,1)); } // Is this a version of Chrome? if($.browser.chrome){ $('body').addClass('browserChrome'); //Add the version number userAgent = userAgent.substring(userAgent.indexOf('chrome/') +7); userAgent = userAgent.substring(0,1); $('body').addClass('browserChrome' + userAgent); // If it is chrome then jQuery thinks it's safari so we have to tell it it isn't $.browser.safari = false; } // Is this a version of Safari? if($.browser.safari){ $('body').addClass('browserSafari'); // Add the version number userAgent = userAgent.substring(userAgent.indexOf('version/') +8); userAgent = userAgent.substring(0,1); $('body').addClass('browserSafari' + userAgent); } // Is this a version of Mozilla? if($.browser.mozilla){ //Is it Firefox? if(navigator.userAgent.toLowerCase().indexOf('firefox') != -1){ $('body').addClass('browserFirefox'); // Add the version number userAgent = userAgent.substring(userAgent.indexOf('firefox/') +8); userAgent = userAgent.substring(0,1); $('body').addClass('browserFirefox' + userAgent); } // If not then it must be another Mozilla else{ $('body').addClass('browserMozilla'); } } // Is this a version of Opera? if($.browser.opera){ $('body').addClass('browserOpera'); } } $(document).ready(function(){ discriminebrowsers(); actualizaForms(); actualizaLinks(); $("#login-form #login-user-input").focus(); //Menu Principal Last Li border $('#menu-up .multi-menu > li:last').css('border','0px'); $(".module").click(function(event) { $(this).find(".content-02").toggle(); if($(this).find(".div-image").is(".more-img")){ $(this).find(".div-image").removeClass("more-img"); $(this).find(".div-image").addClass("less-img"); return false; } if($(this).find(".div-image").is(".less-img")){ $(this).find(".div-image").removeClass("less-img"); $(this).find(".div-image").addClass("more-img"); return false; } return false; }); }); function displaySubMenu(elementId){ $('#'+elementId).show(); } function hideSubMenu(elementId){ $('#'+elementId).hide(); } function toggleMenuItem(elementId){ $('#'+elementId).parent().siblings().children('ul').each(function(){ if($(this).attr('id') != elementId){ $(this).hide('fast'); $(this).parent().children('.collapse_button').attr('class','expand_button'); } }); $('#'+elementId).slideToggle("fast"); if($('#'+elementId).parent().children('.expand_button').size() > 0){ $('#'+elementId).parent().children('.expand_button').attr('class','collapse_button'); }else{ $('#'+elementId).parent().children('.collapse_button').attr('class','expand_button'); } } function navigatePage(numeroPagina){ document.getElementById('txtPage').value = numeroPagina; document.getElementById('form_pager').submit(); } /* function topic_select(id_topic){ $(".topic_head").hide(); $("#"+id_topic).show(); } */ function newsByTopic(newId){ document.getElementById('txtNewTopic').value = newId; document.getElementById('frmNewsByTopicMenu').submit(); } function NewsDetailReturn(){ document.getElementById('frmNewsDetail').submit(); } function explode (delimiter, string, limit){ var emptyArray = { 0: '' }; // third argument is not required if ( arguments.length < 2 || typeof arguments[0] == 'undefined' || typeof arguments[1] == 'undefined' ) { return null; } if ( delimiter === '' || delimiter === false || delimiter === null ) { return false; } if ( typeof delimiter == 'function' || typeof delimiter == 'object' || typeof string == 'function' || typeof string == 'object' ) { return emptyArray; } if ( delimiter === true ) { delimiter = '1'; } if (!limit) { return string.toString().split(delimiter.toString()); } else { // support for limit argument var splitted = string.toString().split(delimiter.toString()); var partA = splitted.splice(0, limit - 1); var partB = splitted.join(delimiter.toString()); partA.push(partB); return partA; } } function var_dump(obj) { if(typeof obj == "object") { return "Type: "+typeof(obj)+((obj.constructor) ? "\nConstructor: "+obj.constructor : "")+"\nValue: " + obj; } else { return "Type: "+typeof(obj)+"\nValue: "+obj; } }//end function var_dump function clearMe(formfield){ if (formfield.defaultValue==formfield.value){ formfield.value = "" } } function trimString(myString){ return myString.replace(/^\s+/g,'').replace(/\s+$/g,'') } function redirect(url){ window.location = url; } //validación dni function validar_DNI_NIE(dni) { if( dni.length != 9 ) return false; var valDNI = true; var valNIE = true; // Validamos DNI if ( isNaN( dni.substring(0,dni.length-1)) ) { if(dni.substring(0,1)!='X') { valDNI = false; } else { dni='0'+dni.substring(1,dni.length); } } if ( valDNI && !isNaN( dni.substring(dni.length-1,dni.length) ) ) { valDNI = false; } if ( valDNI ) { var cadena="TRWAGMYFPDXBNJZSQVHLCKET"; var posicion = dni.substring(0,dni.length-1) % 23; var letra = cadena.substring(posicion,posicion+1) if (letra!=dni.substring(dni.length-1,dni.length)) { valDNI = false; } } if ( valDNI ) return true; // Validamos NIE // Primer caracter letra if ( !isNaN( dni.charAt(0) ) ) { valNIE = false; } // Útimo caracter letra if ( valNIE && !isNaN( dni.substring(dni.length-1,dni.length) ) ) { valNIE = false; } // Intermedios números if ( valNIE && isNaN( dni.substring( 1, dni.length-1 ) ) ) { valNIE = false; } if ( valDNI || valNIE ) { return true; } return false; } /* * Show or hide a div that covers the entire site */ function displayCoverAllDiv(){ if($('.cover-all-div').css('display')=='none'){ $('.cover-all-div').show(); $('.cover-all-div').height($(document).height()); $('.cover-all-div').width($(document).width()); } else{ $('.cover-all-div').hide(); } } /* * Show or hide a loading image over the cover-all-div */ function displayLoadingImage(){ if($('.loading-image').css('display')=='none'){ $('.loading-image').show(); centerDomElement('.loading-image'); } else{ $('.loading-image').hide(); } } function centerDomElement(element){ //Placing the popup if there's scroll var screenWidth = screen.width; var width = $(element).width(); docWidth = $(document).width(); docHeight = $(document).height(); //Scroll Check var ScrollTop = document.body.scrollTop; var ScrollLeft = document.body.scrollLeft; if (ScrollTop == 0) { if (window.pageYOffset) ScrollTop = window.pageYOffset; else ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0; } if (ScrollLeft == 0) { if (window.pageXOffset) ScrollLeft = window.pageXOffset; else ScrollLeft = (document.body.parentElement) ? document.body.parentElement.scrollLeft : 0; } leftDistance = (screenWidth/2) - (width/2) + ScrollLeft; topDistance = 120 + ScrollTop; $(element).css('left',leftDistance + 'px'); $(element).css('top',topDistance + 'px'); } function hidePopup(popupId){ $('div[popupId="'+popupId+'"]').hide(); displayCoverAllDiv(); } function loadGallery(elementId,elementType){ popupWindowElement = $('div[popupId="'+elementType+'_'+elementId+'"]'); if(popupWindowElement.size() <= 0){ $.ajax({ url: "/_views/gallery.php", cache:false, type:"POST", data: {elementId: elementId, elementType: elementType}, beforeSend:function(){ displayLoadingImage(); displayCoverAllDiv(); }, complete:function(){ displayLoadingImage(); centerDomElement('div[popupId="'+elementType+'_'+elementId+'"]'); }, success:function(data){ $('body').append(data); }, error:function(){ alert('connection error');} }); } else{ displayCoverAllDiv(); popupWindowElement.show(); centerDomElement('div[popupId="'+elementType+'_'+elementId+'"]'); } } function updateGalleryBigImage(imgSrc,imgTitle,selectedImage,elementType,elementId){ //big image source $('div#popup[popupId="'+elementType+'_'+elementId+'"] #gallery_big_image').attr('src',imgSrc); //image id (for image navigator) $('div#popup[popupId="'+elementType+'_'+elementId+'"] #gallery_big_image').attr('elementId',selectedImage); //image Title $('div#popup[popupId="'+elementType+'_'+elementId+'"] #gallery_image_title div').html(imgTitle); } function galleryMoveThumb(action,elementType,elementId){ currentImage = parseInt($('div#popup[popupId="'+elementType+'_'+elementId+'"] #gallery_big_image').attr('elementId')); if(action == 'previous'){ currentImageIndex = (currentImage-1); } else{ currentImageIndex = (currentImage+1); } if($('div#popup[popupId="'+elementType+'_'+elementId+'"] .preview a[elementId="'+currentImageIndex+'"]').size() > 0){ //image id (for navigator) selectedImage = $('div#popup[popupId="'+elementType+'_'+elementId+'"] .preview a[elementId="'+currentImageIndex+'"]').attr('elementId'); $('div#popup[popupId="'+elementType+'_'+elementId+'"] #gallery_big_image').attr('elementId',selectedImage); //trigger click event as if it were in the image strip $('div#popup[popupId="'+elementType+'_'+elementId+'"] .preview a[elementId="'+currentImageIndex+'"]').trigger('click'); } }