function wfg_is_valid_asztalfoglalas_name(el){if(el.toString().match(/^.{2,}$/i)){return true;}return false;}
function wfg_is_valid_asztalfoglalas_firstname(el){if(el.toString().match(/^.{2,}$/i)){return true;}return false;}
function wfg_is_valid_asztalfoglalas_city(el){if(el.toString().match(/^.{2,}$/i)){return true;}return false;}
function wfg_is_valid_asztalfoglalas_person_nr(el){if(el.toString().match(/^[0-9]+$/i)){return true;}return false;}
function wfg_is_valid_asztalfoglalas_street(el){if(el.toString().match(/^.{4,}$/i)){return true;}return false;}
function wfg_is_valid_asztalfoglalas_postalcode(el){if(el.toString().match(/^[0-9]{4,}$/i)){return true;}return false;}
function wfg_is_valid_asztalfoglalas_phone(el){if(el.toString().match(/^[\d\.\/\(\) +-]{7,}$/i)){return true;}return false;}
function wfg_asztalfoglalas_form_submit(e){var error=false;document.getElementById('asztalfoglalas_person_nr_block').className='valid';
document.getElementById('asztalfoglalas_name_block').className='valid';
if(!wfg_is_valid_asztalfoglalas_name(document.getElementById('asztalfoglalas_name').value)){document.getElementById('asztalfoglalas_name_block').className='error';error=true;}document.getElementById('asztalfoglalas_firstname_block').className='valid';
if(!wfg_is_valid_asztalfoglalas_firstname(document.getElementById('asztalfoglalas_firstname').value)){document.getElementById('asztalfoglalas_firstname_block').className='error';error=true;}
document.getElementById('asztalfoglalas_person_nr_block').className='valid';
if(!wfg_is_valid_asztalfoglalas_person_nr(document.getElementById('asztalfoglalas_person_nr').value)){document.getElementById('asztalfoglalas_person_nr_block').className='error';error=true;}
document.getElementById('asztalfoglalas_city_block').className='valid';
if(!wfg_is_valid_asztalfoglalas_city(document.getElementById('asztalfoglalas_city').value)){document.getElementById('asztalfoglalas_city_block').className='error';error=true;}document.getElementById('asztalfoglalas_street_block').className='valid';
if(!wfg_is_valid_asztalfoglalas_street(document.getElementById('asztalfoglalas_street').value)){document.getElementById('asztalfoglalas_street_block').className='error';error=true;}document.getElementById('asztalfoglalas_postalcode_block').className='valid';
if(!wfg_is_valid_asztalfoglalas_postalcode(document.getElementById('asztalfoglalas_postalcode').value)){document.getElementById('asztalfoglalas_postalcode_block').className='error';error=true;}document.getElementById('asztalfoglalas_phone_block').className='valid';
if(!wfg_is_valid_asztalfoglalas_phone(document.getElementById('asztalfoglalas_phone').value)){document.getElementById('asztalfoglalas_phone_block').className='error';error=true;}
if(error){alert('Kérjük valamennyi mezőt kitölteni!');if(e&&e.preventDefault){ e.preventDefault();}return false;}/*document.getElementById('asztalfoglalas_form').submit();*/}
function setBaseDate(){
var now=new Date();
$('asztalfoglalas_date_year').value=now.getFullYear();
if(now.getMonth()+1<10){$('asztalfoglalas_date_month').value="0"+(now.getMonth()+1);}
else{$('asztalfoglalas_date_month').value=""+(now.getMonth()+1);}
if(now.getDate()<10){$('asztalfoglalas_date_day').value="0"+(now.getDate());}
else{$('asztalfoglalas_date_day').value=""+(now.getDate());}
}
function addEvent(obj,evType,fn){if(obj.addEventListener){obj.addEventListener(evType,fn,false);return true;}else if(obj.attachEvent){return obj.attachEvent('on'+evType,fn);}return false;}
function wfg_asztalfoglalas_load_events(){setBaseDate();addEvent(document.getElementById('asztalfoglalas_submit'),'click',wfg_asztalfoglalas_form_submit);}addEvent(window,'load',wfg_asztalfoglalas_load_events);

