/*!
 * Copyright 2010, DIMACE PTY LTD http://www.dimace.com.au
 */
function resizeBg(){
               var doc_width = $(document).width();
               var doc_height = $(document).height();
               //alert("Step 1: getting document size\n\nWidth: "+doc_width+"px\nHeight = "+doc_height+"px");
               var image_width = $(this).width();
               var image_height = $(this).height();
               //alert("Step 2: getting image size\n\nWidth: "+image_width+"px\nHeight = "+image_height+"px");
               var image_ratio = image_width/image_height;
               //alert("Step 3: getting image width/height ratio: "+image_ratio);       
               var new_width = doc_width;
               var new_height = Math.round(new_width/image_ratio);
              //alert("Step 4: adapting the image to document width, mantaining the ratio\n\nWidth: "+new_width+"px\nHeight = "+new_height+"px");
               $(this).width(new_width);
               $(this).height(new_height);
               if(new_height<doc_height){
                    new_height = doc_height;
                    new_width = Math.round(new_height*image_ratio);
                    //alert("Step 5: the image isn't high enough\n\nAdapting the image to document height, mantaining the ratio\n\nWidth: "+new_width+"px\nHeight = "+new_height+"px");
                    $(this).width(new_width);
                    $(this).height(new_height);
                    var width_offset = Math.round((new_width-doc_width)/2);
                    //alert("Step 6: moving the image left by "+width_offset+"px to have it centered");
                    
               }
               //alert("Yeah!! Done :)");
          }
jQuery("#nav").click(function () {
  jQuery(this).hide(2000, function () {
	jQuery(this).show(2000);
  });
});
