$(function(){$(".viewmore").each(function() {

	var h=$(this).height();
	var max=this.getAttribute("max");
	if (max==null || max==undefined) 
		max=75;

	//var text=$(this).text();
	
	//var firstE=max;
	
	//var firstDot=text.indexOf(".",max);
	
	//if (firstDot!=-1)
	//	max=firstDot+1;
	
	if (max<h) {
			var innerHTML=this.innerHTML;
			
			$(this).css("position","relative");
			$(this).css("height",max);
			$(this).css("overflow","hidden");
			
			$(this).after("<a href=# class=viewmorelink show=1 max=" + max + ">&nbsp;Read more >> </a>");
			
			//$(".viewmorelink",this).css("position","absolute");
			//$(".viewmorelink",this).css("bottom","15px");
			//$(".viewmorelink",this).css("righ","absolute");
			
			//$(this).html("<div class=new_text>" + text.substring(0,max) + "<a href=# class=viewmore2 show=1>&nbsp;Read more >> </a></div><div class=old_cont style='display:none'>" + innerHTML + "<a href=# class=viewmore show=1>Show me less text << </a></div>");
			
			$(".viewmorelink",this.parentNode).click(function(e) {
			
				if (this.getAttribute("show")=="1") {
					if ($.browser.msie) {
						$(this.previousSibling).css("height","100%");
					} else {
						$(this.previousSibling).css("height","auto");
					}
					
					$(this.previousSibling).css("overflow","visible");
					this.setAttribute("show","0");
					this.innerHTML="Show me less text << ";
					$(this).css("padding-top","7");
					$(this).css("display","block");
				} else {
					$(this.previousSibling).css("height",this.getAttribute("max"));
					$(this.previousSibling).css("overflow","hidden");
					this.setAttribute("show","1");
					this.innerHTML="Read more >>  ";
					$(this).css("padding-top","0");
					$(this).css("display","block");
				}
				e.preventDefault();
				return false;
			});
	}		
	
});});


