$.fn.adjustHeights = function(option)
{	
    /* option */
    option = jQuery.extend({
        elements: [],
        vAlign: 'top',
        adjust: true  
    }, option);
    
    /* function */
    
    $(this).each(function(){
        var height = 0;
        var height2 = 0;
        var el = {
            size: option.elements.length
        };
        
        for(var i = 0; i < el.size; i++){
            height = 0;
            height2 = 0;
            /* RESET FUNCTION */
            $(''+ option.elements[i] +'', this).each(function(){
                if(option.adjust == true){$(this).css('height', 'auto');}
                $('.js-ah-help', this).css('padding-top', '0');
                if(option.vAlign == 'center' | option.vAlign == 'bottom' && $('.js-ah-help', this).size() == 0){
                    $(this).wrapInner('<span class="js-ah-help"></span>');
                    $('.js-ah-help', this).css({
                        'display':'block',
                        'margin': '0',
                        'padding': '0'
                    });
                }
            });
            /* BOX GET HEIGHT FUNCTION */
            $(''+ option.elements[i] +'', this).each(function(){
                height = height > $(this).height() ? height : $(this).height();
            });
            /* BOX SET HEIGHT FUNCTION */
            $(''+ option.elements[i] +'', this).each(function(){
                if(option.adjust == true){
                    $(this).height(height);
                }
                if(option.vAlign == 'center' || option.vAlign == 'bottom'){
                    if($('img', this).size() > 0){
                        var item = $(this);
                        $(new Image()).load(function() {
                            //$('img', item).attr('src', imgSrc);
                            height2 = $('.js-ah-help', item).height();
                            if(option.vAlign == 'center'){
                                $('.js-ah-help', item).css('padding-top', (height-height2)/2 + 'px');
                            }
                            if(option.vAlign == 'bottom'){
                                $('.js-ah-help', item).css('padding-top', (height-height2) + 'px');
                            }
                        }).attr('src', $('img', this).attr('src'));
                    }
                    else{
                        height2 = $('.js-ah-help', this).height();
                        if(option.vAlign == 'center'){
                            $('.js-ah-help', this).css('padding-top', (height-height2)/2 + 'px');
                        }
                        if(option.vAlign == 'bottom'){
                            $('.js-ah-help', this).css('padding-top', (height-height2) + 'px');
                        }
                    }
                }
            });
        }       
    });
};
