function validate_employer(form)
{
    var company = form.company.value;
    var name = form.name.value;
    var surname = form.surname.value; 
    var title = form.title.value;
    var job_description = form.job_description.value;
    var tel = form.tel.value;   
    var cell = form.cell.value;   
    var fax = form.fax.value;   
    var email = form.email.value;
    var postal = form.postal.value;
    var physical = form.physical.value;
    var country = form.country.options[form.country.options.selectedIndex].value;
    var town = form.town.value;
    var position = form.position.value;
    var the_job_description = form.the_job_description.value;
    var salary = form.salary.value;
    var personnel = form.personnel.value;
    var comments = form.comments.value;
    
    
    var nameRegex = /^([a-z]{1,6}[ ']){0,3}([ÉÈÊËÜÛÎÔÄÏÖÄÅÇA-Z]{1}[éèëêüûçîôâïöäåa-z]{2,}[- ']){0,3}[A-Z]{1}[éèëêüûçîôâïöäåa-z]{2,}$/;
  var numberRegex = /^([0-9]{1,3})$/;
  var phoneRegex = /^(\d{9})|(((\(?(\+\d{1,3}\)?)? ?(\(0\))? ?)|(0))\(?(\d{2})( |-)((\d{3}))( |-)(\d{4})\)?)|[0](\d{2})( |-)(\d{7})$/;  
  var areaRegex = /^(\(?((\+\d{1,3})?\)? ?(\(0\))? ?)|(0))$/;
  var salaryRegex = /^\R?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$/;
  var dateRegex = /^(\d{4}\-\d{1,2}\-\d{1,2})$/;
  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
  var messageRegex = /^[ .a-zA-Z0-9:-]{1,150}$/;
  
  if (company == "")
  {
      inlineMsg('company','<strong>Error</strong><br />You must enter your company Name.',2);
      return false;
  }
  if (name == "")
  {
      inlineMsg('name','<strong>Error</strong><br />You must enter your Name.',2);
      return false;
  }
  if (!name.match(nameRegex))
  {
      inlineMsg('name','<strong>Error</strong><br />The name you entered is invalid.',2);
      return false;
  }

  if (surname == "")
  {
      inlineMsg('surname','<strong>Error</strong><br />You must enter your Surname.',2);
      return false;
  }
  if (!surname.match(nameRegex))
  {
      inlineMsg('surname','<strong>Error</strong><br />The surname you entered is invalid.',2);
      return false;
  }
  if (title == "")
  {
      inlineMsg('title','<strong>Error</strong><br />You must enter your title.',2);
      return false;
  }
  if (job_description == "")
  {
      inlineMsg('job_description','<strong>Error</strong><br />You must enter your job description.',2);
      return false;
  }
  if (tel == "")
  {
      inlineMsg('tel','<strong>Error</strong><br />You must enter your telephone number.',2);
      return false;
  }
  if (!tel.match(phoneRegex))
  {
      inlineMsg('tel','<strong>Error</strong><br />The telephone number you entered is invalid.',2);
      return false;
  }
  
  if (cell == "")
  {
      inlineMsg('cell','<strong>Error</strong><br />You must enter your cell number.',2);
      return false;
  }
  if (!cell.match(phoneRegex))
  {
      inlineMsg('cell','<strong>Error</strong><br />The cell number you entered is invalid.',2);
      return false;
  } 
  if (fax == "")
  {
      inlineMsg('fax','<strong>Error</strong><br />You must enter your fax number.',2);
      return false;
  }
  if (!fax.match(phoneRegex))
  {
      inlineMsg('fax','<strong>Error</strong><br />The fax number you entered is invalid.',2);
      return false;
  } 
  if (email == "")
  {
      inlineMsg('email','<strong>Error</strong><br />You must enter your e-mail address.',2);
      return false;
  }
  if (!email.match(emailRegex))
  {
      inlineMsg('email','<strong>Error</strong><br />The e-mail address you entered is invalid.',2);
      return false;
  } 
  
  if (postal == "")
  {
      inlineMsg('postal','<strong>Error</strong><br />You must enter your postal address.',2);
      return false;
  }    
  if (physical == "")
  {
      inlineMsg('physical','<strong>Error</strong><br />You must enter your physical address.',2);
      return false;
  } 
  
  if (country == "")
  {
      inlineMsg('country','<strong>Error</strong><br />You must select a country.',2);
      return false;
  }      
  if (town == "")
  {
      inlineMsg('town','<strong>Error</strong><br />You must enter your towns name.',2);
      return false;
  } 
  if (position == "")
  {
      inlineMsg('position','<strong>Error</strong><br />You must enter your available position.',2);
      return false;
  }   
  if (the_job_description == "")
  {
      inlineMsg('the_job_description','<strong>Error</strong><br />You must enter your positions job description.',2);
      return false;
  }  
  if (salary == "")
  {
      inlineMsg('salary','<strong>Error</strong><br />You must enter the available positions basic salary.',2);
      return false;
  }      
  if (personnel == "")
  {
      inlineMsg('personnel','<strong>Error</strong><br />You must enter the number of available positions.',2);
      return false;
  }      
  if (comments == "")
  {
      inlineMsg('comments','<strong>Error</strong><br />You must enter your comments.',2);
      return false;
  }         
  
  return true;
}

