/**
 * @author mb
 * @modified mdr
 */
/*
 function ClearDefault(item) {
 // clear the default value of a form element
 if (item.defaultValue == undefined)
 item.defaultValue = item.value;
 if (item.defaultValue == item.value)
 item.value = '';
 }
 */ // ClearDefault

function ClearDefault(item) {
  item.value = '';
}

function SetDefault(item) {
  // if item is empty, restore the default value
  if (item.value == '') item.value = item.defaultValue;
} // SetDefault


jQuery(document).ready(function($) {


  // clear input on focus
  $('.clearmefocus').focus(function()
  {
    
    if ($(this).val() == $(this).attr('title'))
    {
      $(this).val('');
    }
  });


  $("#mc_mv_EMAIL").val('E-mailadres');
  $("#mc_mv_FNAME").val('Voornaam');
  $("#mc_mv_LNAME").val('Achternaam');

  //mainpage slider
  $('#mySlides').cycle({
    fx:     'scrollLeft',
    speed:   300,
    next:   '#s3',
    timeout: 16000,
    pause:   1
  });

  //clear value newsletter input
  $("#mc_mv_EMAIL").focus(function () {
    if ($(this).val() == 'E-mailadres') {
      ClearDefault(this);
    }
  });

  //clear value newsletter input
  $("#mc_mv_FNAME").focus(function () {
    if ($(this).val() == 'Voornaam') {
      ClearDefault(this);
    }
  });

  //clear value newsletter input
  $("#mc_mv_LNAME").focus(function () {
    if ($(this).val() == 'Achternaam') {
      ClearDefault(this);
    }
  });

  $("#mc_mv_EMAIL").blur(function () {
    if ($(this).val() == '') {
      $("#mc_mv_EMAIL").val('E-mailadres');
    }

  });

  //clear value newsletter input
  $("#mc_mv_FNAME").blur(function () {
    if ($(this).val() == '') {
      $("#mc_mv_FNAME").val('Voornaam');
    }
  });

  //clear value newsletter input
  $("#mc_mv_LNAME").blur(function () {
    if ($(this).val() == '') {
      $("#mc_mv_LNAME").val('Achternaam');
    }
  });

  //clear value newsletter input
  $('.minithumb img').click(function () {
    //alert($(this).attr('className'));
    $('.minithumb img').css('border', '1px solid #fff');
    $(this).css('border', '1px solid #FF8900');
    $('#mediumimg').attr('src', $(this).attr('id'));
    $('#mediuma').attr('href', $(this).attr('id'));
  });

  /*
   * mdr - collapse n expand portfolio description
   */
  var prevh = '';

  if ($('.coltext').height()) {
    //alert($('.coltext').height());
    //alert($('.col1').height());
    h1 = ($('.coltext').height());
    h2 = ($('.col1').height());
    prevh = h2;
    if (h1 > h2) {
      $('.showmore .less').hide();
      $('.showmore .more').fadeIn();
    }
  }

  $('.showmore .more').click(function () {
    $('.showmore .more').hide();

    h0 = 36;
    h1 = ($('.coltext').height());
    h2 = ($('.coltext').height()) + h0;

    //$('.col1').css('height', h1);
    //$('.col2').css('height', h2);
    $('.col1').animate({
      height: h1
    }, 500, function() {
      // show hidebutton after animation.
      $('.showmore .less').fadeIn();
    });

  });

  $('.showmore .less').click(function () {
    $('.showmore .less').hide();
    $('.showmore .more').fadeIn();
    h0 = 36;
    h1 = prevh;//($('.coltext').height());
    h2 = prevh + h0;//($('.coltext').height())+h0;

    //$('.col1').css('height', h1);
    //$('.col2').css('height', h2);
    $('.col1').animate({
      height: h1
    }, 500, function() {
      // nothing at this time.

    });

  });

});


