
function fitToScreen()
{
    var $winwidth = jQuery(window).width();
    var $winheight = jQuery(window).height();
    var $imgheight = Math.max(($winheight - 150), 200);
    

    if ($imgheight > 545)
      {
	$imgheight = 545;
      }
    jQuery("img#photo").attr({
      height: $imgheight
	  });
    var $imgwidth = jQuery("img#photo").width();
    var $wrapwidth = Math.max(($imgwidth + 20), ($winwidth - 20));

    if ($wrapwidth > 1100)
      {
	$wrapwidth = 1100;
      }

    var $contentheight = Math.max(($imgheight + 100) , ($winheight - 60));

    if ($contentheight > 690)
      {
	$contentheight = 690;
      }


    jQuery("div#wrap").css('width', $wrapwidth);
    jQuery("div#content").css('height', $contentheight);
    jQuery("ul#navi_bottom").css('top', $contentheight - 33);
    var $photo_height = jQuery("#photo").height();
    jQuery("#photo_previous").css('height', $photo_height);
    jQuery("#photo_next").css('height', $photo_height);
    //	jQuery("ul#navi_bottom").css('width', $wrapwidth - 40);
	
}

jQuery.noConflict();
jQuery(document).ready(function() { 

    fitToScreen();
        
    jQuery(window).bind("resize", function() {
	fitToScreen()
	  });
    
  });

