/*
 * Blop - jQuery Functions
 * 
 * Copyright (c) 2010 SORUDAN Solutions
 *
 * Version: 1.0.0 (22/11/2010)
 * Requires: jQuery v1.3+
 *
 */

function blopShow(blopName,blopType,blopSource,blopLeft,blopTop,blopClass)
{
  var blopBox;
  var blopcontent;
  $(blopName).unbind('mouseenter mouseleave');
  $(blopName).hover(function(e) {
    blopcontent = $(this).attr(blopSource) ? $(this).attr(blopSource) : "";
    $(this).attr(blopSource,"");
    $('body').append('<div class="'+blopClass+'"><div class="'+blopClass+'inner"><p>'+blopcontent+'</p></div></div>');
    blopBox = $("."+blopClass);
    blopBox.hide(0);
    blopBox.fadeIn("fast");
    if(blopType == "dynamic") {
      blopBox.css({ 'left' : e.pageX - blopLeft , 'top' : e.pageY - blopBox.height() - blopTop });
      $(this).mousemove(function(pos){
        blopBox.css({ 'left' : pos.pageX - blopLeft , 'top' : pos.pageY - blopBox.height() - blopTop });
      });
    }
    else if(blopType == "fixed") {
      var refPos = $(this).offset();
      blopBox.css({ 'left' : refPos.left - (blopBox.width()/2) + blopLeft, 'top' : refPos.top + blopTop });
    }
    else if(blopType == "fixedfull") {
      var refPos = $(this).offset();
      blopBox.css({ 'left' : refPos.left + blopLeft, 'top' : refPos.top + blopTop });
    }
  }, function() { 
      blopBox.remove();
      $(this).attr(blopSource,blopcontent);
  });

}
