function kullanicikontrol(kullanici) {
	if (kullanici==""){ yaz("kullanicisonuc","");return true };
	yaz('kullanicisonuc','<span style="color:#999">Checking...</span>');
	new Ajax.Request('/ajax.asp', {
	method: 'post',
	parameters: { sayfa:'uyelik', 'kontrolun': escape(kullanici)},
	onSuccess: function(transport) {
		unchk = transport.responseText.evalJSON();
		if(unchk.gecerli==false){
			yaz('kullanicisonuc','<span style="color:#990000"><strong>error:</strong> '+unchk.sebep+'</span>');
		}else{
			yaz('kullanicisonuc','<span style="color:green;">Username you entered ('+unchk.un+') available</span>');
			$("kullanici").value = unchk.un;
		}
	}});
};


function ulkesecti() {
}

function sehirsecti() {
}

function semtsecti() {
}

function okulsecti(turid) {
if(turid!=''){
new Ajax.Updater('okulbolumu', 'okulajax.asp', {   parameters: { tur: turid} }); 
}
};

function sifrekontrol(sifre) {

for (x in basitsifreler)
{
	if(basitsifreler[x] == sifre){
		yaz("sifresonuc","The password is so simple")
	}
}
return true;
}

function uyelikinit(){
}
function resimupload_s(){
	$("load_resimup").style.display = "inline";
	$("resimyolla").disabled = true;
}
function crop_ok(){
	$("croptuslar").style.display = "none";
	new Ajax.Request('/ajax.asp', { method: 'post',parameters: { sayfa:'resim', islem:'cropok', 'x1': xx1 , 'x2': xx2, 'y1': yy1, 'y2':yy2  }, onSuccess: function(t) {
	if(Left(t.responseText,2)=="OK"){
		var vals = t.responseText.substr(3).split('|');
		$("resimupfln").style.display = "block";
		$("ileri").style.display = "block";
		$("resimcrop").style.display = "none";
		$("rbk1").style.display = "block";
		$("rbk2").style.display = "none";
		resimupload_y(vals[0],vals[1]);
	}else{
		LifetyHata.goster('of');
	}
	}});
}
function crop_iptal(){
	$("croptuslar").style.display = "none";
	
	new Ajax.Request('/ajax.asp', { method: 'post',parameters: { sayfa:'resim', islem:'cropiptal', 'kat' : '0', 'x1': xx1 , 'x2': xx2, 'y1': yy1, 'y2':yy2  }, onSuccess: function(t) {
		$("resimupfln").style.display = "block";
		$("ileri").style.display = "block";
		$("resimcrop").style.display = "none";
		$("rbk1").style.display = "block";
		$("rbk2").style.display = "none";
	}});
}

function resimupload_c(response){
	$("resimyolla").disabled = false;
	$("load_resimup").style.display = "none";
	var resimisim;
	if(Left(response,4)=="HATA"){
		LifetyHata.goster("<strong>Error!</strong>" + response.substr(5));
		return false;
	}else if(Left(response,2)=="OK"){
		resimisim = response.substr(3);
	}else{
		LifetyHata.goster("<strong>Error!</strong>Refresh the page.");
		return false;
	}
	$("resimupfln").style.display = "none";
	$("ileri").style.display = "none";
	$("resimcrop").style.display = "block";
	$("croptuslar").style.display = "block";
	$("rbk2").style.display = "block";
	$("rbk1").style.display = "none";
		
	var vals = resimisim.split('|');
	CropImageManager.resetCropper();
	CropImageManager.setImage( 'UYERESIMLERI/TEMP/' + vals[0] + '.JPG', vals[1], vals[2] );
}
function resimupload_y(adresibik,sonresimid){
	$("resimdosya").value = "";
	resimyaz(adresibik,sonresimid);
	resimupload_iptal();
}
function resimupload_iptal(){
	$("resimdosya").disabled = false;
	$("resimyolla").disabled = false;
}
var uppedresim = 0;
function resimyaz(resimadresi,sonresimid){
	uppedresim++;
	$("ilerihabercisiyok").style.display = "none";
	$("ilerihabercisi").style.display = "block";
	$("ileri").style.display = "block";
	$("yuklenenresimler").style.display = "block";
	$("yuklbaslik").innerHTML = "Uploaded Photos ("+uppedresim+"):";
	new Insertion.Bottom('yuklenenresimler','<div id="rsm'+sonresimid+'" class="uppedresim"><img src="/UYERESIMLERI/BuyukVersion/'+resimadresi+'_kucuk.JPG" alt="" /></div>');
	//new Effect.Appear($("rsm"+sonresimid));
}
function hatali(el,hata){
	$(el).style.border = "1px solid red";
	new Insertion.After($(el).parentNode,'<div id="hatadivof'+el+'" class="hatadiv">'+hata+'</div>');
}
function hatasiz(el){
	$(el).style.border = "1px solid #C1C1C1";
	if($('hatadivof'+el)!=null){
	$('hatadivof'+el).remove();
	}
}
function mailchk(){
	$("mailaciklama").innerHTML = "Please wait.";
	new Ajax.Request('/ajax.asp', { method: 'post',parameters: { sayfa:'uyelik', olay:'mailchk', mail:$F("mail") }, onSuccess: function(t) {
	if(t.responseText=="OK"){
		$("mailaciklama").innerHTML = "<span style=\"color:green\">Accepted.</span>";
	}else{
		$("mailaciklama").innerHTML = "<span style=\"color:#990000\">Invalid or existing mail.</span>";
	}
	}});
}

