$(document).ready(function(){
      $('a[rel*=facebox]').facebox({
        loadingImage : '/images/indicator.gif',
        closeImage   : '/images/closelabel.png'
      });

      Cufon.replace('.buyukalan h2,.buyukalan h3,.sag-yan h4,.fabrika h4,.telefon h4,.email h4,#end small,.icerik h3');

	/* *** Home Banners *** */
	$('#cycle').after('<div class="controls">').cycle({
		fx: 'fade',
		timeout: '8000',
		pager: '.controls',
		next: '#next'
	});

	var cardsTab = {
		sensitivity: 40, // number = sensitivity threshold (must be 1 or higher)
		interval: 100, // number = milliseconds for onMouseOver polling interval
		over: cardsOn, // function = onMouseOver callback (REQUIRED)
		timeout: 100, // number = milliseconds delay before onMouseOut
		out: cardsOff // function = onMouseOut callback (REQUIRED)
	};
	function cardsOn(){
		$(this).children().stop(true, true);
		$(this).children().animate( { left: "0px" }, 200);
	}
	function cardsOff(){
		$(this).children().animate( { left: "-235px" }, 200 );
	}
	if ($("body").hasClass("anasayfa")) {
		$("#navigation li.anasayfa a").children().css({ 'left' : '0px' });
	} else {
		$("#navigation li.anasayfa a").hoverIntent( cardsTab );
	}

	 /* *** Packaging Tab *** */
	var packagingTab = {
		sensitivity: 40, // number = sensitivity threshold (must be 1 or higher)
		interval: 100, // number = milliseconds for onMouseOver polling interval
		over: packagingOn, // function = onMouseOver callback (REQUIRED)
		timeout: 100, // number = milliseconds delay before onMouseOut
		out: packagingOff // function = onMouseOut callback (REQUIRED)
	};
	function packagingOn(){
		$(this).children().stop(true, true);
		$(this).children().animate( { left: "0px" }, 200);
	}
	function packagingOff(){
		$(this).children().animate( { left: "-235px" }, 200 );
	}
	if ($("body").hasClass("urunler")) {
		$("#navigation li.urunler a").children().css({ 'left' : '0px' });
	} else {
		$("#navigation li.urunler a").hoverIntent( packagingTab );
	}

    /* *** Prices Tab *** */
    var pricesTab = {
		sensitivity: 40,
		interval: 100,
		over: pricesOn,
		timeout: 100,
		out: pricesOff
	};
	function pricesOn(){
		$(this).children().stop(true, true);
		$(this).children().animate( { left: "0px" }, 200);
	}
	function pricesOff(){
		$(this).children().animate( { left: "-215px" }, 200 );
	}
    if ($("body").hasClass("referanslar")) {
		$("#navigation li.referanslar a").children().css({ 'left' : '0px' });
	} else {
		$("#navigation li.referanslar a").hoverIntent( pricesTab );
	}

	/* *** Quote Tab *** */
	var quoteTab = {
		sensitivity: 40,
		interval: 100,
		over: quoteOn,
		timeout: 100,
		out: quoteOff
	};
	function quoteOn(){
		$(this).children().stop(true, true);
		$(this).children().animate( { left: "0px" }, 200);
	}
	function quoteOff(){
		$(this).children().animate( { left: "-272px" }, 200 );
	}
    if ($("body").hasClass("hakkimizda")) {
		$("#navigation li.hakkimizda a").children().css({ 'left' : '0px' });
	} else {
		$("#navigation li.hakkimizda a").hoverIntent( quoteTab );
	}

    /* *** Contact Tab *** */
    var contactTab = {
		sensitivity: 40,
		interval: 100,
		over: contactOn,
		timeout: 100,
		out: contactOff
	};
	function contactOn(){
		$(this).children().stop(true, true);
		$(this).children().animate( { left: "0px" }, 200);
	}
	function contactOff(){
		$(this).children().animate( { left: "-270px" }, 200 );
	}
    if ($("body").hasClass("iletisim")) {
		$("#navigation li.iletisim a").children().css({ 'left' : '0px' });
	} else {
		$("#navigation li.iletisim a").hoverIntent( contactTab );
	}

	/* *** Logo Glow *** */
	$("#head h1 a").hover(function(){
		$(this).stop(true, true);
    	$(this).animate( { opacity: 0.1 }, 300);
	},
	function(){
		$(this).animate( { opacity: 1.0 }, 200);
	});

    $(".sertifika a").hover(function(){
		$(this).stop(true, true);
    	$(this).children().animate( { right: "3px" }, 100);
	},
	function(){
		$(this).children().animate( { right: "0px" }, 100);
	});

	$(".form fieldset input.submitform").hover(function(){
		$(this).stop(true, true);
    	$(this).fadeTo("fast", 0.8);
	},
	function(){
		$(this).fadeTo("fast", 1.0);
	});

    $(document).pngFix();

});
