function makeHttpRequest(url, callback_function, return_xml,sayfala,post_)
{
    var http_request = false;

    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
        }
    } else if (window.ActiveXObject) { // IE
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }

    if (!http_request) {
        alert('Unfortunatelly you browser doesn\'t support this feature.');
        return false;
    }
    http_request.onreadystatechange = function() {
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                if (return_xml) {
					
                    eval(callback_function + '(http_request.responseXML,\''+sayfala+'\')');
                } else {
                    eval(callback_function + '(http_request.responseText,\''+sayfala+'\')');
                }
            } else {
                alert('There was a problem with the request.(Code: ' + http_request.status + ')');
            }
        }
    }
	if(!post_){

    http_request.open('GET', url, true);
	}else{
		http_request.open('POST', url, true);
	
	}
	 http_request.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
	 http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-9"');
	if(!post_){
    http_request.send(null);
	}else{
	
	http_request.send(post_);
	}
}






function fele(deg) {
	var dg = eval("document.getElementById? document.getElementById('"+deg+"') : document.all."+deg);
	return dg;
}
function h_bas() {
	var dg = fele("hatirla");
	if(dg.checked){dg.checked = false;}
	else {dg.checked = true;}
}
function y_sgkr() {
	var dg = fele("sgkr");
	dg.src = "resim_y.php?sgr="+Math.random();
		this.nesneler['g_kod'].kontrol=false;
		this.nesneler['g_kod'].value='';
		document.getElementById('g_kod').value="";
		document.getElementById('g_kod_div').innerHTML='' ; 
}


this.nesneler= new Object();
var alanlar=new Array("kullanici_adi","sifre1","sifre2","email","isim","soyisim","d_g_tarih1","d_g_tarih2","d_g_tarih3","ulke","il","cinsi","mezun_o","meslek","sektor","referans","g_kod","siteden_haber");
this.nesneler["as"]=new Object();
this.nesneler["as"]["a"]="asd";

function deneme(){
	for(var i=0; i<alanlar.length; i++){
		this.nesneler[alanlar[i]]=new Object();
		this.nesneler[alanlar[i]].value="";
		this.nesneler[alanlar[i]].kontrol=false;
	}
	this.nesneler["kullanici_adi"].uyari="Kullanıcı adında hata var";
	this.nesneler["sifre1"].uyari="Şifre alanında hata var.";
	this.nesneler["sifre2"].uyari="Şifre onayı alanında hata var.";
	this.nesneler["email"].uyari="E-mail  adresinde hata var ";
	this.nesneler["isim"].uyari="isim alanında hata var";
	this.nesneler["soyisim"].uyari="Soyisim alanında hata var";
	this.nesneler["d_g_tarih1"].uyari="Doğum  tarihinde gün alanında hata var";
		this.nesneler["d_g_tarih2"].uyari="Doğum  tarihinde ay alanında hata var";
		this.nesneler["d_g_tarih3"].uyari="Doğum  tarihinde yıl alanında hata var";
		this.nesneler["ulke"].uyari="Ülke alanında hata var";
		this.nesneler["il"].uyari="il alanında hata var";
		this.nesneler["cinsi"].uyari="Cinsiyet alanını boş bıraktınız";
		this.nesneler["mezun_o"].uyari="Mezuniyet durumu alanında hata var";
		this.nesneler["meslek"].uyari="Meslek alanında hata var";
		this.nesneler["sektor"].uyari="Sektör alanında hata var";
			this.nesneler["g_kod"].uyari="Güvenlik kodu alanınında hata var";

	this.nesneler['siteden_haber'].kontrol=true;
	this.nesneler['siteden_haber'].value="1";
	this.nesneler['referans'].kontrol=true;
		this.nesneler['referans'].value="0";
	var referer=readCookie('refererid');
	
	if(typeof referer!=='undefined'){ 
	this.nesneler['referans'].value=readCookie('refererid');
	document.getElementById('referans').value=readCookie('referername');
	document.getElementById('referans').readOnly=true;
	
	}
	
	
	}
	
	
	function readCookie(name){ // by .fm 
    var c=document.cookie ;  
    if (c.indexOf(name)!=-1) {  
        pos1=c.indexOf("=", c.indexOf(name))+1;  
        pos2=c.indexOf(";",pos1);   
            // If last cookie 
            if(pos2==-1)    pos2=c.length;; 
         
        data=c.substring(pos1,pos2);  
         
        return data; 
    } 
}  

