jQuery(document).ready(function() {
   jQuery(".box").each(eachBox);
   //jQuery(".wrapper").each(eachBox);
   jQuery(".CRHA_Wrapper").each(eachBox);
});
function eachBox(){
	 var box = jQuery(this);
	 if(box.is(".CRHA_Wrapper")){
		box.wrapInner("<div class='wrapperContent'></div>")
	}else{	
		box.wrapInner("<div class='boxContent'></div>")
	}
	 box.prepend("<div class='corners' ><div class='L'></div><div class='R'></div><div class='T'></div><div class='TR'></div><div class='TL'></div><div class='B'></div><div class='BL'></div><div class='BR'></div></div>")
	
	var hauteur = box.outerHeight();
	if(box.is(".CRHA_Wrapper")){	
		box.children(".corners").find("div").height(box.outerHeight() )
	}else{	
		box.children(".corners").find("div").height(hauteur )
		box.find(".TL, .T, .TR").height(box.find(".boxContent h1").outerHeight()+15)
	}
	
	jQuery(box).bind('resize', function() {
		if(box.is(".CRHA_Wrapper")){	
			box.children(".corners").find("div").height(box.outerHeight() )
		}else{	
			box.children(".corners").find(".R,.L,.B,.BL,.BR").height(box.outerHeight())	
		}	
	});


/*jQuery(box).resize(function() {		
	var box = jQuery(this);
		if(box.is(".CRHA_Wrapper")){	
			box.children(".corners").find("div").height(box.outerHeight() )
		}else{	
			box.children(".corners").find(".R,.L,.B,.BL,.BR").height(box.outerHeight())	
		}					
	});*/
}

