/* Path for this file: /content/dam/nissan/codepack/nissan/components/pages/layout/mainlayout.js/jcr:content/renditions/original */
// these were pulled from main JS file into mainlayout.js
/*
jQuery(document).ready(function() {
    if(jQuery("#frameBg").size()>0){
        //jQuery("#frameBg").height(jQuery("#frameContent").height()+20);
    }
    jQuery("#frameContent").click(function(){
        //jQuery("#frameContent").html(jQuery("#frameContent").html()+"<br /><br />");
        //resizeMe(jQuery("#frameContent").height());
    });    
});
function resizeMe(hgt){
    if(jQuery("#frameBg").size()>0){
        jQuery("#frameBg").height(hgt+20);
        if(jQuery("#frameContent").height() + 50 > jQuery("#pageBg").height()){
            //jQuery("#pageBg").height(jQuery("#pageBg").height()+20);
        }
    }
}
*/

jQuery(document).ready(function() {
    if(jQuery.browser.msie && parseInt(jQuery.browser.version) === 6) jQuery('#frameBg + #frameContent').addClass('frameContentHasBg');
 
    if(jQuery("#frameContent").height() + 50 > jQuery("#pageBg").height()){         
            jQuery("#pageBg").css("margin-bottom","50px");
        }
    
});


jQuery(document).ready(function() {
    aboutAdjustHeight();
    
    jQuery(function(){
        jQuery('#frameContent img').load(function(){
           aboutAdjustHeight();
        });
    });
});

function aboutAdjustHeight() {
    //Adjust body area
   // jQuery('#pageBg').height(jQuery('#frameBg').height() + 50);

    //reposition global footer as needed
    fOff = jQuery(".globalfooter").offset().top;
    fHeight = jQuery("#frameBg").height();
    fNew = (fHeight-fOff)+150;
    //don't reposition if the offset is negative
    if (fNew > 0) {
        jQuery(".globalfooter").css("margin-top",fNew);
    } else {
        jQuery(".globalfooter").css("margin-top",0);
    }
}

