function Ajax(p1,p2)
{
	$("#loading").ajaxStart(function(){ $(this).html('<img src="images/pembe.gif" alt="loading" />'); });
	$("#loading").ajaxSuccess(function(){ $(this).html(''); });
	//$.ajax({ type: 'GET', url: p1, cache: false, data: 'veri='+p1, success: function(sonuc) { $('#'+p2).html(sonuc); } });
	$.ajax({ type: 'GET', url: p1, cache: false, success: function(sonuc) { $('#'+p2).html(sonuc); } });
}
function FastX(p1,p2)
{
	//$.ajax({ type: 'GET', url: p1, cache: false, data: 'veri='+p1, success: function(sonuc) { $('#'+p2).html(sonuc); }         });
	$.ajax({ type: 'GET', url: p1, cache: false, success: function(sonuc) { $('#'+p2).html(sonuc); } });
}
function FormAjax(p1,p2)
{
	//$("#"+p2).ajaxStart(function(){ $(this).html('<img src=images/pembe.gif />'); });
	$("#loading").ajaxStart(function(){ $(this).html('<img src="/images/pembe.gif" alt="loading" />'); });
	$("#loading").ajaxSuccess(function(){ $(this).html(''); });
	$.ajax({ type: 'POST', url: p1, data: $('form').serialize(), success: function(sonuc) { $('#'+p2).html(sonuc); } });
}
function SorguAjax(p1,p2)
{
	$("#"+p2).ajaxStart(function(){ $(this).html('<img src="/images/ariyor_1.gif" align="center" alt="loading" />'); });
	$.ajax({ type: 'POST', url: p1, data: $('form').serialize(), success: function(sonuc) { $('#'+p2).html(sonuc); } });
}

var popupStatus = 0;
function loadPopup(){
	if(popupStatus==0){
		$("#backgroundPopup").css({ "opacity": "0.7" });
		$("#backgroundPopup").fadeIn("slow");
		$("#popupContact").fadeIn("slow");
		popupStatus = 1;
	}
}
function disablePopup(){
	if(popupStatus==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupContact").fadeOut("slow");
		popupStatus = 0;
	}
}
function centerPopup(){
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popupContact").height();
	var popupWidth = $("#popupContact").width();
	$("#popupContact").css({ "position": "absolute", "top": windowHeight/2-popupHeight/2, "left": windowWidth/2-popupWidth/2	});
	$("#backgroundPopup").css({ "height": windowHeight	});
}
$(document).ready(function(){
	$("#button").click(function(){ centerPopup(); loadPopup();	});
	$("#popupContactClose").click(function(){ disablePopup();	});
	$("#backgroundPopup").click(function(){ disablePopup();	});
	$(document).keypress(function(e){ if(e.keyCode==27 && popupStatus==1){ disablePopup(); } });
});
function karakter_sayi_kontrol(alan,sayac,karaktersayisi)
{
	if (alan.value.length > karaktersayisi)	{ alan.value = alan.value.substring(0, karaktersayisi); alert('karakter sayısını aştınız !'); }
  	else { sayac.value = karaktersayisi - alan.value.length; }
}
