﻿// when the DOM is ready:
$(document).ready(function () {
						
  // find the div.fade elements and hook the hover event
  $('div.fade').hover(function() {
    // on hovering over, find the element we want to fade *up*
    var fade = $('> div', this);
    
    // if the element is currently being animated (to a fadeOut)...
    if (fade.is(':animated')) {
      // ...take it's current opacity back up to 1
      fade.stop().fadeTo(250, 1);
    } else {
      // fade in quickly
      fade.fadeIn(250);
    }
  }, function () {
    // on hovering out, fade the element out
    var fade = $('> div', this);
    if (fade.is(':animated')) {
      fade.stop().fadeTo(1000, 0);
    } else {
      // fade away slowly
      fade.fadeOut(1000);
    }
  });
  
  /*hide mail*/
   $('.hide-email').each(function() {
      var $email = $(this);
      var address = $email.text().replace(/\s*\[at\]\s*/, '@')
                                 .replace(/\s*\[dot\]\s*/g, '.');
      $email.html('<a href="mailto:' + address + '">' + address + '</a>');
   });
   /*rotating*/
   $('#rotating-projects').cycle({ 
	  fx:     'scrollVert', 
	  timeout: 10000, 
	  delay:  -4000,
      next:   '#next-project',
      prev:   '#prev-project',
	  pause:	1
	});
   
});

animatedcollapse.addDiv('hidden', 'fade=1,height=150px');
animatedcollapse.init();