/**
 * webduo. showcaseD script
 *
 * When the script is ready it will be here for the taking and it _will_ look good.
 * For now it is "as is". If You don't like it don't bother to
 * use it or even look at it.
 * Requires MooTools Framework 1.2 (Yes. No details here.)
 * @version 0.15
 * @author Janusz Dusza
 * @copyright showcaseD (c) 2008 webduo s.c.
 */

var showcaseD = function(){
  $$('#mini a').each(function(obj){
    var img = obj.getFirst();

    var morph_over = {
      width: 230 + 'px',
      height: 245 + 'px'
    };

    var morph_out = {
      width: 190 + 'px',
      height: 205 + 'px'
    };

    // threat special (retarded) browsers in special way
    if(Browser.Engine.trident4){
      $extend(morph_over, {
        margin: '-10px -25px 0px -20px'
      });

      $extend(morph_out, {
        margin: '0px -1px 0px 0px'
      });

      var imgSrc = img.getProperty('src');

      img.setProperty('src', 'share/web/images/ie-suck-balls.gif'); // i'm not kidding here :)
      img.setStyle('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + imgSrc + '\', sizingMethod=\'scale\')');
    } else{
    // everyone else is satisfied with this (yes, even IE7)
      img.setStyles({
        top: '0px',
        left: '0px'
      });

      $extend(morph_over, {
        margin: '0px -20px 0px 0px',
        top: '-10px',
        left: '-20px'
      });

      $extend(morph_out, {
        margin: '0px 0px 0px 0px',
        top: '0px',
        left: '0px'
      });
    }

    img.set('morph', {
      duration: 500,
      transition: 'expo:out'
    });

    obj.addEvent('mouseover', function(e){
      img.morph(morph_over);
    });

    obj.addEvent('mouseout', function(e){
      img.morph(morph_out);
    });

    obj.addEvent('focus', function(e){
      obj.fireEvent('mouseover');
    });

    obj.addEvent('blur', function(e){
      obj.fireEvent('mouseout');
    });
  });
}
