// Sostituzione fonts
Cufon.replace('h1.regular', {
	color: '-linear-gradient(#62e200, #62e200, #275b00)',
	fontFamily: 'cocon-regular',
	textShadow: '1px 1px rgba(0, 0, 0, 0.2)'
});
Cufon.replace('h2.regular', {
	color: '-linear-gradient(#62e200, #62e200, #275b00)',
	fontFamily: 'cocon-regular',
	textShadow: '1px 1px rgba(0, 0, 0, 0.2)'
});

Cufon.replace('h1.light', {
	color: '-linear-gradient(#62e200, #62e200, #275b00)',
	fontFamily: 'cocon-light',
	textShadow: '1px 1px rgba(0, 0, 0, 0.2)'
});
Cufon.replace('h2.light', {
	color: '-linear-gradient(#62e200, #62e200, #275b00)',
	fontFamily: 'cocon-light',
	textShadow: '1px 1px rgba(0, 0, 0, 0.2)'
});

Cufon.replace('.mText', {
	fontFamily: 'cocon-light',
	textShadow: '1px 1px rgba(0, 0, 0, 0.2)'
});
Cufon.replace('.mTextLink', {
	color: '-linear-gradient(#62e200, #62e200, #275b00)',
	fontFamily: 'cocon-light',
	textShadow: '1px 1px rgba(0, 0, 0, 0.2)'
});
Cufon.replace('.mLink a', {
	fontFamily: 'cocon-light',
	textShadow: '1px 1px rgba(0, 0, 0, 0.2)',
	hover: {
		color: '-linear-gradient(#62e200, #62e200, #275b00)'
	}
});
Cufon.replace('.dtaArticolo', {
	color: '#ffffff',
	fontFamily: 'cocon-light',
	textShadow: '1px 1px rgba(0, 0, 0, 0.8)'
});


// You need to specify the size of your background image here (could be done automatically by some PHP code)
var FullscreenrOptions = {  width: 1600, height: 1200, bgID: '#bkgImg' };
//var FullscreenrOptions = {  width: 2362, height: 1772, bgID: '#bgimg' };
// This will activate the full screen background!
jQuery.fn.fullscreenr(FullscreenrOptions);

$(document).ready(function() {
  /* Imposta background */
	$.fn.addBackground = function(bg,params) {
    $(this).each(function() {
  
      s = $(this).extend({},params || {});      
      
      $last = ($(this).find('.add_background:last').length > 0 ? $(this).find('.add_background:last') : $(this));
  		$last.html('<div class="add_background"><div>'+$last.html()+'</div></div>');
  		$last = $(this).find('.add_background:last');
  		$last.css({'background':bg,'width':'100%','height':'100%'});

      $last = $(this).find('.add_background div:last');
            
      if(s.insideCss){
   		  $last.css(s.insideCss);
  		}
      if(s.insideClass)
  		  $last.addClass(s.insideClass);  		  
    });
  };
	
  /* Determina altezza #content = Alteza pagina - (Altezza Header:150px + Altezza Footer:50px -> 190px)*/
	if ($('#content').height() < ($(window).height() - 200)) {
		$('#bkg-content').css("height", $(window).height() - 200);
	} else {
		$('#bkg-content').css("height", $('#content').height());
	};
	$(window).bind('resize', function() {
		if ($('#content').height() < ($(window).height() - 200)) {
			$('#bkg-content').css("height", $(window).height() - 200);
		} else {
			$('#bkg-content').css("height", $('#content').height());
		};
	});
	
	
	
});