var general = {

    // OnLoad functions
init: function() {

        this.bubbleEvt();
    },

    bubbleEvt: function() {
  
        $('*').each(function() {
            general.equalHeight($(this).find('.mediaFolderx'))
        });
        /* Fix av Anders H för att ställa vidden  */      
	 $('*').each(function() {
            general.equalWidth($(this).find('.column'))
        });

 $('*').each(function() {
     general.equalWidth($(this).find('.tbRub'))
        });
        /* Fix av Anders H för att ställa vidden  */      
	 $('*').each(function() {
	     general.equalWidth($(this).find('.tbBytes'))
        });

        general.label2value();

    },

    equalHeight: function(group) {
        tallest = 0;
        group.each(function() {
            thisHeight = $(this).height();
            if (thisHeight > tallest) {
                tallest = thisHeight;
            }
        });
        group.height(tallest);
        
    },

    equalWidth: function(group) {
        widest= 0;
        group.each(function() {
            thisWidth = $(this).width();
            if (thisWidth > widest) {
                widest= thisWidth ;
            }
        });
        group.width(widest);
        
    },

    /*
    * label2value
    * jquery based script for using form labels as text field values
    * more info on http://cssglobe.com/post/1500/using-labels- 
    *
    * Copyright (c) 2008 Alen Grakalic (cssglobe.com)
    * Dual licensed under the MIT (MIT-LICENSE.txt)
    * and GPL (GPL-LICENSE.txt) licenses.
    *
    */

    label2value: function() {

        // CSS class names
        // put any class name you want
        // define this in external css (example provided)
        var inactive = "inactive";
        var active = "active";
        var focused = "focused";

        // function
        $("label:not('label.no-js')").each(function() {
            obj = document.getElementById($(this).attr("for"));
            if ((($(obj).attr("type") == "text") && ($(obj).attr("rel") == "use-js")) || (obj.tagName.toLowerCase() == "textarea")) {
                $(obj).addClass(inactive);
                var text = $(this).text();
                $(this).css("display", "none");
                $(obj).val(text);
                $(obj).focus(function() {
                    $(this).addClass(focused);
                    $(this).removeClass(inactive);
                    $(this).removeClass(active);
                    if ($(this).val() == text) $(this).val("");
                });
                $(obj).blur(function() {
                    $(this).removeClass(focused);
                    if ($(this).val() == "") {
                        $(this).val(text);
                        $(this).addClass(inactive);
                    } else {
                        $(this).addClass(active);
                    };
                });
            };
        });
    }


}

$(document).ready(function(){			   
	general.init();
});
