//Раскрывание списка статей
$(document).ready(function(){
	$('table').css({'width':'750px'});
	var data;
	var id = window.location.search;
	var check;
	var aH;
    $('.art').click(function(){
		data = $(this).parent().attr('id');
		check = $('#'+data+" div[class^='artMarker']").attr('class');
		
		if(check == 'artMarkerP')
		{
			$.ajax({
				url:'/includes/php/art.ajax.php',
				type:'POST',
				data: 'data='+data+'&id='+id,
				success: function(html)
				{
					aH = $('#'+data+' .art').height();
					$('#'+data+' .artText').empty();
					$('#'+data+' .artText').append(html);
					$('#'+data+' .artText').css({'top':5-aH});
					$('#'+data+' .artText').css({'padding-top':aH});
					$('#'+data+' .artMarkerP').attr('class', 'artMarkerM');
					$('#'+data+' .artText').slideDown(200);
				}
			});
		}
		else
		{
			$('#'+data+' .artText').slideUp(200, function(){
				$('#'+data+' .artMarkerM').attr('class', 'artMarkerP');
			});
		}
	});
	
	var radItem;
	radItem = $('.adRad:checked');
	radInit(radItem);
	$('.adRad').change(function(){
		radItem = $(this);
		radInit(radItem);
	});
	function radInit(_radItem){
		data = _radItem.val();
		radtit = _radItem.attr('title');
		$('#adBottom').text(radtit);
		
		$.ajax({
			url:'/includes/php/adradio.ajax.php',
			type:'POST',
			data: 'data='+data,
			success: function(html)
			{
				$('#adResult').html(html);
				var rH = $('#cRight').height();
				var lH = $('#cLeft').height();
				var h = $('#lastDiv').height();
				h = h + (rH - lH);
				$('#lastDiv').css({'min-height':h+5});
				var he = $('#cRight').height() - 120;
				$('#emptyDiv').css({'height':he});
			}
		});
	}
	
	var items = 'secondMenu1';
	var data;
	$('#secondMenu div').click(function(){
		data = $(this).attr('id');
		var id = window.location.search;
		if(data != items)
		{
			$.ajax({
				url:'/includes/php/ksp.ajax.php',
				type:'POST',
				data: 'data='+data+'&id='+id,
				success: function(html)
				{
					$('#depBiography').empty();
					$('#depBiography').append(html);
				}
			});
			$('#'+data).css({'color':'#000','background':'#FFF','border-bottom-color':'#FFF'});
			$('#'+items).css({'color':'#FFF','background':'#666','border-bottom-color':'#000'});
			items = data;
		}
	});
});

var gmn = 20;
function getMoreNews()
{
	$.ajax({
			url:'/includes/php/getmorenews.ajax.php',
			type:'POST',
			data: 'data='+gmn,
			success: function(html)
			{
				$('#newsList').append(html);
				gmn +=20;
			}
		});
}