// JavaScript Document







$(document).ready(



				  function (){



					  	$(".popularContents").slideUp(1);



						$("#content1").slideDown(700);

						

						$(".yesContent").slideUp(1);





					  }



				  );







/*News Ticker AJAX codes ****************************************************************************************************/











var newsArr=Array();







				$.ajax({



					type: 'POST',



					url: 'newsTickerGet.php',



					data: '',



					success: function(ajaxCevap) {



						var results=ajaxCevap.split("|");



						for(var i=0; i<results.length; i++){



								newsArr.push(results[i]);



							}



					}



				});















var counter=0;







function newsTicker(){



			$("#newsTicker").animate({opacity:0},300,function(){



															  if(counter>=(newsArr.length)-1){



																  	counter=0;



																	$("#newsTicker").html("");



																  	$("#newsTicker").html("<a href=\""+newsArr[counter+1]+"\" style=\"color:#990000;\">"+newsArr[counter]+"</a>");



															  		$("#newsTicker").animate({opacity:1},300);



																	counter+=2;



															  }else{



																  	$("#newsTicker").html("");



																  	$("#newsTicker").html("<a href=\""+newsArr[counter+1]+"\" style=\"color:#990000;\">"+newsArr[counter]+"</a>");



															  		$("#newsTicker").animate({opacity:1},300);	



																	counter+=2;



															  }



															  



															  });



}







setInterval(newsTicker,3000);















/*Change highlight areas big picture with clicked ****************************************************************************************************/







function getPictureAndInfo(topic, sourcePict, sourceID){



		$("#higlightTopic h3").html("");



		$("#highlightTopic h3").html(topic);



		$("#highlightTopic").attr("href", "haberler&hid="+sourceID);



		$("#highlightBigPicture img").animate({opacity:0},300,function(){



																      $("#highlightBigPicture img").attr("src", sourcePict);



																	  $("#highlightBigPicture img").animate({opacity:1},300);



																   });



	}



	



/*Tab Changer FNC *****************************************************************************************************************************************/







oldID=1;







function slidePopular(tabID){



		$("#content"+tabID).slideDown(500);



		$("#"+tabID).css({backgroundImage:'url(tabTopicBack.png)', backgroundRepeat:'repeat-x', color:'#ffffff'});



		$("#content"+oldID).slideUp(500);



		$("#"+oldID).css({backgroundImage:'none', color:'#666666'});



		oldID=tabID;



	}



	



	



/*Get Search results **************************************************************************************************************************************/







function getSearch(){



		window.location="search&q="+$("#searchArea").attr("value");



	}



	



	



/*send mail from contact form **************************************************************************************************************************************/







function sendMail(){



		if($("#adsoyad").attr("value")=="" || $("#eposta").attr("value")=="" || $("#konu").attr("value")=="" || $("#konu").attr("value")=="" || $("#mesaj").val()==""){



				alert("Lutfen tum alanlari doldurunuz !");



		}else{



			$.ajax({



					type: 'POST',



					url: 'sendMail.php',



					data:$("#emailform").serialize(),



					success: function(ajaxCevap) {



						alert(ajaxCevap);



					}



				});	



		} 



		



	}

	

/* Yazar Editör ve söylesiler tab changer -------------------------------------------------------------------------------------------------------------------------*/



var realID=0;	

	

function openYES(clickedID){

		$("#yesContent"+clickedID).slideDown(700);

		$("#yesContent"+realID).slideUp(700);

		realID=clickedID;

	

	}

	

	

/* SEARCH ARCHIVE -----------------------------------------------------------------------------------------------------------------------------------*/



function searchArchive(){

	

	if($("#arsivtarih").attr("value")==""){

			alert("Lütfen arşiv tarihini seçiniz...");

	}else{

	

		$("#archiveSearchResults").html('<img src="loading.gif" /><br/>Arşiv taranıyor sonuçlar burada gösterilecek, lütfen bekleyin...');

		$('html, body').animate({ scrollTop: $("#slideHere").offset().top }, 2000);

		

		$.ajax({



					type: 'POST',



					url: 'searchArchive.php',



					data:'anahtarkelime='+$("#anahtarkelime").attr("value")+'&arsivtarih='+$("#arsivtarih").attr("value")+'&yazarisim='+$("#yazarisim").attr("value"),



					success: function(ajaxCevap) {



						$("#archiveSearchResults").html(ajaxCevap);



					}



				});

	}



}

	

	

/*------------------------------------------------------------------------------*/	
	

function slidePage(){

		$('html, body').animate({ scrollTop: $("#highlightAjaxAreaAndverticalBanners").offset().top }, 2000);

	}

/* Change OSU Boxes top picture with on mouse over event ------------------------------------------------------------------------------*/

function osuPictureChange(osupictDir, whichOSUBox){
		$("#"+whichOSUBox).attr("src", osupictDir);
		
	}








