 $(document).ready(function() {

	

	adapterphoto();
	centrertexte();
	
	
/*
	$("div#pagerepo div#blocmenu div#openclose a").click(function() {
		//alert($(this).html());
		//openclose($(this));
  			
	});
	$("div#pagerepo div#blocmenu ").hover(
		function() {
		//alert($(this).html());
		openclose($("div#pagerepo div#blocmenu div#openclose a"));
  		},	
		function() {
		//alert($(this).html());
		openclose($("div#pagerepo div#blocmenu div#openclose a"));
  		}
	);
	
	function openclose(d){
	
		if(d.html()=="&gt;"){
			d.parent().parent().animate({
				left: '0',
			  }, 1000, function() {
				// Animation complete.
			  });

			d.html("&lt;");
		}else{
			d.parent().parent().animate({
				left: '-230',
			  }, 1000, function() {
				// Animation complete.
			  });
			d.html("&gt;");
		}
	
	}
*/
	$(window).resize(function () { 
      
      adapterphoto();
      centrertexte();
      
    });
    
	

});

function centrertexte(){

	var tyc = $("#typecontent").outerHeight();
	var tec = $("#textcontent").outerHeight();
	var h = tyc > tec ? ( tyc - tec ) / 2 : 0;
	
	
	$("#textcontent").css("margin-top",h+"px");


}


function adapterphoto(){

	
		var wp = getPageSize();
		
		var H = wp[1] - $("#top").outerHeight() - $("#bottom").outerHeight();
		$("#photo").css("height",H+"px");
		
		//alert($("#textcontent").outerWidth()+" "+$("#typecontent").outerWidth());
		var W;
		if($("#typecontent").outerWidth()>600){
			W=600;
		}else if($("#typecontent").outerWidth()<300){
			W=300;
		
		}else{
		
			W = $("#typecontent").outerWidth();
		}
		
		//$("#textcontent").css("width",W+"px");
		if (wp[0]<950){
			var wvideo = 950 - 345 - 80;
			$("#typecontentvideo").css("width",wvideo+"px");
			$("#typecontent").css("width",wvideo+"px");
		}else{
			$("#typecontentvideo").css("width","auto");
			$("#typecontent").css("width","auto");
		
		}
		
	//alert(wp[1]+" "+$("#top").outerHeight()+" "+$("#bottom").outerHeight()+" "+H);




}





function getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = [w,h];
	return arrayPageSize;
}


	
    function readapter(){
    
    	 //adapterphoto(photow,photoh);
    	 //alert(photow,photoh);
    }



