function sameheight(){
	if(document.getElementById("ghost_counter") != null){
		counter = document.getElementById("ghost_counter").value;
		maxheight = 0;
		row = 1;

		for(i=1;i<=counter;i++){
			id = "wrap"+i;
			height = document.getElementById(id).offsetHeight;
			
			if(height > maxheight) maxheight = height;
			
			if(((i % 5) == 0) || i == counter){					
				first_in_row = 5*row-4;	
				last_in_row = counter > row*5 ? row*5 : counter;						
								
				for(j=first_in_row;j<=last_in_row;j++){
				document.getElementById("wrap"+j).style.height = maxheight+"px";
				
				}
			maxheight = 0;
			row++;
			}
		}
	}
}

window.onload=sameheight; 