var suanki_f="";
var eski_f="";
function kontrol1(mod,id,durum){
if(!mod){
	css('over',id);
	suanki_f=id;

document.getElementById(''+id+'_div').innerHTML="";
}else{
	css('out',id);
	eski_f=id;
if(id=='kullanici_adi') kullanici_adi('',id);
if(id=='sifre1') sifre1(id);
if(id=='sifre2') sifre2(id);	
if(id=='email') email('',id);	
if(id=='isim') isimsoy(id);	
if(id=='soyisim') isimsoy(id);
if(id=='d_g_tarih1') selecti(id);
if(id=='d_g_tarih2') selecti(id);
if(id=='d_g_tarih3') yil_f(id);
if(id=='ulke') memleket(id);
if(id=='il') selecti(id);
if(id=='mezun_o') selecti(id);
if(id=='meslek') selecti(id);
if(id=='sektor') selecti(id);
if(id=='cinsi') cinsi(id,durum);
if(id=='g_kod') g_kod('',id);
	}
	
}
function kullanici_adi(veri,id){
if(!veri){	
if(document.getElementById(id).value.length>2 && document.getElementById(id).value!=this.nesneler[id].value){
	islem=true
the_url = 'kayit.php?kullanici_adi_k='+document.getElementById(id).value+'';
makeHttpRequest(the_url, 'kullanici_adi',false,id);
this.nesneler[id].value=document.getElementById(id).value;
}
if(document.getElementById(id).value.length<3){

	this.nesneler[id].uyari="En az 3 karakter olmalı";
	this.nesneler[id].kontrol=false;
}
}
else{ 
islem=false
if(veri=='ok'){
this.nesneler[id].kontrol=true;
document.getElementById(id).style.backgroundColor= "#CCF7B0";

}else {

	
this.nesneler[id].kontrol=false;
this.nesneler[id].uyari=veri;
document.getElementById(''+id+'_div').innerHTML=''+gecilemedi+''+veri+'' ; }
}
if(this.nesneler[id].kontrol && !islem){document.getElementById(id).style.backgroundColor="#CCF7B0"; }
if(!this.nesneler[id].kontrol && !islem){ 

document.getElementById(''+id+'_div').innerHTML=''+gecilemedi+''+this.nesneler[id].uyari+'';  }
	
}

function sifre1(id){
	if(document.getElementById(id).value.length>4){
		if(this.nesneler[id].value!=document.getElementById(id).value){
		this.nesneler[id].value=document.getElementById(id).value;
		this.nesneler[id].kontrol=true; 
		document.getElementById('sifre2').value=""
		document.getElementById('sifre2_div').innerHTML=""
				this.nesneler['sifre2'].kontrol=false; }
document.getElementById(id).style.backgroundColor= "#CCF7B0";
	}else{document.getElementById(''+id+'_div').innerHTML=''+gecilemedi+'Şifre uzunluğu yetersiz'; this.nesneler[id].kontrol=false; }
	
	
}
function sifre2(id){
	if(document.getElementById(id).value.length>4 && document.getElementById(id).value==document.getElementById('sifre1').value){
	document.getElementById(id).style.backgroundColor= "#CCF7B0";
		this.nesneler[id].kontrol=true; 
	}else{document.getElementById(''+id+'_div').innerHTML=''+gecilemedi+'Tekrar edilen şifre yanlış'; this.nesneler[id].kontrol=false; }
}


function email(veri,id){
if(!veri){
var str=document.getElementById(id).value
var filtrele=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filtrele.test(str)){
	if(this.nesneler[id].value!=str){
		islem=true
the_url = 'kayit.php?email='+str+'';
makeHttpRequest(the_url, 'email',false,id);
	this.nesneler[id].value=str;}
}else{
	this.nesneler[id].value=document.getElementById(id).value;
	this.nesneler[id].uyari='Yazılan mail adresi hatalı';
	this.nesneler[id].kontrol=false;
	document.getElementById(''+id+'_div').innerHTML=''+gecilemedi+''+this.nesneler[id].uyari+'';  }
}else{
		islem=false
	if(veri=='ok'){
	
this.nesneler[id].kontrol=true;
document.getElementById(id).style.backgroundColor= "#CCF7B0";	

}else {

this.nesneler[id].kontrol=false;
this.nesneler[id].uyari=veri;
document.getElementById(''+id+'_div').innerHTML=''+gecilemedi+''+veri+'' ; }

}


if(this.nesneler[id].kontrol && !islem){document.getElementById(id).style.backgroundColor= "#CCF7B0";}
if(!this.nesneler[id].kontrol && !islem){document.getElementById(''+id+'_div').innerHTML=''+gecilemedi+''+this.nesneler[id].uyari+''; }
	
}



