$(document).ready(function(){
		
	$("div.read_more").each(function(){
												
		if($(this).find("p").length > 1){
		
			$(this).find("p:first").append(" <a href=\"javascript://\" class=\"read_more\">Read more...</a>");
			$(this).find("p:last").append(" <a href=\"javascript://\" class=\"read_less\">Read less...</a>");
			
			$(this).find("p:not(p:first)").each(function(){
				$(this).addClass("hide");
			});
			
			$(this).find("a.read_more").live("click", function(){
				$(this).parents("div.read_more").find("p.hide").removeClass("hide");
				$(this).parents("div.read_more").find("a.read_more").hide();
			});
			
			$(this).find("a.read_less").live("click", function(){
				$(this).parents("div.read_more").find("p:not(p:first)").addClass("hide");
				$(this).parents("div.read_more").find("a.read_more").show();
			 });
		
		}

	});		
		
});

function replaceAll(haystack, needle, replace) {
  return haystack.replace(new RegExp(needle, 'g'),replace);
}
function is_array(input){
	return typeof(input)=='object'&&(input instanceof Array);
}

