var init = function() {
  $$('#contactFormSmall input[type=text]').addEvents({
    'focus':function(){this.style.background='#bbe5f6';},
    'blur':function(){this.style.background='#ffffff';}
  });
  if ($('contactFormLarge')) {
    $$('#contactFormLarge input[type=text]').addEvents({
      'focus':function(){this.style.background='#bbe5f6';},
      'blur':function(){this.style.background='#ffffff';}
    });
    new nicEditor({buttonList : ['bold','italic','underline']}).panelInstance('contactMessageID');
    $('contactNameID').focus();
  }
  if ($('portfolio')) {
    $$('#portfolio div.portfolioItem').addEvents({
      'mouseover':function(){this.style.border='1px #888888 dashed';},
      'mouseout':function(){this.style.border='1px #cccccc solid';}
    })
  }
}
var checkContactFormLarge = function() {
  msg = '';
  if ($('contactNameID').getValue().length==0) msg += '- Uw naam<br />';
  if ($('contactEmailID').getValue().length==0) msg += '- Uw emailadres';
  if (msg.length>0) {
    msg = '<strong>U dient de volgende velden nog in te vullen:</strong><br />'+msg;
    $('errorMessages').addClass('errorBorder');
    $('errorMessages').setStyle('background-color','#ff0000');
    $('errorMessages').setHTML(msg);
    var fx = new Fx.Styles($('errorMessages'), {duration: 250, wait: false});
    fx.start({
      'background-color':'#bbe5f6'
    });
    return false;
  }
  return true;
}
var checkContactFormSmall = function() {
  isComplete = true;
  if ($('smallContactNameId').getValue().length==0) {
    $('smallContactNameId').setStyle('border','1px #ff0000 solid');
    isComplete = false;
  } else {
    $('smallContactNameId').setStyle('border','0');
  }
  if ($('smallContactEmailId').getValue().length==0) {
    $('smallContactEmailId').setStyle('border','1px #ff0000 solid');
    isComplete = false;
  } else {
    $('smallContactEmailId').setStyle('border','0');
  }
  if ($('smallContactMessageId').getValue().length==0) {
    $('smallContactMessageId').setStyle('border','1px #ff0000 solid');
    isComplete = false;
  } else {
    $('smallContactMessageId').setStyle('border','0');
  }
  if (!isComplete) {
    alert('Vul de gemarkeerde velden in.');
    return false;
  }
  return true;
}
window.onload = init;