function isimsoy(id){
	if(document.getElementById(id).value){
	document.getElementById(id).style.backgroundColor= "#CCF7B0";
		this.nesneler[id].value=document.getElementById(id).value;
		this.nesneler[id].kontrol=true
	}else{
this.nesneler[id].kontrol=false;
this.nesneler[id].uyari="Lütfen bos geçmeyiniz";
document.getElementById(''+id+'_div').innerHTML=''+gecilemedi+''+this.nesneler[id].uyari+'' ; }
	
}


function css(eylem, deg) 
{
renk_1 = '#f0fde2';
renk_1_rgb = 'rgb(240, 253, 226)';
renk_2 = '#fcffec';
renk_2_rgb = 'rgb(252, 255, 236)';
renk_3 = '#ffffff';
yol = eval("document.getElementById('"+deg+"')");
if(eylem=='over'){if(yol.style.backgroundColor!=renk_2_rgb && yol.style.backgroundColor!=renk_2){yol.style.backgroundColor = renk_1;}}
if(eylem=='focus'){yol.style.backgroundColor = renk_2;}
if(eylem=='blur'){yol.style.backgroundColor = renk_3;}
if(eylem=='out'){if(yol.style.backgroundColor==renk_1_rgb || yol.style.backgroundColor==renk_1){yol.style.backgroundColor = renk_3;}}

}


function selecti(id){
	
var sec  =document.getElementById(id);
var secilen=sec.options[sec.selectedIndex].value;
var secilenx=sec.options[sec.selectedIndex];
if(secilen!=='0'){
sec.style.backgroundColor= "#CCF7B0";
//document.getElementById(''+id+'_div').innerHTML=gecildi;	
this.nesneler[id].kontrol=true
if(id=='il'){this.nesneler['ulke'].kontrol=true
this.nesneler['ulke'].value="0";
	 }
}else{ 
if(id=='d_g_tarih1' || id=='d_g_tarih2' ){
	this.nesneler[id].uyari='Doğum Tarihi yanlış örnek:1982'
	document.getElementById('d_g_tarih3_div').innerHTML=''+this.nesneler[id].uyari+'' ;
	sec.style.backgroundColor= "#C00";
}else{
sec.style.backgroundColor= "#C00";

}
		this.nesneler[id].kontrol=false                      }
		this.nesneler[id].value=secilen;
}



function yil_f(id){
if(document.getElementById(id).value.length>3){
	this.nesneler[id].kontrol=true
document.getElementById(id).style.backgroundColor= "#CCF7B0";
}else{
		this.nesneler[id].kontrol=false
	this.nesneler[id].uyari='Doğum Tarihi yanlış örnek:1982'
	document.getElementById(''+id+'_div').innerHTML=''+this.nesneler[id].uyari+'' ;
document.getElementById(id).style.backgroundColor= "#C00";
	}


this.nesneler[id].value=document.getElementById(id).value;
}

function memleket(id){
var sec  =document.getElementById(id);
var secilen=sec.options[sec.selectedIndex].value;
if(secilen=='0'){ 
ac('il_a');
ac('il_s');
}else{ kapat('il_a');
kapat('il_s');
this.nesneler['il'].kontrol=true
this.nesneler['il'].value="secilmedi";
sec.style.backgroundColor= "#C00";
}
this.nesneler[id].kontrol=true
this.nesneler[id].value=secilen;
sec.style.backgroundColor= "#CCF7B0";
	
}

function cinsi(id,durum){
document.getElementById(id).style.backgroundColor= "#CCF7B0";	
this.nesneler[id].kontrol=true
this.nesneler[id].value=durum;
}



function kapat(id){ 

document.getElementById(id).style.display="none";}
function ac(id){document.getElementById(id).style.display="";   }

function siteden_haber(){
	if(document.getElementById('siteden_haber').checked){
		this.nesneler['siteden_haber'].value="1";
	}else{this.nesneler['siteden_haber'].value="0"; }
	

}

function referans(){
	this.nesneler['referans'].value=document.getElementById('referans').value;
}

