﻿$(document).ready(function() {

	//** ajax form **//
			
	$('#ajax_submit').click(function () {		
				
		var gideceksayfa = $('form').attr('action');
		var veriler= $('form').serialize();		
		
		$('form').attr('disabled','true');
		$('form').slideUp('slow');	
		$('#sonuc').html('<p><img src="page_images/anim-loading.gif"/> Lütfen Bekleyiniz</p>');
				
		$.ajax({
			type: 'GET',
			url: gideceksayfa,
			data: veriler,
			cache: false,
			success: function (gostert) {				
				$('#sonuc').html(gostert);
			}		
		});	
	
	return false;
	});

	//** show hide**//
   
	$('p.showhide a').click(function() {
		var element = this
		var id = $(element).attr('name'); 
		$('#hiddendiv' + id+',p#show' + id + ',p#hide' + id).toggle(500); 
		return false; 
	}); 

	//** light box**//
    $(function() {
        $('#photo a').lightBox();
    });
    
    //** light box**//
    $(function() {
        $('ul.belge a').lightBox();
    });

   








/*
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);
				});
			});











});	
