var emailFiltre=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
function hataTemizle() 
{
	return true;
}

window.onerror = hataTemizle;

function getData(sayfa,content,scrl,param)
{
	
	$('#'+content+'').html("<br><br><div align='center'><img src='_images/loading2.gif'></div>");
	
	$.post("_post/_postKonum.php", {rnd:Math.random(),konum:sayfa,param:param});
	$.get("_get/_get"+sayfa+".php?rnd="+Math.random()+param, function(data){$('#'+content+'').html(data);setPiroBox();});

	if (scrl==true)
	{
		$('html, body').animate({scrollTop:0}, 'slow');
	}
	 
	
}

function clearSession()
{
$.post("_post/_postKonumSil.php", {rnd:Math.random()});	
}

function hizmetGoster(id)
{
	
	if ($("#divTitle"+id+"").attr('class')=='hizmetStyle1')
	{
		$("#divTitle"+id+"").attr('class','hizmetStyle');
	}
	else
	{
		$("#divTitle"+id+"").attr('class','hizmetStyle1');
	}
	
	$("#divHizmet"+id+"").slideToggle("slow");

}

function arkaPlanRengiDegistir(renk,obj)
{
	$('#'+obj+'').css("background-color",""+renk+"");
}


function setPiroBox()
{
	$('.piro_overlay,.pirobox_content').remove();
	jQuery().piroBox({
			my_speed: 600, 
			bg_alpha: 0.5,
			radius: 4, 
			scrollImage : false, 
			pirobox_next : 'piro_next',
			pirobox_prev : 'piro_prev',
			close_all : '.piro_close',
			slideShow : 'slideshow', 
			slideSpeed : 4 
	});	
}

function saat()
{	
	var d = new Date();
	var saat=("00"+d.getHours()).substr(("00"+d.getHours()).length-2,2);
	var dakika=("00"+d.getMinutes()).substr(("00"+d.getMinutes()).length-2,2);
	var saniye=("00"+d.getSeconds()).substr(("00"+d.getSeconds()).length-2,2);

	$('#saat').html(saat+":"+dakika+":"+saniye);
	tmrSaat=setTimeout("saat()",1000);
}

function postBizeYazinYayinlayalim(refId)
{
	

	if ($('#txtAdSoyad').attr('value')=='')
	{
		alert('Lütfen ad soyad alanını boş bırakmayınız!');	
		$('#txtAdSoyad').focus();
	}
	else if (!emailFiltre.test($('#txtEmail').attr('value')))
	{
		alert('Lütfen geçerli bir mail adresi belirtiniz!');
		$('#txtEmail').focus();
	}
	else
	{
		$('#btnGonder').attr('disabled','disabled');
		$.post("_post/_postBizeYazinYayinlayalim.php", {rnd:Math.random(),adSoyad:$('#txtAdSoyad').attr('value'),email:$('#txtEmail').attr('value'),telefon:$('#txtTelefon').attr('value'),refId:refId}, function(){$('#btnGonder').attr('disabled','');}, "script");	
	}
}


function postYeniUye(refId)
{
	

	if ($('#txtAdi').attr('value')=='')
	{
		alert('Lütfen ad alanını boş bırakmayınız!');	
		$('#txtAdi').focus();
	}
	else if ($('#txtSoyadi').attr('value')=='')
	{
		alert('Lütfen soyad alanını boş bırakmayınız!');
		$('#txtSoyadi').focus();
	}
	else if (!emailFiltre.test($('#txtEmail').attr('value')))
	{
		alert('Lütfen geçerli bir mail adresi belirtiniz!');
		$('#txtEmail').focus();
	}
	else if ($('#txtDogumTarihi').attr('value')=='')
	{
		alert('Lütfen doğum tarihi alanını boş bırakmayınız!');
		$('#txtDogumTarihi').focus();
	}
	else if ($('#txtMeslek').attr('value')=='')
	{
		alert('Lütfen meslek alanını boş bırakmayınız!');
		$('#txtMeslek').focus();
	}
	else
	{
		$('#btnGonder').attr('disabled','disabled');
		$.post("_post/_postYeniUye.php", {rnd:Math.random(),adi:$('#txtAdi').attr('value'),soyadi:$('#txtSoyadi').attr('value'),email:$('#txtEmail').attr('value'),dogumTarihi:$('#txtDogumTarihi').attr('value'),dogumYeri:$('#txtDogumYeri').attr('value'),meslek:$('#txtMeslek').attr('value'),ilgiAlanlari:$('#txtIlgiAlanlari').attr('value'),refId:refId}, function(){$('#btnGonder').attr('disabled','');}, "script");	
	}
}

function postIletisim()
{
	
	if ($('#txtAdSoyad').attr('value')=='')
	{
		alert('Lütfen ad soyad alanını boş bırakmayınız!');	
		$('#txtAdSoyad').focus();
	}
	else if (!emailFiltre.test($('#txtEmail').attr('value')))
	{
		alert('Lütfen geçerli bir mail adresi belirtiniz!');
		$('#txtEmail').focus();
	}
	else if ($('#txtMesaj').attr('value')=='')
	{
		alert('Lütfen mesaj alanını boş bırakmayınız!');
		$('#txtMesaj').focus();
	}
	else
	{
		$('#btnGonder').attr('disabled','disabled');
		$.post("_post/_postIletisim.php", {rnd:Math.random(),adSoyad:$('#txtAdSoyad').attr('value'),email:$('#txtEmail').attr('value'),telefon:$('#txtTelefon').attr('value'),formMesaj:$('#txtMesaj').attr('value')}, function(){$('#btnGonder').attr('disabled','');}, "script");	
	}
}

function post(postParam,btnName)
{
	$("#"+btnName).attr("disabled","disabled");
	$.post("_post/_postData.php", postParam, function(){$("#"+btnName).attr("disabled","");}, "script");	
}

function yaziBoyutu(alan,buyuk)
{
	var boyutPx=""+$('#'+alan).css('fontSize')+"";
	var lhPx=""+$('#'+alan).css('lineHeight')+"";
	var boyut=boyutPx.split("px");
	var lh=lhPx.split("px");
	boyut[0]=boyut[0]*1;
	lh[0]=lh[0]*1;
	if (buyuk==true)
	{
		if (boyut[0]<20)
		{
			boyut[0]=boyut[0]+1;
			lh[0]=lh[0]+1;
		}
	}
	else
	{
		if (boyut[0]>10)
		{
			boyut[0]=boyut[0]-1;
			lh[0]=lh[0]-1;
		}
	}
	$("#"+alan).css("font-size",boyut[0]+"px");
	$("#"+alan).css("line-height",lh[0]+"px");
}




