var console;
function echo(msg) {
	if (console) {
	console.log(msg);
	}
}


function FS_fixfloats(items) {
	ele = $$(items);
	var h = new Array;
	for (i=0; i<ele.length; i++) {
		h[i] = ele[i].getHeight();	
	}
	h.sort(function(a,b){return b - a}) //Array now becomes [7, 8, 25, 41]
	for (i=0; i<ele.length; i++) {
		var newH =  h[0] +'px'
		ele[i].setStyle({
			height: newH
		});

	}
}

function decorateTable(table){
    table = $(table);
    if(table){
        var allRows = table.select('tr')
        var bodyRows = table.select('tbody tr');
        var headRows = table.select('thead tr');
        var footRows = table.select('tfoot tr');

        for(var i=0; i<bodyRows.length; i++){
            if((i+1)%2==0) {
                bodyRows[i].addClassName('even');
            }
            else {
                bodyRows[i].addClassName('odd');
            }
        }

        if(headRows.length) {
          headRows[0].addClassName('first');
          headRows[headRows.length-1].addClassName('last');
        }
        if(bodyRows.length) {
          bodyRows[0].addClassName('first');
          bodyRows[bodyRows.length-1].addClassName('last');
        }
        if(footRows.length) {
          footRows[0].addClassName('first');
          footRows[footRows.length-1].addClassName('last');
        }
        if(allRows.length) {
            for(var i=0;i<allRows.length;i++){
                var cols =allRows[i].getElementsByTagName('TD');
                if(cols.length && cols[cols.length-1].hasClassName('row')) {
                    Element.addClassName(cols[cols.length-1], 'last');
                };
            }
        }
    }
}

function fpicture_height() {
	var h = document.viewport.getHeight() - $('main-table').getHeight();
	if (h > 0) { 
		//h += $('main-content').getHeight();
		$('js-separator').setStyle({height: h+'px'});
	}  
	
}
document.observe("dom:loaded", function() {
	FS_fixfloats('#promo-wrapper div.promo-text');
	fpicture_height();
	//FS_fixfloats('div.item-1 div.menu-text-wrapper')
});
