function giris1(){
var input1 = $("#kullanici_adi").serialize();
var input2 = $("#sifre").serialize();
var input3 = $("#guvenlik_kodu").serialize();
var sc = input1+"&"+input2+"&"+input3;
$('#ekleniyor').html('<center><img src="../images/yukleniyor.gif"></center>');
$.ajax({
	type: "POST",
	url: "giris_kontrol.php",
	data: sc,
	success: function(msg){
	if (msg=="ok")
		{
		$('#ekleniyor').html("Giris Başarılı!");
		setTimeout("window.location = 'index.php';",1000);
		}
	else
		{$('#ekleniyor').html( msg );}
   }
});
}

function giris(){
var input1 = $('#txtKullaniciAdi1').serialize();
var input2 = $('#txtSifre1').serialize();
var sc = input1+"&"+input2;
$('#giris_sonuc').html('<center><img src="./images/yukleniyor.gif"></center>');
$.ajax({
	type: "POST",
	url: "./inc/giris_kontrol.php",
	data: sc,
	success: function(msg){
	if (msg=="ok")
		{
		$('#giris_sonuc').html("Giris Başarılı!");
		setTimeout("window.location = 'index.php';",1000);
		}
	else
		{
		$("#giris_sonuc").animate({ opacity: 0 }, 500);
		$("#giris_sonuc").animate({ opacity: 1 }, 500);
		$("#giris_sonuc").animate({ opacity: 0 }, 500);
		$("#giris_sonuc").animate({ opacity: 1 }, 500);
		$('#giris_sonuc').html( msg );}
   }
});
}

function uyeol(elementid1,elementid2,elementid3){
var input1 = $(":input[@type=text]").serialize();
var input2 = $(":input[@type=password]").serialize();
var input3 = $(":select").serialize();
var sc = input1+"&"+input2+"&"+input3;
$('#ekleniyor').html('<center><img src="./images/yukleniyor.gif"></center>');
$.ajax({
	type: "POST",
	url: "./inc/uye_ol_kontrol.php",
	data: sc,
	success: function(msg){
	if (msg=="ok")
		{	
		$('#olumlu_sonuc').html("<div style='width:85%; background:#bde0b8; border:1px dashed #396c21; padding:5px; font-size: 11px;color: #396c21;font-weight:bold;'>Sayın kullanıcı, sisteme kaydınız gerçekleştirilmiştir fakat üyeliğinizin aktif duruma gelmesi için belirttiğiniz eposta adresine aktifleştirme kodu (linki) gönderilmiştir. Bu kodu (linki) kullanarak üyeliğinizi aktif duruma getirebilirsiniz. <br /><br /> Lütfen belirtmiş olduğunuz epostanızı kontrol ediniz.</div>");
		
		var el1 = document.getElementById(elementid1);
		var el2 = document.getElementById(elementid2);
		var el3 = document.getElementById(elementid3);
		el1.style.display = (el1.style.display =="none") ? "none" : "none";
		el2.style.display = (el2.style.display =="none") ? "none" : "none"; 
		el3.style.display = (el3.style.display =="none") ? "none" : "none"; 
		
		}
	else
		{$('#ekleniyor').html( msg );}
   }
});


}

function iletisim_gonder(elementid1,elementid2,elementid3){
var input1 = $(":input[@type=text]").serialize();
var input2 = $(":input[@type=hidden]").serialize();
var input3 = $(":textarea").serialize();
var sc = input1+"&"+input2+"&"+input3;
$('#ekleniyor').html('<center><img src="./images/yukleniyor.gif"></center>');
$.ajax({
	type: "POST",
	url: "./inc/iletisim_kontrol.php",
	data: sc,
	success: function(msg){
	if (msg=="ok")
		{	
		$('#olumlu_sonuc').html("<div style='width:95%; background:#bde0b8; border:1px dashed #396c21; padding:5px; font-size: 11px;color: #396c21;font-weight:bold;'>İletişim formunu kullandığınız için teşekkür ederiz. Bilgiler bize ulaşmıştır. 4dk-10saat arasında yanıtlanacaktır.</div><br />");
		
		var el1 = document.getElementById(elementid1);
		var el2 = document.getElementById(elementid2);
		var el3 = document.getElementById(elementid3);
		el1.style.display = (el1.style.display =="none") ? "none" : "none";
		el2.style.display = (el2.style.display =="none") ? "none" : "none"; 
		el3.style.display = (el3.style.display =="none") ? "none" : "none"; 
		
		}
	else
		{$('#ekleniyor').html( msg );}
   }
});


}