function burccikart(){
var g_ay,g_gun,sonuc
g_ay = $F("ay")
g_gun = $F("gun")
if (g_ay == 1 && g_gun >=20 || g_ay == 2 && g_gun <=18) {sonuc = "Aquarius";}
if (g_ay == 1 && g_gun > 31) {sonuc = "hmm.";}
if (g_ay == 2 && g_gun >=19 || g_ay == 3 && g_gun <=20) {sonuc = "Pisces";}
if (g_ay == 2 && g_gun > 29) {sonuc = "hmm.";}
if (g_ay == 3 && g_gun >=21 || g_ay == 4 && g_gun <=19) {sonuc = "Aries";}
if (g_ay == 3 && g_gun > 31) {sonuc = "hmm.";}
if (g_ay == 4 && g_gun >=20 || g_ay == 5 && g_gun <=20) {sonuc = "Taurus";}
if (g_ay == 4 && g_gun > 30) {sonuc = "hmm.";}
if (g_ay == 5 && g_gun >=21 || g_ay == 6 && g_gun <=21) {sonuc = "Gemini";}
if (g_ay == 5 && g_gun > 31) {sonuc = "hmm.";}
if (g_ay == 6 && g_gun >=22 || g_ay == 7 && g_gun <=22) {sonuc = "Cancer";}
if (g_ay == 6 && g_gun > 30) {sonuc = "hmm.";}
if (g_ay == 7 && g_gun >=23 || g_ay == 8 && g_gun <=22) {sonuc = "Leo";}
if (g_ay == 7 && g_gun > 31) {sonuc = "hmm.";}
if (g_ay == 8 && g_gun >=23 || g_ay == 9 && g_gun <=22) {sonuc = "Virgo";}
if (g_ay == 8 && g_gun > 31) {sonuc = "hmm.";}
if (g_ay == 9 && g_gun >=23 || g_ay == 10 && g_gun <=22) {sonuc = "Libra";}
if (g_ay == 9 && g_gun > 30) {sonuc = "hmm.";}
if (g_ay == 10 && g_gun >=23 || g_ay == 11 && g_gun <=21) {sonuc = "Scorpio";}
if (g_ay == 10 && g_gun > 31) {sonuc = "hmm.";}
if (g_ay == 11 && g_gun >=22 || g_ay == 12 && g_gun <=21) {sonuc = "Sagittarius";}
if (g_ay == 11 && g_gun > 30) {sonuc = "hmm.";}
if (g_ay == 12 && g_gun >=22 || g_ay == 1 && g_gun <=19) {sonuc = "Capricorn";}
if (g_ay == 12 && g_gun > 31) {sonuc = "hmm.";}
if(sonuc){
$("dtarihacikalama").innerHTML = "Zodiac: " + sonuc;
if(sonuc=="hmm.") $("dtarihacikalama").innerHTML = "<span style=\"color:#990000\">invalid date format.</span>"
}
}

var CropImageManager = {
	curCrop: null,
	init: function() {
		this.attachCropper();
	},
	setImage: function( imgSrc, w, h ) {
		$( 'testImage' ).src = imgSrc;
		$( 'testImage' ).width = w;
		$( 'testImage' ).height = h;
		if($('imgCrop_testImage')){
			$('imgCrop_testImage').src = imgSrc;
			$('imgCrop_testImage').width = w;
			$('imgCrop_testImage').height = h;
		}
		this.attachCropper();
	},
	attachCropper: function() {
		if( this.curCrop == null ) {
			$("ornekbolumu").innerHTML = "";
			this.curCrop = new Cropper.ImgWithPreview('testImage', { minWidth: 73, minHeight: 73, ratioDim: { x: 100, y: 100 }, displayOnInit: false, onEndCrop: cropBitti, previewWrap: 'ornekbolumu' } )
		}
		else this.curCrop.reset();
	},
	removeCropper: function() {
		if( this.curCrop != null ) {
			this.curCrop.remove();
		}
	},
	resetCropper: function() {
		this.attachCropper();
	}
};