$(document).ready(function() {
   $("#slideshow").supersize();
});

/////////////////////////////////
//
// supersize plugin
//
(function($){
		  //Resize image on ready or resize
		  $.fn.supersize = function() {  
		      //Invoke the resizenow() function on document ready
		      $(document).ready(function() {
		          $('#slideshow').resizenow();
		      });
		      //Invoke the resizenow() function on browser resize
		      $(window).bind("resize", function() {
		          $('#slideshow').resizenow();
		      });
		  };
		  //Adjust image size
  //Adjust image size
  $.fn.resizenow = function() {

      var browserwidth = $(window).width();
      var browserheight = $(window).height();
      
      var browserheight = $(window).height();
      
      imgheightguess = browserwidth * 0.410;
      //point_z = browserheight - 100;

      
      //position our controls
      xpositionofcontrols = (browserwidth/2)-($('#thumbs').width()/2);      
      


      ypositionofcontrols = imgheightguess + 60;
      if (ypositionofcontrols > browserheight -140) {
         ypositionofcontrols = browserheight -140;
      } else {
        ypositionofcontrols = imgheightguess + 60;
      }      
      
      //var imgheight = $('#slideshow .current img').height();// .css('height');
      //$('#readout').text(imgheight +' / '+ browserheight + '/' + imgheightguess);

      
      $('#thumbs').css('left', xpositionofcontrols).css('top', ypositionofcontrols + 'px').animate({ opacity: 1 }, 3000, function() { });

  };
})(jQuery);
