$(document).ready(function(){
	$('.menu').hover(
		function()
		{
			$(this).find('.submenu').show();
			$(this).addClass('menu_act');
		},
		function()
		{
			$(this).find('.submenu').hide();
			$(this).removeClass('menu_act');
		});

	$('.equip_table').each(
		function(index)
		{
			t = $(this);
			t.find('td:first').addClass('td_first');
			t.find('tr').not(':first').not(':last').addClass('tr_middle');
			t.find('tr').not(':first').find('td:even').addClass('td_left');
			t.find('tr').not(':first').find('td:odd').addClass('td_right');
			t.find('tr:last td').addClass('td_last');
		});

	$('.history_table tr').each(
		function (index)
		{
			t = $(this);
			t.find('td:first').addClass('first_blue');
			color = index % 2 == 0 ? 'light' : 'dark';
			t.find('td:last').addClass('second_' + color );
		});

	$('.history_table').each(
		function (index)
		{
			t = $(this);
			t.find('tr:last td:first').addClass('first_orange');
		});

	if($('#body_left').height() < 286)
	{
		$('#body_left').height(286);
	}

	$('.personnel').each(
		function (index)
		{
			t = $(this);
			t.find('tr:first td').addClass('td_first');
			t.find('tr').not(':first').addClass('td_normal');
			t.find('tr').not(':first').each(
				function (index)
				{
					tr = $(this);
					tr.find('td:first').addClass('td_left');
				});
			t.find('tr:last td').addClass('td_last');
		});

	//resize();

	//window.onresize = function(){ resize(); };

  	  
$('#status').change(function () {

  if ($('#status option:selected').val()==2) {
    $('.jur').hide();
  }
  else{
    $('.jur').show();  
  }

});
	
$('#darbanosaukums').change(function () {
  if ($('#darbanosaukums option:selected').val()=='cits') {
    $('.darbanosaukumscits_h').show(); 
  }
  else{
    $('.darbanosaukumscits_h').hide();     
  }
});

$('#gatavaisformats').change(function () {
  if ($('#gatavaisformats option:selected').val()=='cits') {
    $('.gatavaisformatscits_h').show(); 
  }
  else{
    $('.gatavaisformatscits_h').hide();     
  }
});

$('#krasas').change(function () {
  if ($('#krasas option:selected').val()=='cits') {
    $('.krasascits_h').show(); 
  }
  else{
    $('.krasascits_h').hide();     
  }
});
	
});

function resize()
{
	var h;
	h = Math.max($('#body_left').height(), $('#body_right').height()) + $('#body_left').offset().top;
	
	h += $('#bottom').height();

	if(h < $('body').height()) {
		$('#bottom').css(
			'margin-top',
			($('body').height() - h) + 'px'
			);
	}
	else
	{
		$('#bottom').css('margin-top', '0px');
	}                    
	
}
