var blink_onoff = 1;

function checkEmail(email){
  var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
  return filter.test(email);
}

function show_error(msg) {
  var errorBox = document.getElementById('errorbox');
  document.getElementById(msg).style.display = 'inline';
  errorBox.style.display = 'block';
  errorBox.msgId = msg;
  document.location.href = '#';
}

function hide_errorBox() {
  var errorBox = document.getElementById('errorbox');
  errorBox.style.display='none';
  document.getElementById(errorBox.msgId).style.display = 'none';
}

function hide_and_wait(item) {
  if (item==null) {
    item = document.getElementById('main-content');
  }
  item.style.display = 'none';
  document.getElementById('waiting').style.display = 'block';
  start_animation();
  document.location.href = '#';
}

function showVehicle(office, destination, range) {
  var width = 340;
	var heigth = 380;
	var vleft = Math.round(window.screen.width/2-width/2);
	var vtop = Math.round(window.screen.height/2-heigth/2);
  window.open( 'vehinfo.php?ofcod=' + office + '&destcod=' + destination + '&rangecode=' + range, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=' + width + ',height=' + heigth + ',top=' + vtop + ',left=' + vleft);
}

function blink(id_element)
{
        if( blink_onoff == 1) {
           document.getElementById(id_element).style.color = on_color;
           blink_onoff = 0;
        }
        else {
           document.getElementById(id_element).style.color = off_color;
           blink_onoff = 1;
        }
}