function g_kod(veri,id){
	

	if(!veri){	
if(document.getElementById(id).value.length=6 && document.getElementById(id).value!=this.nesneler[id].value){
islem=true;
the_url = 'kayit.php?g_code='+document.getElementById(id).value+'';
makeHttpRequest(the_url, 'g_kod',false,id);
this.nesneler[id].value=document.getElementById(id).value;

}
if(document.getElementById(id).value.length<6){

	this.nesneler[id].uyari="Güvenlik kodu yanlis";
	this.nesneler[id].kontrol=false;
}
}
else{ 

if(veri=='ok'){
this.nesneler[id].kontrol=true;
document.getElementById(id).style.backgroundColor= "#CCF7B0";		
}else {
this.nesneler[id].kontrol=false;
this.nesneler[id].uyari=veri;
document.getElementById(''+id+'_div').innerHTML=''+gecilemedi+''+veri+'' ; }

islem=false;
}
if(this.nesneler[id].kontrol && !islem){document.getElementById(id).style.backgroundColor= "#CCF7B0";	  }
if(!this.nesneler[id].kontrol && !islem){document.getElementById(''+id+'_div').innerHTML=''+gecilemedi+''+this.nesneler[id].uyari+''; }
	

}



function kontrolbitis(){
if(!islem){
	if(typeof verias!=='undefined'){
clearTimeout(verias);
	}
	
	var hata=0;
//uyari("1.Kontroller yapiliyor lütfen bekleyiniz..")
document.getElementById('hata_ic').innerHTML="";
for(var i=0; i<alanlar.length; i++){

if(this.nesneler[alanlar[i]].kontrol==false){

	document.getElementById('hata_ic').innerHTML+='<li>'+gecilemedi+''+this.nesneler[alanlar[i]].uyari+'</li>' ; 
	hata++;
}}	
	
if(!hata){
kapat('hatalar'); 	

	//uyari("Veriler gönderiliyor");	
the_url = './kayit.php?kullanici_adi_='+this.nesneler['kullanici_adi'].value+'&sifre1_='+this.nesneler['sifre1'].value+'&email_='+this.nesneler['email'].value+'&isim_='+this.nesneler['isim'].value+'&soyisim_='+this.nesneler['soyisim'].value+'&d_g_tarih1_='+this.nesneler['d_g_tarih1'].value+'&d_g_tarih2_='+this.nesneler['d_g_tarih2'].value+'&d_g_tarih3_='+this.nesneler['d_g_tarih3'].value+'&ulke_='+this.nesneler['ulke'].value+'&il_='+this.nesneler['il'].value+'&cinsi_='+this.nesneler['cinsi'].value+'&mezun_o_='+this.nesneler['mezun_o'].value+'&meslek_='+this.nesneler['meslek'].value+'&sektor_='+this.nesneler['sektor'].value+'&referans_='+this.nesneler['referans'].value+'&g_kod_='+this.nesneler['g_kod'].value+'&siteden_haber_='+this.nesneler['siteden_haber'].value+'&bitis=1';
makeHttpRequest(the_url, 'bitiss',false,false);


}else{ 
ac('hatalar'); 

}
}else{ uyari("2.Kontroller yapiliyor lütfen bekleyiniz..");
	
	verias=setTimeout("kontrolbitis()",1000); }
	
	}
	
	
	
	

	

var islem=false;
var gecildi='<img src="images/ok.gif" width="15" height="15" align="top">';
var gecilemedi='<img src="images/false.gif" width="15" height="15" >';


function bitiss(veri){
alert(veri)
if(veri=='ok'){
kapat('uye_giris');
ac('bitti_f');

} 
else if(veri=='ok1'){ 
kapat('uye_giris');
ac('bitti_f2');
kapat('mem');
document.getElementById('header').innerHTML+='<div style="float:right; color:white; width:220px; margin-right:10px; font-size:12px; height:16px; " ><a href="./out.php" style="background:url(./images/signup_bg.gif) 0 0 no-repeat; width:47px; height:16px; display:block; float:right; "></a> <p style="float:right; padding-right:4px;">Hoşgeldin <strong>'+this.nesneler['kullanici_adi'].value+'</strong><p> </div>' ;
}

else{ }


}






var kapan_y=true;

function uyari_k(id){
if(kapan_y){ kapat(id)};

}

function ac_kapa(mod){
for(var i=1; i<8; i++){
		
	}
	}
function uyari(title){

ac_kapa(true);
ac('berxcvb');
document.getElementById('asd').width=pageWidth();
document.getElementById('asd').height=document.body.scrollHeight;
document.getElementById('uyari_xcv').innerHTML=title;
 document.getElementById('asd').style.zIndex=100;

document.getElementById('containers3').style.zIndex=100;


}

function pageWidth() {return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?       document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;}

 function pageHeight() {return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;}
 

