﻿	$(function()
			{
/*Tab*/				
$("span#linkstab").click(function()
									 {
										 //$("#box").toggle("slow");
										 $("#links").removeClass('hide').addClass('show');
										 $("#hlinks").removeClass('show').addClass('hide');
										 $(this).removeClass('TabPassive').addClass('TabActive');
										 $("span#hlinkstab").removeClass('TabActive').addClass('TabPassive');
									 });
$("span#hlinkstab").click(function()
									 {
										//$("p").toggleClass("highlight"); 
										 $("#links").removeClass('show').addClass('hide');
										 $("#hlinks").removeClass('hide').addClass('show');
										  $(this).removeClass('TabPassive').addClass('TabActive');
										   $("span#linkstab").removeClass('TabActive').addClass('TabPassive');
									 });
/*Teskilat*/
$("#anahizmet").hover(function()
									 {
										 //$("#box").toggle("slow");
										 $("#anahizmetcontainer").removeClass('hideteskilat').addClass('showteskilat');
										 $("#denetimvedanismacontainer").removeClass('showteskilat').addClass('hideteskilat');
										 $("#yardimcicontainer").removeClass('showteskilat').addClass('hideteskilat');
									 });
$("#denetimvedanisma").hover(function()
									 {
										 //$("#box").toggle("slow");
										 $("#anahizmetcontainer").removeClass('showteskilat').addClass('hideteskilat');
										 $("#denetimvedanismacontainer").removeClass('hideteskilat').addClass('showteskilat');
										 $("#yardimcicontainer").removeClass('showteskilat').addClass('hideteskilat');
									 });
$("#yardimci").hover(function()
									 {
										 //$("#box").toggle("slow");
										 $("#anahizmetcontainer").removeClass('showteskilat').addClass('hideteskilat');
										 $("#denetimvedanismacontainer").removeClass('showteskilat').addClass('hideteskilat');
										 $("#yardimcicontainer").removeClass('hideteskilat').addClass('showteskilat');
									 });
$("#oturumac").click(function()
									 {
										 //$("#box").toggle("slow");
										 $("#Login").removeClass('hide').addClass('show');
									 });
$("#loginkapat").click(function()
									 {
										 //$("#box").toggle("slow");
										 $("#Login").removeClass('show').addClass('hide');
									 });
$("#kullanicidetayac").click(function()
									 {
										 //$("#box").toggle("slow");
									     $("#Login").removeClass('hide').addClass('show');
									 });
$("#kullanicidetaykapat").click(function()
									 {
										 //$("#box").toggle("slow");
									     $("#Login").removeClass('show').addClass('hide');
									 });
/*HaberSLide*/
	var waitTime = 12000; // haber bekleme süresi
	
	$("#fn-thumbs").show();
	$("#fn-thumbs a:first").addClass("active");
		
	var imageWidth = $("#fn-photos").width();
	var imageSum = $("#fn-photos img").size();
	var imageReelWidth = imageWidth * imageSum;
	
	$("#fn-photos div").css({'width' : imageReelWidth});
	$("div.fn-slider").css({'width' : imageReelWidth});
	
	rotate = function(){	
		var triggerID = $active.attr("rel") - 1;
		var image_reelPosition = triggerID * imageWidth;

		$("#fn-thumbs a").removeClass('active');
		$active.addClass('active');
		
		$("#fn-photos div").animate({ 
			left: -image_reelPosition
		}, 500 );
		
		$("#fn-text div.fn-slider").animate({ 
			left: -image_reelPosition
		}, 500 );
		
	}; 
	
	rotateSwitch = function(){		
		play = setInterval(function(){
			$active = $('#fn-thumbs a.active').next();
			if ( $active.length === 0) {
				$active = $('#fn-thumbs a:first');
			}
			rotate();
		}, waitTime);
	};
	
	rotateSwitch();
	
	
	// üstüne gelince dur
	$("#fn-container").hover(function() {
		clearInterval(play);
	}, function() {
		rotateSwitch();
	});	
	

	$("#fn-thumbs a").click(function() {	
		$active = $(this);
		clearInterval(play);
		rotate();
		rotateSwitch();
		return false;
	});	
	/*projeler*/
	$(function(){
		   
/* -------- Slide ------- */
    var slideCount = $('.logoContent img').length,
		newHeight = 116 * slideCount, //116 = 108px resim yuksekligi + 8px margin
		newYPos = 0,
		curYPos = 0,
		direction = 'r',
		button = 'r-arrow',
		waitTime = 5000; // otomatik kayma suresi

    $('.slider').css('height', newHeight);
    $('#l-arrow').addClass('passive');

    $('.logoNav a').each(function() {
        $(this).bind('click', function() {
            button = $(this).attr('id');
            switch (button) {
                case 'r-arrow':
                    if (newHeight == -(newYPos - 116)) { return false; } else { rotateSlides('r'); }
                    break;
                case 'l-arrow':
                    if (curYPos == 0) { return false; } else { rotateSlides('l'); }
                    break;
            }
			return false;
        });
    });

    function rotateSlides(direction) {
        if (direction == 'r') {
            newYPos = curYPos - 116;
            $('.slider').animate({ top: '' + newYPos + 'px' }, 500);
            curYPos = newYPos;
            $('#l-arrow a').removeClass('passive');
            if (newYPos == (116 - newHeight)) {
                $('#fsr-arrow a').addClass('passive');
                return false;
            }
        }
        else {
            newYPos = curYPos + 116;
            $('.slider').animate({ top: '' + newYPos + 'px' }, 500);
            curYPos = newYPos;
            $('#r-arrow a').removeClass('passive');
            if (newYPos == 0) {
                $('#l-arrow a').addClass('passive');
                return false;
            }
        }
        return false;
    }

    function autoRotate() {
        play = setInterval(function() {
            curYPos = newYPos = newYPos - 116;
            if (newHeight == -newYPos) {
                newYPos = 0;
                $('.slider').animate({ top: '' + newYPos + 'px' }, 1000);
                curYPos = newYPos;
            }
            $('.slider').animate({ top: '' + newYPos + 'px' }, 500);
            curYPos = newYPos;
            if (newHeight == -newYPos) {
                $('#r-arrow a').addClass('passive');
            }
        }, waitTime);
    }

    $(".logoSlide").hover(
		function() { clearInterval(play); },
		function() { clearInterval(play); autoRotate(); }
	);

    autoRotate();
		   

});
			});
