/**
 * Frontend index page JS styles
 *
 * Project: Tender.pro <br />
 * File: new_tender_start.js
 * 
 * @author Igor <igor@altsolution.net>
 * @package js
 */
 
function maxelem (v) { 
	var m= v[0]
	for (var i=1; i <= v.length-1; i++) {
		if (v[i] > m )
			m= v[i]
	}
	return m;
}

function vertalign() {

	b = $("#Block1_2").height()+13;	
	
	v = Array( $("#Block1_1").height(), $("#Block2_11").height()+b, $("#Block2_12").height()+b );	
	iMaxHeight = maxelem (v);
	
	if ($("#Block1_1").height() == iMaxHeight) {
		$("#Block1_1").height( iMaxHeight );
		$("#Block2_11").height( iMaxHeight - b);
		$("#Block2_12").height( iMaxHeight - b);
	}
	else {
		$("#Block1_1").height( iMaxHeight);
		$("#Block2_11").height( iMaxHeight - b);
		$("#Block2_12").height( iMaxHeight - b);
	}	

	v = Array( $("#HolderBlock1_1").height(), $("#HolderBlock2_11").height()+b, $("#HolderBlock2_12").height()+b );	
	iMaxHeight = maxelem (v);
	
	if ($("#Block1_1").height() == iMaxHeight) {
		$("#Block1_1").height( iMaxHeight);
		$("#Block2_11").height( iMaxHeight - b );
		$("#Block2_12").height( iMaxHeight - b );
	}
	else {
		$("#Block1_1").height( iMaxHeight );
		$("#Block2_11").height( iMaxHeight - b);
		$("#Block2_12").height( iMaxHeight - b);
	}
	
	$('#first').css('padding-top', $('#second').height() + 3 );
	$(window).load( function () { $('#second').css('top','0'); } );

}

$(document).ready(function(){	
	vertalign();
	$(window).resize(function(){
		vertalign();
	});		
	
});


