window.addEvent("domready",function(){						
	var rows = [];
	var diff = 0;
	$$("#list .element").each(function(element,index,array){  
		if(index < 2 && array.length > 1){
			element.setStyle("border-width","1px 0");
			diff = 7;
		} else {
			diff = 6;
		}
	  
		row = Math.floor(index/2);
		if(!rows[row])
			rows.push([]);
	
		rows[row].push(element);
		element.addClass("row"+row);
	
		if(rows[row].length == 2){
			var height = 0;
			var height1 = rows[row][0].getCoordinates().height;
			var height2 = rows[row][1].getCoordinates().height;
	
	//        console.log("BEFORE height1: "+height1+", height2: "+height2);
	
			if(height1 > height2){
				rows[row][1].setStyle("height",height1-diff+"px");
			} else if(height2 > height1) {
				rows[row][0].setStyle("height",height2-diff+"px");
			}
	
	//        console.log("AFTER height1: "+rows[row][0].getCoordinates().height+", height2: "+rows[row][1].getCoordinates().height);
			//do some magic
		}
	});
		
	$("list").getElements("img").each(function(element){
    	if(element.getProperty("src") == "../../images/"){
        	element.dispose();
    	}
	});	
});
