// JavaScript Document
var curBolumID;
function loadBolum( direction )
{
	$("#bolumBilgi").hide();
	$("#bolumNav div").html("<img src='images/loading.gif' />");
	$.ajax({
		  url: "inc/ajax.general.php",
		  type: "GET",
		  data: {act: 'loadBolum', direction: direction, curBolumID: curBolumID},
		  dataType: "json",
		  success: function(JSON)
		  {
			 if( JSON.result == 1 )
			 {
				var data	= (JSON.extra1 == undefined)?'Tanımsız hata.':JSON.extra1;
				
				if( JSON.extra2 != 0 )
	            {
					//$("#bolumBilgi").fadeOut(100, function () 
					//{
						$("#bolumFoto img").attr('src', 'files/images/bolum/'+data.k_resim);					
						$("#bolumAdi span").html( '<a href="bolumler.php?bolumNo='+data.id+'">'+data.bolum_adi+'</a>');
						$("#bolumIcerik span").text(data.k_icerik);
					//})
					
					$("#bolumBilgi").fadeIn();
					curBolumID	= data.id;
					
					if( JSON.extra2 == 1 )
					{
						if( direction == 'next' )
						{
							$("#bolumNav .right").css('display','none');
						}
						else
						{
							$("#bolumNav .left").css('display','none');
						}
					}
					else
					{
						if( direction == 'next' )
						{
							$("#bolumNav .left").css('display','block');
						}
						else
						{
							$("#bolumNav .right").css('display','block');
						}
					}
			 	}

					$("#bolumNav div").html('');
			 }
			 else
			 {
				 var extra	= (JSON.extra1 == undefined)?'Tanımsız hata.':JSON.extra1;
				 alert( 'Hata: ' + extra )
			 }
		  }//#END success:
	   }//#END .ajax
	);//#END .ajax
}//#END function loadBolum
