//Bootstrapper
$(document).ready(function(){
  //Text More
  $('.textMore').hide();
  $('.textMore').after('<p class="readmore"><a href="#">Suite &raquo;</a></p>');
  
  $('p.readmore a').click(function(){
    $(this).parents('.text').find('.textMore').show();
    $('p.readmore').hide();
    $('body').css('background-image', 'url(/img/global/bg3.jpg)');
    $('#specialHeader ').css('height', '475px');
    return false;
  });
});

//Function
function showPromos(obj){
  obj.style.overflowY = 'auto';
}
function hidePromos(obj){
  obj.style.overflowY = 'hidden';
}
function resizePromos(maxwidth,maxheight,image,imgId){
  maxWidth = maxwidth;
  maxHeight = maxheight;
  tempWidth = 0;
  tempHeight = 0;
  promoImage = new Image();
  
  promoImage.onload = function(){  
    tempRatio = promoImage.width / promoImage.height;
    if (promoImage.width > maxWidth){
      tempWidth = maxWidth;
      tempHeight = tempWidth / tempRatio;
    }
    if (tempHeight != 0 && (tempHeight > maxHeight)){
      tempHeight = maxHeight;
      tempWidth = tempHeight * tempRatio;
    }
    if (tempHeight == 0 && (promoImage.height > maxHeight)){
      tempHeight = maxHeight;
      tempWidth = tempHeight * tempRatio;
    }
    if (tempWidth != 0 || tempHeight != 0){
      document.getElementById(imgId).style.width = tempWidth;
      document.getElementById(imgId).style.height = tempHeight;
    }
    document.getElementById(imgId).src = image;
  }
  promoImage.src = image;
}
