version = navigator.appVersion.toLowerCase();
agent = navigator.userAgent.toLowerCase();
ie = (version.indexOf('msie')>-1);
win = (version.indexOf('windows')>-1);
opera = (agent.indexOf('opera')>-1);

function fav() {
if ((opera) && (win)) return false;
else if ((ie) && (win)) document.write('\074a class="fav" href=\"javascript:gofav();\"\076Přidat k oblíbeným\074/a\076');
}
function gofav() {
window.external.addFavorite('http://www.hotel-esprit.cz/','Hotel Esprit');
}

function trim(dlh){
  dlh=dlh.replace(/^[\s]+/g,"");
  dlh=dlh.replace(/[\s]+$/g,"");
  return dlh;
}

function isMail(email){
  var mailE=new RegExp("^[_a-zA-Z0-9\.\-]+@[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}$");
  return mailE.test(email);
}
function CheckForm(p){
if(trim(p.jmeno.value)==""){alert('We are sorry, you didn´t fill indicated part - Name *.');p.jmeno.focus();return false;}
if(trim(p.prijmeni.value)==""){alert('We are sorry, you didn´t fill indicated part - Surname *.');p.prijmeni.focus();return false;}
if(isMail(p.mail.value)==""){alert('We are sorry, but it is necessary to give a correct e-mail address.');p.mail.focus();return false;}
/*if(trim(p.as.value)==""){alert('Insert digit: 5 (anti-spam protection)');p.as.focus();return false;}*/

return true;
}
function CheckForm1(p){

if(trim(p.jmeno.value)==""){alert('We are sorry, you didn´t fill indicated part - Name *.');p.jmeno.focus();return false;}
if(trim(p.prijmeni.value)==""){alert('We are sorry, you didn´t fill indicated part - Surname *.');p.prijmeni.focus();return false;}
if(trim(p.objednal.value)==""){alert('We are sorry, you didn´t fill indicated part - Ordered *.');p.objednal.focus();return false;}
if(trim(p.pocet1.value)==""){alert('We are sorry, you didn´t fill indicated part - Number of persons *.');p.pocet1.focus();return false;}
if(isMail(p.mail.value)==""){alert('We are sorry, but it is necessary to give a correct e-mail address.');p.mail.focus();return false;}

return true;
}
