function doSendRequestForm()
{
  var firstname = $('frm_firstname').value;  
  var prefix = $('frm_prefix').value;  
  var lastname = $('frm_lastname').value;  
  var familyname = $('frm_familyname').value;  
  var telwork = $('frm_telwork').value;
  var email = $('frm_email').value; 
  var message = $('frm_message').value; 
  var reqSendRequest = new Request(
  {
    url:'contact.php',
    method: 'post',
    data:'ajax=contactrequest&frm_firstname='+firstname+'&frm_prefix='+prefix+'&frm_lastname='+lastname+'&frm_familyname='+familyname+'&frm_telwork='+telwork+'&frm_email='+email+'&frm_message='+message,
    onComplete:function(t, x)
    {
      var html = x.getElementsByTagName('html');
      if ( (html) && (html.length > 0) )
      {    
        doHideRequestContact();
        $('spn_requestcontact').innerHTML = html[0].firstChild.data;
      }
      else
      {
        var errors = x.getElementsByTagName('errors');
        if ( errors )
        {
          for (var i=0; i < errors.length; i++){
            myid   = errors[i].getAttribute('id');
            mytype = errors[i].getAttribute('type');
            mytext = errors[i].getAttribute('text');
            if ($(myid)) $(myid).className = mytype;
//            if ($(myid)) $(myid).innerHTML = mytext;
          }
        }
      }
    }
  }).send();
}


function doShowRequestContact()
{
  $('contactform').set('tween', {onComplete:function(h){}});
  $('spn_requestcontact').set('tween', {onComplete:function(h){$('spn_requestcontact').style.display = 'none';}});
  $('spn_requestcontact').fade('out');
  $('contact').set('morph', {onComplete:function(h){ $('contactform').style.display = ''; $('contactform').fade('in'); }});
  $('contact').morph({height:$('contact').getProperty('longHeight')});
}


function doHideRequestContact()
{
  $('spn_requestcontact').set('tween', {onComplete:function(h){}});
  $('contact').set('morph', {onComplete:function(h){}});
  $('contactform').set('tween', {onComplete:function(h){ $('contactform').style.display = 'none'; $('contact').morph({height:$('contact').getProperty('shortHeight')}); $('spn_requestcontact').style.display = ''; $('spn_requestcontact').fade('in'); }});
  $('contactform').fade('out');
}


window.addEvent( 'domready', function(){
  var otFirstName = new OverText('frm_firstname'); 
  var otPrefix = new OverText('frm_prefix'); 
  var otLastName = new OverText('frm_lastname');   
  var otTelWork = new OverText('frm_telwork'); 
  var otEMail = new OverText('frm_email');
  var otMessage = new OverText('frm_message'); 
  var contact = $('contact'); 

  var longHeight = contact.offsetHeight;
  contact.setProperty('longHeight', longHeight);
  $('contactform').style.display = 'none';
  $('contactform').fade('hide');
  $('spn_requestcontact').style.display = '';

  var shortHeight = contact.offsetHeight;
  contact.setProperty('shortHeight', shortHeight);
  contact.style.height = shortHeight+'px';
  
  contact.fade('show');
});
