$(function() {
   amplafi = $.extend(true, amplafi,
   {
       html : {
           /**
            * Enable absolute elements to be positioned relative to jqueryElement.
            */
           makeAbsoluteContainer : function(jqueryElement) {
               var cssPosition = jqueryElement.css("position");
               if ( cssPosition == "relative" || cssPosition == "absolute" || cssPosition== "fixed") {
                   // no need to do anything
               } else {
                   // position: static (default) or some nonsense value
                   jqueryElement.css("position", "relative");
                   // TODO: subelements with absolute positioning need to be reparented to jqueryElement's parent
               }
           },
           addLiveKeypressAndClick : function(toggleFunction, jqueryElements) {
               jqueryElements.live("click", toggleFunction).live("keypress", function(eventObject){
                   if (eventObject.key==' ') {
                       toggleFunction(eventObject);
                   }
               });
           },
           isShowing: function(element) {
               return $(element).css("display") != "none";
           },
           getBlocks : function(element) {
               return $(element).css("display", "block");
           },
           getHeadlines: function(element) {
               var headlines = $(element, "h1, h2, h3, h4, h5, h6");
               var possibleHeadlines = amplafi.html.getBlocks($("strong,em,span"));
               return $.extend({}, headlines, possibleHeadlines);
           },
           // quick and dirty for porting
           getElementsByClass: function(className, context) {
               return $("."+className, context);
           },
           // Quick and dirty for porting.
           inArray: function(array, value) {
               return $.inArray(value, array) > -1;
           },
           removeClass: function(target, className) {
               $(target).removeClass(className);
           },
           addClass: function(target, className) {
               $(target).addClass(className);
           },
           replaceClass: function(target, newClassName, oldClassName) {
               $(target).addClass(newClassName).removeClass(oldClassName);
           },
           hasClass: function(target, className) {
               return $(target).hasClass(className);
           },
           byId : function(idName) {
               return $("#"+idName);
           },
           getAttribute: function(target, attribute) {
               return $(target).attr(attribute);
           }
           
       }
   })
});