// START OF MESSAGE SCRIPT //

var MSGTIMER = 20;
var MSGSPEED = 5;
var MSGOFFSET = 3;
var MSGHIDE = 3;

// build out the divs, set attributes and call the fade function //
function inlineMsg(target,string,autohide) {  
  var msg;
  var msgcontent;
  if(!document.getElementById('msg')) {        
    msg = document.createElement('div');
    msg.id = 'msg';
    msgcontent = document.createElement('div');
    msgcontent.id = 'msgcontent';
    document.body.appendChild(msg);
    msg.appendChild(msgcontent);
    msg.style.filter = 'alpha(opacity=0)';
    msg.style.opacity = 0;
    msg.alpha = 0;                                           
  } else {                 
    msg = document.getElementById('msg');
    msgcontent = document.getElementById('msgcontent');
  }                                 
  msgcontent.innerHTML = string;
  msg.style.display = 'block';
  var msgheight = msg.offsetHeight;                          
  var targetdiv = document.getElementById(target);
  targetdiv.focus();
  var targetheight = targetdiv.offsetHeight;
  var targetwidth = targetdiv.offsetWidth;
  var topposition = topPosition(targetdiv) - ((msgheight - targetheight) / 2);
  var leftposition = leftPosition(targetdiv) + targetwidth + MSGOFFSET;
  msg.style.top = topposition + 'px';
  msg.style.left = leftposition + 'px';
  clearInterval(msg.timer);
  msg.timer = setInterval("fadeMsg(1)", MSGTIMER);
  if(!autohide) {
    autohide = MSGHIDE;  
  }
  window.setTimeout("hideMsg()", (autohide * 1000));
  
}

// hide the form alert //
function hideMsg(msg) {
  var msg = document.getElementById('msg');
  if(!msg.timer) {
    msg.timer = setInterval("fadeMsg(0)", MSGTIMER);
  }
}

// face the message box //
function fadeMsg(flag) {
  if(flag == null) {
    flag = 1;
  }
  var msg = document.getElementById('msg');
  var value;
  if(flag == 1) {
    value = msg.alpha + MSGSPEED;
  } else {
    value = msg.alpha - MSGSPEED;
  }
  msg.alpha = value;
  msg.style.opacity = (value / 100);
  msg.style.filter = 'alpha(opacity=' + value + ')';
  if(value >= 99) {
    clearInterval(msg.timer);
    msg.timer = null;
  } else if(value <= 1) {
    msg.style.display = "none";
    clearInterval(msg.timer);
  }
}

// calculate the position of the element in relation to the left of the browser //
function leftPosition(target) {
  var left = 0;
  if(target.offsetParent) {
    while(1) {
      left += target.offsetLeft;
      if(!target.offsetParent) {
        break;
      }
      target = target.offsetParent;
    }
  } else if(target.x) {
    left += target.x;
  }
  return left;
}

// calculate the position of the element in relation to the top of the browser window //
function topPosition(target) {
  var top = 0;
  if(target.offsetParent) {
    while(1) {
      top += target.offsetTop;
      if(!target.offsetParent) {
        break;
      }
      target = target.offsetParent;
    }
  } else if(target.y) {
    top += target.y;
  }
  return top;
}

// preload the arrow //
if(document.images) {
  arrow = new Image(7,80); 
  arrow.src = "images/msg_arrow.gif"; 
}