/**
 * Display double background blue-opacity div
 */
function backgroundDisplay(){

  /***  Constants ***/
  var heightContent = $("#content").height();
  var widthContent = $("#content").width();
  var deg1 = -50 / Math.sqrt(heightContent);// -3000 / heightContent ;// (heightContent < 800) ? -3 : -0.3 ;
  var deg2 = 15 / Math.sqrt(heightContent);// 300 / heightContent ;// (heightContent < 800) ? 1 : 0.1 ;
  
  $("#content1,#content2").css({
    'margin-top': -heightContent,
    'position': 'absolute',
    }).height(heightContent).width(widthContent);
  $("#content1").css({
    'background-color': 'rgba(0,156,221,0.4)',
    '-moz-transform': 'rotate('+deg1+'deg)',
    'webkit-transform': 'rotate('+deg1+'deg)',
    'z-index': '2'
    });
  $("#content2").css({
    'background-color': 'rgba(0,156,221,0.1)',
    '-moz-transform': 'rotate('+deg2+'deg)',
    'webkit-transform': 'rotate('+deg2+'deg)',
    'z-index': '1'
    });
}

$(document).ready(function() {

  /***  Dynamic Background ***/
  backgroundDisplay();
  $("#content").resize(function(){ backgroundDisplay(); });

  /*** Page navigation ***/
  $("#navigation-page a").hide();
  $("#navigation-page span").hover(
    function() { $(this).find("a").fadeIn(300); },
    function() { $(this).find("a").fadeOut(300); }
  );

  /*** Tabs ***/
  $("ul.tabs li.label").hide(); 
	$("#tab-set > div").hide(); 
	$("#tab-set > div").eq(0).show(); 
  $("ul.tabs a").click( 
  	function() { 
  		$("ul.tabs a.selected").removeClass('selected'); 
  		$("#tab-set > div").hide();
  		$(""+$(this).attr("href")).fadeIn('slow'); 
  		$(this).addClass('selected'); 
  		return false; 
  	}
  );
  $("#toggle-label").click( function() {
  	$(".tabs li.label").toggle(); 
  	return false; 
  });
  
  /*** Lightbox ***/
  $("a.lightbox").fancybox();
  
  /*** Accordeon simple ***/
  //slides the element with class "body" when paragraph with class "head" is clicked
  $("#accordeon .head").click(function(){
    $(this).next(".body").toggle();//.slideToggle(300);//.siblings(".body").slideUp("slow");
  });
	
});
