﻿function ajaxGonder(nesne,urlx,datax){var loader=jQuery('<div id="loader"><img src="images/ajax-loader.gif" alt="Bekleyiniz..." /></div>').css({position:"relative",top:"1em",left:"25em",display:'block'}).appendTo("body").hide();jQuery().ajaxStart(function(){loader.show();}).ajaxStop(function(){loader.hide();}).ajaxError(function(a,b,e){throw e;});$.ajax({type:'POST',url:urlx,dataType:"html",async:false,contentType:"application/x-www-form-urlencoded;charset=UTF-8",data:datax,success:function(ajaxCevap,status){$(nesne).html(ajaxCevap);$("div#loader").remove();}});}
function ajaxFormGonder(urlx,datax,hedef){var loader=jQuery('<div id="loader"><img src="images/loading.gif" alt="Bekleyiniz..." /></div>').css({position:"relative",top:"1em",left:"25em",display:'block'}).appendTo("body").hide();jQuery().ajaxStart(function(){loader.show();}).ajaxStop(function(){loader.hide();}).ajaxError(function(a,b,e){throw e;});$.ajax({type:"POST",cache:false,url:urlx,data:datax,dataType:"html",async:false,contentType:"application/x-www-form-urlencoded;charset=UTF-8",success:function(data){$(hedef).html(data);console.log(data);}});}
function ajax(sayfa,datax,success){$.ajax({type:"POST",cache:false,url:sayfa,data:datax,success:function(data){$.fancybox(data);}});}

function ajax2(urlx,datax){
	var loader = jQuery('<div id="loader"><img src="/images/loading.gif" alt="Bekleyiniz..." />Yükleniyor...</div>').appendTo("body").hide();
	var html = $.ajax({
		type: 'POST',
		url: urlx,
		dataType: "html",
		contentType: "application/x-www-form-urlencoded;charset=UTF-8",
		data: datax,
		async:false
	}).responseText;
	
	$(loader).bind("ajaxStart", function(){
		loader.show();
	}).bind("ajaxStop", function(){
		loader.hide();
	});
	return html;
}

function gizliAjax(nesne,urlx,datax,sGoster){$(nesne).ajaxStart(function(){if(sGoster==1)
$(this).html('Yükleniyor, bekleyiniz.');});$.ajax({type:'POST',url:urlx,dataType:"html",contentType:"application/x-www-form-urlencoded;charset=UTF-8",data:datax,success:function(ajaxCevap,status){if(sGoster==1)
$(nesne).html(ajaxCevap);}});}
function addslashes(str){str=str.replace(/\\/g,'\\\\');str=str.replace(/\'/g,'\\\'');str=str.replace(/\"/g,'\\"');str=str.replace(/\0/g,'\\0');return str;}
function stripslashes(str){str=str.replace(/\\'/g,'\'');str=str.replace(/\\"/g,'"');str=str.replace(/\\0/g,'\0');str=str.replace(/\\\\/g,'\\');return str;}
function onayla(msj)
{cvp=confirm(msj);if(cvp)
return true;else
return false;}
function tumunuIsaretle(nesne,obj){if($("input[name="+obj+"]").is(":checked"))
$(nesne).each(function(index){this.checked=true;});else
$(nesne).each(function(index){this.checked=false;});}
$(function(){var $placeholder=$('input[placeholder]');if($placeholder.length>0){var attrPh=$placeholder.attr('placeholder');$placeholder.attr('value',attrPh).bind('focus',function(){var $this=$(this);if($this.val()===attrPh)
$this.val('').css('color','#171207');}).bind('blur',function(){var $this=$(this);if($this.val()==='')
$this.val(attrPh).css('color','#333');});}});
