﻿//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 2010 EndoscopiaDigestiva.com
// DarkBlue Consulting | Si usas este script debes mencionar al autor - Use this script but don't forget to credit the authors


//-- assuming that
//--

var hmBlock = {
    closed: { top: 0, left: 0, width: 150, height: 27 },
    open: { top: 0, left: 0, width: 450, height: 300 }
                 };

$(document).ready(function() {
    if ($('.hmi').size() > 0) { homeSetup() };
});

function homeSetup() {
    $('.hmi').hover(function() { homerollOn($(this)) }, function() { homerollOff($(this)) });


};

function homerollOn(oThis) {
    var fImg = $(oThis).find('img');
    var bBlock = { top: $(fImg).position().top + 2, left: $(fImg).position().left + 2, width: $(fImg).width() - 10, height: $(fImg).height() - 10 };
    bBlock.height = (bBlock.height / 5);bBlock.top = bBlock.top + (bBlock.height * 5) - bBlock.height;
    $(oThis).addClass('on').append('<div class="hmepig">' + $(fImg).attr('alt') + '</div>');
    $('.hmepig').css({ top: bBlock.top, left: bBlock.left, width: bBlock.width, height: bBlock.height}).hide().fadeIn();
};

function homerollOff(oThis) {
    $('.hmepig').remove();
    $(oThis).removeClass('on');
}
