function layoutall(id1, id2, id3, plus1, plus2, plus3, top1, top2, top3) {
	plus1= (plus1 || 0);
	plus2= (plus2 || 0);
	plus3= (plus3 || 0);	
	top1= (top1 || 0); 
	top2= (top2 || 0);
	top3= (top3 || 0);
	var lc = document.getElementById(id1);
	var cc = document.getElementById(id2);
	var rc = document.getElementById(id3);
	if (lc == null || cc == null || lc == null)	return;
	var ch = new Array();
	ch[1] = getHeight(lc)+plus1+top1;
	//alert("lc height: "+getHeight(lc)+" me synolo e3tra: "+plus1+" "+top1+" kai geniko ypsos:"+ ch[1]);	
	ch[2] = getHeight(cc)+plus2+top2;
	//alert("cc height: "+getHeight(cc)+" me synolo e3tra: "+plus2+" "+top2+" kai geniko ypsos:"+ ch[2]);
	ch[3] = getHeight(rc)+plus3+top3;
	//alert("rc height: "+getHeight(rc)+" me synolo e3tra: "+plus3+" "+top3+" kai geniko ypsos:"+ ch[3]);
	var max=0;
	var who=0;
	for(var i =1; i<ch.length; i++){
		if(ch[i]>max) {
			max=ch[i];
			//alert("max: "+max+" who: "+i);
		}
	}
	if(ch[1] < max) {
		lc.style.height = (max - plus1 - top1) + 'px';
		ch[1] = getHeight(lc)+plus1+top1;
		//alert("alla3e o: 1 kai exei ypsos (synoliko):"+ch[1]+" kai xwris ta extra: "+getHeight(lc));
	}
	if(ch[2] < max) {
		cc.style.height = (max - plus2 -top2) + 'px';
		ch[2] = getHeight(cc)+plus2+top2;
		//alert("alla3e o: 2 kai exei ypsos (synoliko):"+ch[2]+" kai xwris ta extra: "+getHeight(cc));
	}
	if(ch[3] < max) {
		rc.style.height = (max - plus3 -top3) + 'px';
		ch[3] = getHeight(rc)+plus3+top3;
		//alert("alla3e o: 3 kai exei ypsos (synoliko):"+ch[3]+" kai xwris ta extra: "+getHeight(rc));
	}
}

function layoutColumns() {
	var lc = document.getElementById('left_column');
	var cc = document.getElementById('main_column');
	var rc = document.getElementById('right_column');
	
	var cols = [lc, cc, rc];
	var max = 0;
	var maxEL = null;
	for(var i=0, len=cols.length; i<len; i++){
		var h = getHeight(cols[i]);
		if (h > max) {
			max = h;
			maxEL = cols[i];
		}
	}
	
	var plus = document.all ? 8 : 12;
	if (maxEL == lc) {
		var icc = document.getElementById('innerMainColumn');
		icc.style.height = (getHeight(icc) + (max - getHeight(cc)) + 5) + 'px';
		
		var irc = document.getElementById('inner_right');
		irc.style.height = ((getHeight(irc) + (max - getHeight(rc))) - plus) + 'px';
		
		return;
	}
	
	if (maxEL == cc) {
		var ilc = document.getElementById('innerLeftColum');
		ilc.style.height = (max - 123) + 'px';
		
		var irc = document.getElementById('inner_right');
		irc.style.height = ((getHeight(irc) + (max - getHeight(rc))) - plus - 5) + 'px';
		
		return;
	}
	
	if (maxEL == rc) {
		var ilc = document.getElementById('innerLeftColum');
		ilc.style.height = (max - 118) + 'px';
		
		
		var icc = document.getElementById('innerMainColumn');
		var b = document.getElementById('centerBanners');
		if (b) {
			icc.style.height = (max - getHeight(b) - 5) + 'px';
		} else {
			icc.style.height = max + 'px';
		}
		
		return;
	}
	
	alert(max + ' --- ' + maxEL.id);
	/*if (maxEL == lc) {
		lc.style.height = max + 'px';
		cc.style.height = (max - plus1) + 'px';
		rc.style.height = (max - plus2) + 'px';
		return;
	}
	
	if (maxEL == cc) {
		lc.style.height = (max + plus1) + 'px';
		cc.style.height = max + 'px';
		rc.style.height = (max - (plus2 - plus1)) + 'px';
		return;
	}
	
	if (maxEL == rc) {
		lc.style.height = (max + plus2) + 'px';
		cc.style.height = (max - (plus2 - plus1)) + 'px';
		rc.style.height = max + 'px';
		return;
	}*/
}

function layout(id1, id2, plus) {
	plus= (plus || 0);
	
	var lc = document.getElementById(id1);
	var rc = document.getElementById(id2);
	if (lc == null || rc == null) return;
	var lh = getHeight(lc);
	var rh = getHeight(rc);
	if (lh > rh) {
		rc.style.height = (lh + plus) + 'px';
	} else if (rh > lh) {
		lc.style.height = (rh + plus) + 'px';
	}
}

function getHeight(element) {
	return getDimensions(element).height;
}

function getDimensions(element) {
    var display = element.style.display;
    if (display != 'none' && display != null)
      return { width: element.offsetWidth, height: element.offsetHeight };

    var els = element.style;
    var originalVisibility = els.visibility;
    var originalPosition = els.position;
    var originalDisplay = els.display;
    els.visibility = 'hidden';
    els.position = 'absolute';
    els.display = 'block';
    var originalWidth = element.clientWidth;
    var originalHeight = element.clientHeight;
    els.display = originalDisplay;
    els.position = originalPosition;
    els.visibility = originalVisibility;
    
	return { width: originalWidth, height: originalHeight };
};

function addOnLoad(handler) {
	if (typeof window.addEventListener != "undefined")
		window.addEventListener("load", handler, false);
	else if (typeof window.attachEvent != "undefined") {
		window.attachEvent("onload", handler);
	}
	else {
		if (window.onload != null) {
			var oldOnload = window.onload;
			window.onload = function(e) {
				oldOnload(e);
				handler();
			};
		}
		else window.onload = handler;
	}	
}


