/*---------------------------------------------------
js coder	:	WWW.ASIDESIGNER.COM
last edit	:	29.08.2010
---------------------------------------------------*/

$(document).ready(function(){

		var x = document.location.href.split('#');
		
		if (x[1])
		{
			location.href='/'+x[1];
		}
		
		//kelime acilir menu
		$(".m1").mouseenter(function () {
			$("#menu1").fadeIn(100);
		});
		$(".m1").mouseleave(function () {
			$("#menu1").fadeOut(1000);
		});
		//uye acilir menu
		$(".m2").mouseenter(function () {
			$("#menu2").fadeIn(100);
		});
		$(".m2").mouseleave(function () {
			$("#menu2").fadeOut(1000);
		});
		//rastgele acilir menu
		$(".m3").mouseenter(function () {
			$("#menu3").fadeIn(100);
		});
		$(".m3").mouseleave(function () {
			$("#menu3").fadeOut(1000);
		});

		$("#sondusunceler").click(function () {
			$(".sondusunceler").toggle(100);
		});

		$(".sonuyeler").hide();
		$("#sonuyeler").click(function () {
			$(".sonuyeler").toggle(100);
		});		
		
		$(".sonkelimeler").hide();
		$("#sonkelimeler").click(function () {
			$(".sonkelimeler").toggle(100);
		});

		$("#istatistik").click(function () {
			$(".istatistik").toggle(100);
		});
		
		$("a#rklm").mouseover(function () {
			$("img#rklm-fon").css("opacity","1.0");
			$("img#rklm-fon").css("filter","alpha(opacity=100)");
			$("#orta").hide();
		});

		$("a#rklm").mouseleave(function () {
			$("img#rklm-fon").css("opacity","0.2");
			$("img#rklm-fon").css("filter","alpha(opacity=20)");
			$("#orta").slideDown("fast");
		});		
				
		//arama formu ac
		$('a#aratik').click(function () {
			$('.yukleniyor').show(''); $('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
			$('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
			$.ajax({
				type: 'POST',
				url: '/kontrol.php',
				data: 'arama=formu',
				success:function (cevap){
						$('.yukleniyor').hide('');
						$('#gy').html(cevap);
						location.href='#';
						}
					});	
		});
		
		//arama formu ile kelime ara
		$('form#arama').submit(function(){
		var y = $.trim($('.ara').val());	
		if (y == 'ara!')
		{
			jAlert('kelime giriniz', 'ikaz');
			return false;
		}
		else
		{
		$('.yukleniyor').show('');
		$('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
		$.ajax({
			type: 'POST',
			url: '/kontrol.php?kelime=ara',
			data: 'kelam='+y,
			success:function (cevap){
					$('.yukleniyor').hide('');
					$('#gy').html(cevap);
					location.href='#';
					}
				});
		}
		});
		
		//kelime bildir formu ac
		$('a#bildirtik').click(function () {
			$('.yukleniyor').show('');
			$('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
			$.ajax({
				type: 'POST',
				url: '/kontrol.php',
				data: 'bildir=formu',
				success:function (cevap){
						$('.yukleniyor').hide('');
						$('#gy').html(cevap);
						location.href='#';
						}
					});	
		});	
		
		//uye giris  formu ac
		$('a#giristik,#uyegir').click(function () {
			$('.yukleniyor').show('');
			$('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
			$.ajax({
				type: 'POST',
				url: '/kontrol.php',
				data: 'giris=formu',
				success:function (cevap){
						$('.yukleniyor').hide('');
						$('#gy').html(cevap);
						location.href='#';
						}
					});	
		});			
		
		//uye ol  formu ac
		$('a#katiltik,#uyeol').click(function () {
			$('.yukleniyor').show('');
			$('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
			$.ajax({
				type: 'POST',
				url: '/kontrol.php',
				data: 'uyelik=formu',
				success:function (cevap){
						$('.yukleniyor').hide('');
						$('#gy').html(cevap);
						location.href='#';
						}
					});	
		});			

		//sifre talep  formu ac
		$('a#sifretik').click(function () {
			$('.yukleniyor').show('');
			$('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
			$.ajax({
				type: 'POST',
				url: '/kontrol.php',
				data: 'sifretalep=formu',
				success:function (cevap){
						$('.yukleniyor').hide('');
						$('#gy').html(cevap);
						location.href='#';
						}
					});	
		});			

		//iletisim formu ac
		$('a#iletik').click(function () {
			$('.yukleniyor').show('');
			$('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
			$.ajax({
				type: 'POST',
				url: '/kontrol.php',
				data: 'iletisim=formu',
				success:function (cevap){
						$('.yukleniyor').hide('');
						$('#gy').html(cevap);
						location.href='#';
						}
					});	
		});					

		//ajax islemleri rastgele bir kelime
		$('#birkelime').click(function () {
			$('.yukleniyor').show('');
			$('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
			$.ajax({
				type: 'POST',
				url: '/kontrol.php',
				data: 'bir=kelime',
				success:function (cevap){
						$('.yukleniyor').hide('');
						$('#gy').html(cevap);
						location.href='#';
						}
					});	
		});	
		
		//ajax islemleri rastgele on kelime
		$('#onkelime').click(function () {
			$('.yukleniyor').show('');
			$('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
			$.ajax({
				type: 'POST',
				url: '/kontrol.php',
				data: 'on=kelime',
				success:function (cevap){
						$('.yukleniyor').hide('');
						$('#gy').html(cevap);
						location.href='#';
						}
					});	
		});	

		//ajax islemleri cikis
		$('#cikistik').click(function () {
			$('.yukleniyor').show('');
			$('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
			$.ajax({
				type: 'POST',
				url: '/kontrol.php',
				data: 'uye=cikis',
				success:function (cevap){
						$('.yukleniyor').hide('');
						jAlert(cevap, 'bilgi');
						setTimeout("reload();", 2000);
						}
					});	
		});			
		
		//ajax islemleri anasayfa
		$('#anasayfa').click(function () {
			$('.yukleniyor').show('');
			$('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
			$.ajax({
				type: 'POST',
				url: '/kontrol.php',
				data: 'ana=sayfa',
				success:function (cevap){
						$('.yukleniyor').hide('');
						$('#gy').html(cevap);
						location.href='#';
						}
					});	
		});	


		
});

		//ajax islemleri kelime cagir
		function gy(yv) {
			$('.yukleniyor').show('');
			$('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
			$.ajax({
				type: 'POST',
				url: '/kontrol.php',
				data: 'kelime=anlam&seo='+yv,
				success:function (cevap){
						$('.yukleniyor').hide('');
						$('#gy').html(cevap);
						location.href='#'+yv+'-kelime-anlami.html';
						}
					});	
		}

		//ajax islemleri id ile kelime cagir
		function gyi(yav) {
			$('.yukleniyor').show('');
			$('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
			$.ajax({
				type: 'POST',
				url: '/kontrol.php',
				data: 'kelime=anlam&id='+yav,
				success:function (cevap){
						$('.yukleniyor').hide('');
						$('#gy').html(cevap);
						location.href='#';
						}
					});	
		}
		
		//ajax islemleri uye cagir
		function yg(yv) {
			$('.yukleniyor').show('');
			$('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
			$.ajax({
				type: 'POST',
				url: '/kontrol.php',
				data: 'uye=profil&seo='+yv,
				success:function (cevap){
						$('.yukleniyor').hide('');
						$('#gy').html(cevap);
						location.href='#'+yv;
						}
					});	
		}

		//ajax islemleri abone ol
		function aol(yv) {
			$('.yukleniyor').show('');
			$('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
			$.ajax({
				type: 'POST',
				url: '/kontrol.php',
				data: 'abone=ol&seo='+yv,
				success:function (cevap){
						$('.yukleniyor').hide('');
						jAlert('kelime yorum akışı aboneliğiniz başlatıldı.', 'bilgi');
						location.href=yv+'-kelime-anlami.html';
						}
					});	
		}

		//ajax islemleri abone iptal
		function aiptal(yv) {
			$('.yukleniyor').show('');
			$('#gy').html('<center><img style="margin-top:100px;" src="/img/loader.gif"></center>');
			$.ajax({
				type: 'POST',
				url: '/kontrol.php',
				data: 'abone=iptal&seo='+yv,
				success:function (cevap){
						$('.yukleniyor').hide('');
						jAlert('kelime yorum akışı aboneliğiniz kaldırıldı.', 'bilgi');
						location.href=yv+'-kelime-anlami.html';
						}
					});	
		}
		
		//sayfa yonlendirme fonksiyonu
		function reload() {
		window.location.href='http://www.kelimeanlami.com';
		}
