﻿document.observe("dom:loaded", function() {
var listImg = $$('.post_content img'),
      currentImg = null,
      i = null;

for (i = 0; i < listImg.length; i++) {
  currentImg = listImg[i];
  currentWidth = currentImg.getWidth();

  if(currentWidth>509){
		currentImg.writeAttribute({height: null, width: 500});
	}
}

	});

jQuery(document).ready(function() {

	if(jQuery(".single .content_post").length>0){

		var contenu = jQuery(' .post_content p:last').text();
		var value = "Suggestion";	
		var contenu_verif = contenu.substr(0,10);	
	
		if(contenu_verif == value){
			jQuery('.post_content p:last').css({fontWeight:"bold",paddingBottom:"6px",paddingLeft:"6px", paddingTop:"6px", width:"503px", backgroundColor:"#003366", color:"#ffffff"});
			jQuery('.post_content ol:last').css({paddingBottom:"10px",paddingTop:"7px",paddingLeft:"20px", width:"487px", border:"1px solid #003366",listStyleType:"square",color:"#003366"});
		}
			
	}
	
	if (jQuery("#previous_post a").length>0) {
		
		var lien_precedent = jQuery("#previous_post a").text();
		jQuery("#previous_post a").attr('title', lien_precedent);
		
		if(lien_precedent.length>32){
			var link_p = lien_precedent.substr(0,32);
			jQuery("#previous_post a").html(link_p+"..."); 
		}
	}	
	
	
	jQuery(".post_content table").each(function() {
			var largeur= jQuery(this).width();
			
			if(largeur>500){
			jQuery(this).css("width", 500);
			}
	});
			
			
	
		
	

	if (jQuery("#next_post a").length>0) {
		
		var lien_suivant = jQuery("#next_post a").text();
		jQuery("#next_post a").attr('title', lien_suivant);
		
		if(lien_suivant.length>32){
			var link_s = lien_suivant.substr(0,32);
			jQuery("#next_post a").html(link_s+"..."); 
		}
	}
	
});
