﻿$(document).ready(function() {


//** ajax site **//
			
	$('#nav a').click(function () {		
		

		if ( $('#main-news-back').is(':visible') ) { 
        $('#main-news-back').hide('fast');
        $('#main-news').hide('fast');
        } 
        		
		$('#content').slideUp('slow');	
		$('#loading').show();


		var element = this
		var id = $(element).attr('id'); 
		var gideceksayfa = "content.asp?p=j&c_id=" + id;
	
		$.ajax({
		
			type: 'GET',
			url: gideceksayfa,
			cache: false,
			dataType: "html", 

			success: function (gostert) {	
				
				$('#loading').hide('fast');
				//$('#content').slideDown('slow');
				$('#content').slideDown('slow').html(gostert);
				$('#left').jScrollPane();		
			}		
	});	
	
	return false;
	});

//****//




/*
latest news scroller
*/
	var height = 0;
			var to = null;
			var theAnimation;
			var newsScroller;
			$(document)
			.ready(function(){
				newsScroller = $('#newsScroller');
				
				var curSet = newsScroller
				.prev()
					.addClass('ns')
				.end()
				.wrap('<div>')
				.parent()
					.addClass('ns')
				.end()
				.wrap('<div>')
				.children()
				.slice(0,2)
				.each(function(){
					height += $(this).outerHeight(true);
				});
				
				theAnimation = function(){
					if( !newsScroller.is(':animated') ){
						newsScroller.animate({top:-height},1000,function(){
							height = 0;
							curSet = newsScroller
							.append(curSet)
							.css('top',0)
							.children()
							.slice(0,2)
							.each(function(){
								height += $(this).outerHeight(true);
							});
						});
					}
				};
				
				to = setInterval(theAnimation,4000);
							
				newsScroller.bind('mouseenter',function(){
					clearInterval(to);
				})
				.bind('mouseleave',function(){
					to = setInterval(theAnimation,4000);
				});
			});


/*
*******************
*/


	
});	
