﻿var j;
function tabkaydir(i){
j = i;
var tekrar = window.setInterval('tabkaydirt()',100);
}
function tabkaydirt(){
if(document.getElementById('tabresimler').scrollLeft>((j-1)*672)){
document.getElementById('tabresimler').scrollLeft -= 96;
}
else if(document.getElementById('tabresimler').scrollLeft<((j-1)*672)){
document.getElementById('tabresimler').scrollLeft += 96;
}
else{
window.clearInterval('tekrar');
}
}
var popupStatus = 0;
var bilgi = '';
var makisim;
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(){
	$("#popupContactClose").click(function(){
		disablePopup();
	});
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus==1){
			disablePopup();
		}
	});
});
function kodal(){
jQuery.ajax({
            type: 'POST',
            url: 'rastsayi.php',
            data: 'a=2',
            error:function(){ alert('Bir hata meydana geldi!'); },
            success: function(e) { 
			 $('#rastsayi').html(e);
			 }
            });
}
var girisacik = false, slaytaciklamasi = false;
var girisac, giriskapat;
function a(){
$('#girisformu').height($('#girisformu').height()+3);
if($('#girisformu').height()>150){
window.clearInterval(girisac);
document.getElementById('frm').style.display = 'block';
}
}
function b(){
document.getElementById('frm').style.display = 'none';
$('#girisformu').height($('#girisformu').height()-3);
if($('#girisformu').height()==0){
window.clearInterval(giriskapat);
}
}
function girisiac(){
if(girisacik == false){
window.clearInterval(giriskapat);
girisacik = true;
document.getElementById('girissag1').className='girissag2';
girisac = window.setInterval('a()',1);
}
else{
girisacik = false;
window.clearInterval(girisac);
document.getElementById('girissag1').className='girissag1';
giriskapat = window.setInterval('b()',1);
}
}




function nesneyarat() {
var nesne;
var tarayici = navigator.appName;
if(tarayici == "Microsoft Internet Explorer"){
nesne = new ActiveXObject("Microsoft.XMLHTTP");
}else{
nesne = new XMLHttpRequest();
}
return nesne;
}
var http = nesneyarat();
function sehircagir(){
jQuery.ajax({
            type: 'POST',
            url: 'sehirajax.php',
            data: 'id=' + document.getElementById('ulke').value,
            error:function(){ alert('Bir hata meydana geldi!'); },
            success: function(e) { 
			 $('#sehir').html(e);
			 }
            });
}
function sayikont(){
jQuery.ajax({
            type: 'POST',
            url: 'rastsayikont.php',
            data: 'rastsayi=' + document.getElementById("rastgelesayi").value ,
            error:function(){ alert('Bir hata meydana geldi!'); },
            success: function(e) { 
			if(e == 'tamam'){
			 formkontrol();
			}
			else{
			alert('kodu dogru giriniz!!!');
			}
			 }
            });
}
function formyukle(){
jQuery.ajax({
            type: 'POST',
            url: 'eklentiler/formlar.php',
            data: 'form=1',
            error:function(){ alert('Bir hata meydana geldi!'); },
            success: function(e) { 
			$('#girisformu').html(e);
			}
            });
}
function kayitformuyukle(){
jQuery.ajax({
            type: 'POST',
            url: 'eklentiler/formlar.php',
            data: 'form=2',
            error:function(){ alert('Bir hata meydana geldi!'); },
            success: function(e) { 
			$('#frmm').html(e);
			}
            });
}
function gun(){
document.getElementById('frmm').innerHTML = '<div style="color:#FFFFFF;">Kayit isleminiz Tamamlanmistir.<br>Sisteme Otomatik Giris Gerceklesecektir.<br>Bundan sonraki Ziyaretlerinizde<br>E.Mail Adresinize Yollanmis olan<br>Müsteri ID niz ve sifreniz ile giris yapabilirsiniz<br>Bizi Tercih ettiginiz icin Tesekür ederiz<br>VipMstr Ekibi<br>Not: Email spam olarak algilanmis ola bilir dikatinize.</div>'
}
function gunhata(){
document.getElementById('frmm').innerHTML = '<div style="color:#FFFFFF;">Bu mail sistemimizde kayitli.</div>'
}
function formkontrol(){
if(document.getElementById('ad').value == '' || document.getElementById('soyad').value == '' || document.getElementById('email').value == '' || document.getElementById('ulke').value == '' || document.getElementById('sehir').value == '' || document.getElementById('adres').value == '' || document.getElementById('telefon').value == '' || document.getElementById('cep').value == '' || document.getElementById('cinsiyet').value == '' || document.getElementById('gun').value == '' || document.getElementById('ay').value == '' || document.getElementById('yil').value == ''){
alert('formda bos alanlar var');
}
else{
document.kayitformu.submit();
}
}
function sifregonder(){
 var musteriid = $('#smusteriid').val();
 jQuery.ajax({
            type: 'POST',
            url: 'eklentiler/sifregonder.php',
            data: 'kisim=1&musteriid=' + musteriid,
            error:function(){ alert('Bir hata meydana geldi!'); },
            success: function(e) {
			$('#frm').html(e);
			}
            });
}
