var BB_ALLOW_AJAX = false; window.addEvent('domready', function() { if (BB_ALLOW_AJAX) $('bb_form').setProperty('action', 'ajax_sendbboardform'); if ($('bb_name') != null) { $('bb_name').addEvent('focus', function(e) { if(this.value == 'Vaše jméno') this.value=''; }); $('bb_name').addEvent('blur', function(e) { if(this.value == '') this.value='Vaše jméno'; }); } if ($('bb_title') != null) { $('bb_title').addEvent('focus', function(e) { if(this.value == 'Nadpis zprávy') this.value=''; }); $('bb_title').addEvent('blur', function(e) { if(this.value == '') this.value='Nadpis zprávy'; }); } if ($('bb_question') != null) { $('bb_question').addEvent('focus', function(e) { if(this.value == 'Váš vzkaz') this.value=''; }); $('bb_question').addEvent('blur', function(e) { if(this.value == '') this.value='Váš vzkaz'; }); } if ($('bb_liame') != null) { $('bb_liame').addEvent('focus', function(e) { if(this.value == 'Váš e-mail') this.value=''; }); $('bb_liame').addEvent('blur', function(e) { if(this.value == '') this.value='Váš e-mail'; }); } $('bb_form').addEvent('submit', function(e) { /** * Prevent the submit event */ if (BB_ALLOW_AJAX) new Event(e).stop(); /*KONTOLA SPRAVNOSTI FORMULARE*/ var alerttext = ""; //email regExpPatternemail=/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$/ if (this.bb_title != null) with (this.bb_title) { if (value==null || value=="" || value=="Nadpis zprávy") alerttext += "Povinná položka 'Nadpis zprávy'.\n"; } if (this.bb_liame != null) with (this.bb_liame) { if (value==null || value=="" || value=="Váš e-mail") alerttext += "Povinná položka 'Váš e-mail'.\n"; else if (!regExpPatternemail.test(value)) alerttext += "Nesprávný formát položky 'Váš e-mail'\n"; } if (this.bb_name != null) with (this.bb_name) { if (value==null || value=="" || value=="Vaše jméno") alerttext += "Povinná položka 'Vaše jméno'.\n"; } if (this.bb_question != null) with (this.bb_question) { if (value==null || value=="" || value=="Váš vzkaz") alerttext += "Povinná položka 'Váš vzkaz'.\n"; } if (alerttext.length > 0) { //alert(alerttext); $('log').empty().set('html', '
'); return false; } if (BB_ALLOW_AJAX) { /** * This empties the log and shows the spinning indicator */ var log = $('log').empty().addClass('ajaxLoading'); var action = this.getProperty('action'), method = this.getProperty('method'); this.set('send', { url: action, method: method, update: $('log'), onComplete: function(response) { log.removeClass('ajaxLoading'); $('log').set('html',response); } }); this.send(); // now it knows how to send it... } }); });