// BODY BACKGROUND IMAGE POSITIONING
function bodyBkgPos(){
  var bodybp = Math.round($(window).width()/24)+"em";
  $('body').css({'backgroundPosition':''+bodybp+' 0'});
};
$(document).ready(function(){bodyBkgPos();});
$(window).resize(function(){bodyBkgPos();});
// NEW SCALED WINDOW
$(document).ready(function(){
  $('a[rel="printpop"]').click(function(){
    window.open($(this).attr('href'),"Print","width=540,height=300");
    return false;
  });
});
// NEW FORM WINDOW
$(document).ready(function(){
  $('a[rel="formpop"]').click(function(){
    window.open($(this).attr('href'),"FormPop","width=540,height=400");
    return false;
  });
});
// CLOSE WINDOW
$(document).ready(function(){
  $('a[rel="close"]').click(function(){
    window.close($(this));
    return false;
  });
});
// SPONSOR SLIDE SHOW
function sponsorSwitch(){
  var $active = $('#slideshow div.active');
  if ($active.length == 0) $active = $('#slideshow div:last');
  var $next =  $active.next().length ? $active.next()
  : $('#slideshow div:first');
  $active.addClass('last-active');
  $next.css({opacity:0.0})
  .addClass('active')
  .animate({opacity:1.0},1000,function(){
    $active.removeClass('active last-active');
  });
}
$(function(){
  setInterval("sponsorSwitch()",5000);
});