
 timerID = 0;

function go2url (id) {
if (id == '0') {self.location = 'http://prag-guide.cz/index.php'}
else {self.location = 'http://prag-guide.cz/index.php?id=' + id}
}

function get_cont(e){
	timerID  = setTimeout("get_content('"+e+"')", 10);
}

function get_content(e){

	val = document.getElementById('Destination address(to)').value;
   AjaxRequest.get(
    {
     'url':'/templates/hotely_get_content_naseptavac.php?val=' + val + '&smer=Email'
     ,'onSuccess':function(req){
	document.getElementById('content_Email').className = 'vis';
	document.getElementById('content_Email').innerHTML = req.responseText;
	//document.getElementById('input_'+e.name).focus();
      }
     ,'onError': function(){
	alert('error occured');
      }
    }
   );
}


 function set_class(obj,c){
  obj.className = c;
 }

 function fill_hotel_input(w, smer){
  document.getElementById('Destination address(to)').value = format(document.getElementById('li_'+w).innerHTML);
  document.getElementById('content_Email').className = 'hid';
 }

 function format(str){
  return str.replace(/<\/?b>/gi,'').replace(/&amp;/gi,'&');
 }

 function change_class(c,w){
//   if (_index != -1) set_class(document.getElementById('li_'+_index), 'inactive');
  set_class(document.getElementById('li_'+w), c);
//   _index = w;
 }

//controla spravnosti emailove adresy
function validateEmail(id) { 
var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/; 
return emailPattern.test(id); 
}

//odesle formular po zkontrolovani spravnosti policka email
function submit_check_mail (mail_field,form_name,error_msg) {
var mail=document.getElementById(mail_field);
if (validateEmail(mail.value)) {document.getElementById(form_name).submit();}
  else {alert(error_msg);}
}

