$(function(){
	$('#languages').change(function(){
		$(this).parent().submit();
	});
	
	$('.newprojects a, .img a.btn_zoom2, a.video').click(function(){
		window.open($(this).attr('href'), 'project', 'resizable=no,menubar=no,toolbar=no,width=920,height=700,scrollbars=yes');
		return false;
	});
	
	$('#project #footer .container p, #popup #footer .container p, #video #footer .container p').append('<input type="button" value="' + i18n['popupClose'] + '" />');
	$('#project #footer .container p input, #popup #footer .container p input, #video #footer .container p input').click(function(){window.close();});
	
	if ($.browser.msie == true && $.browser.version == '6.0')
	{
		$('.newprojects tr').hover(function(){
			$('.popup', $(this)).show();
		}, function(){
			$('.popup', $(this)).hide();
		});
	}
	
	$('.plist a').hover(function(){
		$('strong', $(this)).show();
	}, function(){
		$('strong', $(this)).hide();
	});
	
	var isCtrl = false;
	$(document).keyup(
		function (e)
		{
			if (e.which == 17)
			{
				isCtrl=false;
			}
		}).keydown(
		function (e)
		{
			if (e.which == 17)
			{
				isCtrl=true;
			}
			
			if (e.which == 39 && isCtrl == true)
			{
				if ($('head link[rel=next]').length == 1)
				{
					window.location = $('head link[rel=next]').attr('href');
				}
			}
			
			if (e.which == 37 && isCtrl == true)
			{
				if ($('head link[rel=prev]').length == 1)
				{
					window.location = $('head link[rel=prev]').attr('href');
				}
			}
		}
	);
	
	indexes = ($.browser.msie) ? (($.browser.version == '6.0') ? [13, 0] : [13, 0]) : [18, 3];
	$('th.complectation').css('height', $('tr.complectation td:first').height() + indexes[0]);
	$('.tfields thead th').css('height', $('div.table thead th').height()+ indexes[1]);
});