/*
++++++++++++++++

++++++++++++++++
*/


$(document).ready(function() {

    if (!isSaf()){
        setEqualColumns('.three_column_first, .three_column_middle, .three_column_last');
    }
});
    
function setEqualColumns(columns) {

    var tallest = 0;
    
    //find tallest           
    $(columns).each(function(){
        var thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });

    //make things match
    $(columns).each(function(){
        var thisHeight = $(this).height();
        var d = (tallest - thisHeight);
        
        //(turn this into a function...)
        if($(this).hasClass('three_column_first')){
            var introbox = $(this).find('.intro');
            var h = introbox.height();
            h += d;
            introbox.css('height',h+'px');
        }
          
        if($(this).hasClass('three_column_middle')){
            var nooffersbox = $(this).find('p.nooffers');
 
            //if logged out
            if (nooffersbox.length){
                nooffersbox.after('<p class="nooffers" style="height:'+d+'px;padding:0 !important;margin: 0 !important;"></p>');
            //if logged in    
            } else {
                var offersbox = $(this).find('ul.boxContent li:last');
                var h = offersbox.height();
                h += d; 
                offersbox.css('height',h+'px');
            }    
        }   
               
    });
}