function profil_duzelt(elementid1,elementid2,elementid3){
var input1 = $(":input[@type=text]").serialize();
var input2 = $(":input[@type=hidden]").serialize();
var input3 = $(":select").serialize();
var sc = input1+"&"+input2+"&"+input3;
$('#ekleniyor').html('<center><img src="./images/yukleniyor.gif"></center>');
$.ajax({
	type: "POST",
	url: "./inc/profil_kontrol.php",
	data: sc,
	success: function(msg){
	if (msg=="ok")
		{	
		$('#olumlu_sonuc').html("<div style='width:85%; background:#bde0b8; border:1px dashed #396c21; padding:5px; font-size: 11px;color: #396c21;font-weight:bold;'>Bilgileriniz basariyla guncellestirildi.</div>");
		
		var el1 = document.getElementById(elementid1);
		var el2 = document.getElementById(elementid2);
		var el3 = document.getElementById(elementid3);
		el1.style.display = (el1.style.display =="none") ? "none" : "none";
		el2.style.display = (el2.style.display =="none") ? "none" : "none"; 
		el3.style.display = (el3.style.display =="none") ? "none" : "none"; 
		
		}
	else
		{$('#ekleniyor').html( msg );}
   }
});
}

function sifre_duzelt(elementid1,elementid2,elementid3){
var input1 = $(":input[@type=text]").serialize();
var input2 = $(":input[@type=hidden]").serialize();
var input3 = $(":input[@type=password]").serialize();
var sc = input1+"&"+input2+"&"+input3;
$('#ekleniyor5').html('<center><img src="./images/yukleniyor.gif"></center>');
$.ajax({
	type: "POST",
	url: "./inc/sifre_kontrol.php",
	data: sc,
	success: function(msg){
	if (msg=="ok")
		{	
		$('#olumlu_sonuc2').html("<div style='width:85%; background:#bde0b8; border:1px dashed #396c21; padding:5px; font-size: 11px;color: #396c21;font-weight:bold;'>Sifreniz basariyla degistirildi.</div>");
		
		var el1 = document.getElementById(elementid1);
		var el2 = document.getElementById(elementid2);
		var el3 = document.getElementById(elementid3);
		el1.style.display = (el1.style.display =="none") ? "none" : "none";
		el2.style.display = (el2.style.display =="none") ? "none" : "none"; 
		el3.style.display = (el3.style.display =="none") ? "none" : "none"; 
		
		}
	else
		{$('#ekleniyor5').html( msg );}
   }
});
}

function eposta_liste_ekle(){
var input1 = $("#email_list").serialize();
var sc = input1;
$('#ekleniyor').html('<center><img src="./images/yukleniyor.gif"></center>');
$.ajax({
	type: 'POST',
	url: './inc/eposta_liste_kontrol.php',
	data: sc,
	success: function(msg){
	if (msg=="ok")
		{	
		$('#olumlu_sonuc').html("<div style='width:95%; background:#bde0b8; border:1px dashed #396c21; padding:5px; font-size: 11px;color: #396c21;font-weight:bold;'>E-Posta adresiniz listemize eklenmiştir.</div>");
		
		var el1 = document.getElementById(elementid1);
		el1.style.display = (el1.style.display =="none") ? "none" : "none"; 
		
		}
	else
		{$('#ekleniyor').html( msg );}
   }
});
}

$(document).ready(function(){ 

	$("#sepetim div:first").show();
	
	$(".sepete_tasi a img").click(function() {
		var urunidValSplitter 	= (this.id).split("_");
		var urunidVal 			= urunidValSplitter[1];
	
		$("#notificationsLoader").html('<img src="images/yukleniyor.gif" border="0">');
	
		$.ajax({  
		type: "POST",  
		url: "sepet_fonk.php",  
		data: { urunid: urunidVal, islem: "sepeteyolla"},  
		success: function(theResponse) {
			
			if( $("#urunid_" + urunidVal).length > 0){
				$("#urunid_" + urunidVal).animate({ opacity: 0 }, 500, function() {
					$("#urunid_" + urunidVal).before(theResponse).remove();
				});				
				$("#urunid_" + urunidVal).animate({ opacity: 0 }, 500);
				$("#urunid_" + urunidVal).animate({ opacity: 1 }, 500);
				$("#notificationsLoader").empty();			
			} else {
				$("#sepetim div:last").before(theResponse);
				$("#sepetim div:last").hide();
				$("#sepetim div:last").show("slow");  
				$("#notificationsLoader").empty();			
			}
			
				$("#tfiyat").remove();		
				$("#tfiyat").hide();
				$("#tfiyat").show("slow");  
			
		}  
		});  
		
	});
	
	
	
	$("#sepetim div img").live("click", function(event) { 
														
		var urunidValSplitter 	= (this.id).split("_");
		var urunidVal 			= urunidValSplitter[1];	
	
		$("#notificationsLoader").html('<img src="images/yukleniyor.gif" border="0">');
	
		$.ajax({  
		type: "POST",  
		url: "sepet_fonk.php",  
		data: { urunid: urunidVal, islem: "sepettensil"},  
		success: function(theResponse) {
			
			$("#urunid_" + urunidVal).hide("slow",  function() {$(this).remove();});
			$("#notificationsLoader").empty();
				
				$("#tfiyat").hide();
				$("#tfiyat").show("slow"); 
				$("#tfiyat").before(theResponse).remove();
		
		}  
		});  
		
	});

});
