function postNewsComent() {
  $_('news_coment_form').submit();
}
function setPreloader(src, dest) {
  Element.setStyle(dest, {
        'opacity': 0.6,
        'filter': 'alpha(opacity=60)',
        'width': Element.getWidth(src) + 'px',
        'height': (Element.getHeight(src)+10) + 'px',
        'top': /*getY(src) +*/ '0px',
        'left': /*getX(src) + */'0px',
        'overflow': 'visible',
        'z-index': '1',
        'position': 'absolute'
      });
  dest.style.display = '';
}

function getNewsBlocksTotal() {
	var total = 0;

	for (;;) {
		if (!$_('bl_' + (total+1))) {
			break;
		}
		total++;
	}
	return total;
}

function sizeBlocks() {
	var total = getNewsBlocksTotal();	
	for (var index = 1; index < total; index += 2) {
		sizeBlock(index, index + 1);
	}
}

function sizeHomeBlocks() {
	var total = getNewsBlocksTotal();	
	var half = total / 2;
	for (var index = 1;; index++) {
		if (index > half) {
			break;
		}
		sizeBlock(index, half + index);
	}	
}

function sizeBlock(index_left, index_right) {
	bl_head = $_('bl_' + index_left + '_header');
	br_head = $_('bl_' + index_right + '_header');
	if (!br_head) {
		return false;
	}
	bl_h = bl_head.offsetHeight;
	br_h = br_head.offsetHeight;
	bl_head.style.height = br_head.style.height = (br_h > bl_h ? br_h : bl_h) + "px";
	
	bl = $_('bl_' + index_left);
	br = $_('bl_' + index_right);																				
	bl_h = bl.offsetHeight;
	br_h = br.offsetHeight;
	bl.style.height = br.style.height = ((br_h > bl_h ? br_h : bl_h) - 31) + "px";
}

function setNewsLoadObserve(sizer) {
	var listener = function() {			
		this.sizer();
	}; 
	listener.sizer = sizer;
	if (navigator.appName=='Microsoft Internet Explorer') {
		if (navigator.appVersion.indexOf('MSIE 6.0') == -1) {
			Event.observe(window, 'load', listener.bind(listener)); 
        }
	} else {
		Event.observe(window, 'load', listener.bind(listener));
	}
}
