jQuery.preloadImages = function()
	{
	  for(var i = 0; i<arguments.length; i++)
		  {
    	  	jQuery("<img>").attr("src", arguments[i]);
  		  }
	}
	
	$.preloadImages("images/log_hover.png","images/home_hover.png","images/azienda_hover.png","images/contatti_hover.png","images/log_hover.png");
if (screen.width >= 800 && screen.width < 1024)
{
        document.body.style.background="url('images/wooden_bg_1024_compressed.jpg')"
		document.body.style.backgroundAttachment="fixed";
		document.body.style.backgroundRepeat="no-repeat";
		document.body.style.backgroundPosition="top center";
}
if (screen.width >= 1280 && screen.width < 1440)
{
        document.body.style.background="url('images/wooden_bg_1280_compressed.jpg')"
		document.body.style.backgroundAttachment="fixed";
		document.body.style.backgroundRepeat="no-repeat";
		document.body.style.backgroundPosition="top center";
}
if (screen.width >= 1680 && screen.width < 1920)
{
        document.body.style.background="url('images/wooden_bg_1920_compressed.jpg')"
		document.body.style.backgroundAttachment="fixed";
		document.body.style.backgroundRepeat="no-repeat";
		document.body.style.backgroundPosition="top center";
}
$(document).ready(function(){
   // Change the image of hoverable images
   $(".imghover").hover( function() {
       var hoverImg = HoverImgOf($(this).attr("src"));
       $(this).attr("src", hoverImg);
     }, function() {
       var normalImg = NormalImgOf($(this).attr("src"));
       $(this).attr("src", normalImg);
     }
   );
});

function HoverImgOf(filename)
{
   var re = new RegExp("(.+)\\.(gif|png|jpg)", "g");
   return filename.replace(re, "$1_hover.$2");
}
function NormalImgOf(filename)
{
   var re = new RegExp("(.+)_hover\\.(gif|png|jpg)", "g");
   return filename.replace(re, "$1.$2");
}
