function videoPuanGoster(iPuan, iVideoID)
{
	for(i=1;i<=5;i++)
	{
		if (parseInt(iPuan) >= i)
		{document.getElementById("videoPuan" + i).className = "yildizKirmizi";}
		else
		{document.getElementById("videoPuan" + i).className = "yildizBos";}
	}
}

function LabelRenk(lbl, renk)
{
	document.getElementById(lbl).style.color = renk;
}

function _yonlendir(sURL)
{
	if (sURL.indexOf("http://") != -1)
	{
		window.open(sURL, "", "");
	}
	else
	{
		window.location.href = sURL;
	}
}

function ajaxKarakter(sForm)
{
	sForm = sForm.replace(/ /g, "[bosluk]");
	sForm = sForm.replace(/\n/g, "[altsatir]");
	return sForm;
}

function _iletisim()
{
	document.getElementById("iletisimMsg").style.display = "block";document.getElementById("iletisimMsg").innerHTML = "";
	if (document.getElementById("Konu").value == "") {document.getElementById("iletisimMsg").innerHTML = "Konu seçiniz !";document.getElementById("Konu").focus();return false;}
	if (document.getElementById("AdFirma").value == "Adınız veya Firma adınız") {document.getElementById("AdFirma").value = "";}
	if (document.getElementById("AdFirma").value == "") {document.getElementById("iletisimMsg").innerHTML = "Ad/Firma giriniz !";document.getElementById("AdFirma").focus();return false;}
	if (document.getElementById("IletisimEmail").value == "E-Posta adresiniz") {document.getElementById("IletisimEmail").value = "";}
	if (! isValidEmail(document.getElementById("IletisimEmail").value)) {document.getElementById("iletisimMsg").innerHTML = "Geçersiz email girdiniz!";document.getElementById("IletisimEmail").focus();return false;}
	if (document.getElementById("Mesaj").value == "Bize her konuda yazın! İstek, şikayet, sunuculuk, program yapmak, ekibe katılmak, haber olmak, reklam vermek vs... Ücretsiz haber olmak, sunucu olmak veya program yapmak için lütfen referans videonuzun adresini bize yollayın! İzleyelim! Değerlendirelim! Ünlü olun!") {document.getElementById("Mesaj").value = "";}
	if (document.getElementById("Mesaj").value == "") {document.getElementById("iletisimMsg").innerHTML = "Mesaj giriniz !";document.getElementById("Mesaj").focus();return false;}
	if (document.getElementById("VideoAdres").value == "Video adresinizi de ekleyin! (örn: Youtube video adresi)") {document.getElementById("VideoAdres").value = "";}
	
	sForm = "Konu=" + ajaxKarakter(document.getElementById("Konu").value);
	sForm += "&AdFirma=" + ajaxKarakter(document.getElementById("AdFirma").value);
	sForm += "&Email=" + ajaxKarakter(document.getElementById("IletisimEmail").value);
	sForm += "&VideoAdres=" + ajaxKarakter(document.getElementById("VideoAdres").value);
	sForm += "&Mesaj=" + ajaxKarakter(document.getElementById("Mesaj").value);

	document.getElementById("iletisimMsg").innerHTML = "<img id=\"imgIndicator\" src=\"images/icon/indicator.gif\" />";
	if (window.XMLHttpRequest) {XmlHttp=new XMLHttpRequest();} else if (window.ActiveXObject) {XmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
	XmlHttp.onreadystatechange = function(){
		if (XmlHttp.readyState==4) {
			document.getElementById("iletisimMsg").innerHTML = "Mesajınız iletildi! En kısa sürede yanıt verilecektir.";
			document.getElementById("btnIletisim").style.display = "none";
		}	
	};
	XmlHttp.open("POST","_iletisim.asp",true);
	XmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	XmlHttp.send(sForm);
}

function _ListKart(obj, iKartID, iSessionID)
{
	sForm = "ID=" + iKartID;
	sForm += "&SessionID=" + iSessionID;
	
	_bgDiv();
	_divPencere2("ListKart", obj);
	document.getElementById("ListKart").innerHTML = "<img id=\"imgIndicator\" src=\"images/icon/indicator.gif\" />";
	XmlHttp=new XMLHttpRequest();
	XmlHttp.onreadystatechange = function(){
		if (XmlHttp.readyState==4) {
			document.getElementById("ListKart").innerHTML = XmlHttp.responseText;
		}	
	};
	XmlHttp.open("POST","dovusKulubu.asp",true);
	XmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	XmlHttp.send(sForm);
}

function _ListFotogaleri(obj, iGaleriID, iSessionID)
{
	sForm = "GaleriID=" + iGaleriID;
	sForm += "&SessionID=" + iSessionID;

	_bgDiv();
	_divPencere2("listFotogaleri", obj);
	document.getElementById("listFotogaleri").innerHTML = "<img id=\"imgIndicator\" src=\"images/icon/indicator.gif\" />";
	if (window.XMLHttpRequest) {XmlHttp=new XMLHttpRequest();} else if (window.ActiveXObject) {XmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
	XmlHttp.onreadystatechange = function(){
		if (XmlHttp.readyState==4) {
			document.getElementById("listFotogaleri").innerHTML = XmlHttp.responseText;
			$("div.horizontal").scrollable({size:1});
		}	
	};
	XmlHttp.open("POST","dovusKulubu.asp",true);
	XmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	XmlHttp.send(sForm);
}

function videoPuanVer(iPuan, iVideoID)
{
	sForm = "VideoID=" + iVideoID
	sForm += "&Puan=" + iPuan
	
	if (window.XMLHttpRequest) {XmlHttp=new XMLHttpRequest();} else if (window.ActiveXObject) {XmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
	XmlHttp.onreadystatechange = function(){
		if (XmlHttp.readyState==4) {
			var sPuan = XmlHttp.responseText;
			document.getElementById("videoPuan").title = sPuan;
			document.getElementById("hVideoPuan").value = sPuan;
			document.getElementById("sVideoPuan").innerHTML = sPuan.substr(0,3) + "/5";
			videoPuanDefault();
			for(i=1;i<=5;i++)
			{
				document.getElementById("videoPuan" + i).onmouseover = null;
				document.getElementById("videoPuan" + i).onclick = null;
			}
		}	
	};
	XmlHttp.open("POST","_puanVer.asp",true);
	XmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	XmlHttp.send(sForm);
}

function videoPuanDefault()
{
	for(i=1;i<=5;i++)
	{
		if (parseInt(document.getElementById("hVideoPuan").value) >= i)
		{document.getElementById("videoPuan" + i).className = "yildizDolu";}
		else
		{document.getElementById("videoPuan" + i).className = "yildizBos";}
	}
}

function _haberEkle()
{
	document.getElementById("haberMsg").style.display = "block";document.getElementById("haberMsg").innerHTML = "";
	if (document.getElementById("GrupID").value == "") {document.getElementById("haberMsg").innerHTML = "Grup seçiniz!";document.getElementById("GrupID").focus();return false;}
	if (document.getElementById("Baslik").value == "") {document.getElementById("haberMsg").innerHTML = "Başlık giriniz!";document.getElementById("Baslik").focus();return false;}
	if (document.getElementById("Kaynak").value == "") {document.getElementById("haberMsg").innerHTML = "Kaynak giriniz!";document.getElementById("Kaynak").focus();return false;}
	if (document.getElementById("Icerik").value == "") {document.getElementById("haberMsg").innerHTML = "İçerik giriniz!";document.getElementById("Icerik").focus();return false;}
	
	sForm = "GrupID=" + ajaxKarakter(document.getElementById("GrupID").value);
	sForm += "&Baslik=" + ajaxKarakter(document.getElementById("Baslik").value);
	sForm += "&Kaynak=" + ajaxKarakter(document.getElementById("Kaynak").value);
	sForm += "&KaynakWeb=" + ajaxKarakter(document.getElementById("KaynakWeb").value);
	sForm += "&Icerik=" + ajaxKarakter(document.getElementById("Icerik").value);

	document.getElementById("haberMsg").innerHTML = "<img id=\"imgIndicator\" src=\"images/icon/indicator.gif\" />";
	if (window.XMLHttpRequest) {XmlHttp=new XMLHttpRequest();} else if (window.ActiveXObject) {XmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
	XmlHttp.onreadystatechange = function(){
		if (XmlHttp.readyState==4) {
			if (XmlHttp.responseText == "1")
			{
				document.getElementById("haberMsg").innerHTML = "Ekleme işlemi başarıyla yapıldı! Onaylandıktan sonra yayınlanacaktır. Bu pencereyi kapatabilirsiniz!";
				document.getElementById("btnHaberEkle").style.display = "none";
			}
			else
			{
				document.getElementById("haberMsg").innerHTML = "işlem başarısız!";
			}
		}	
	};
	XmlHttp.open("POST","_haber.asp",true);
	XmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	XmlHttp.send(sForm);
}


function _divKapa()
{
	if (document.getElementById("bgDiv") != null) {document.getElementById("bgDiv").style.display = "none";}
	document.getElementById("programMenu").style.display = "none";
	document.getElementById("uyelik").style.display = "none";
	document.getElementById("kanallarMenu").style.display = "none";
	if (document.getElementById("videoPaylas") != null) {document.getElementById("videoPaylas").style.display = "none";}
	if (document.getElementById("yeniHaber") != null) {document.getElementById("yeniHaber").style.display = "none";}
	if (document.getElementById("yeniEtkinlik") != null) {document.getElementById("yeniEtkinlik").style.display = "none";}
	if (document.getElementById("ListKart") != null) {document.getElementById("ListKart").style.display = "none";}
	if (document.getElementById("listFotogaleri") != null) {document.getElementById("listFotogaleri").style.display = "none";}
}

function _bgDiv()
{
	if (document.getElementById("bgDiv") == null)
	{
		var bgDiv = document.createElement('div');
		bgDiv.id = "bgDiv";
		document.body.appendChild(bgDiv);
		document.getElementById("bgDiv").style.width = screen.width + "px";
		document.getElementById("bgDiv").style.height = screen.height-50 + "px";
		document.getElementById("bgDiv").style.zIndex = 5;
		document.getElementById("bgDiv").onclick = function(){_divKapa();};
	}
	document.getElementById("bgDiv").style.display = "block";
}



function _divPencere(sID)
{
	if (document.getElementById(sID).style.display == "none" || document.getElementById(sID).style.display == "")
	{
		_divKapa();
		_bgDiv();
		document.getElementById(sID).style.zIndex = 6;
		document.getElementById(sID).style.display = "block";
		
		var iPositionLeft = 0;
		var iPositionTop = 0;
		if (sID == "programMenu") {iPositionLeft = -480;}
		if (sID == "uyelik") {iPositionLeft = 0;}
		if (sID == "kanallarMenu") {iPositionLeft = -125;}
		if (sID == "yeniHaber") {iPositionLeft = -260;}
		if (sID == "yeniEtkinlik") {iPositionLeft = -260;}
		if (sID == "ListKart") {iPositionLeft = -322;iPositionTop = -160;}
		if (sID == "listFotogaleri") {iPositionLeft = -346;iPositionTop = -260;}
				
		document.getElementById(sID).style.left = document.body.clientWidth/2+iPositionLeft + "px";
		if (iPositionTop != 0) {document.getElementById(sID).style.top = document.body.clientHeight/2+iPositionTop + "px";}
		if (sID == "videoPaylas") {document.getElementById(sID).style.top = "400px";}

	}
	else
	{
		_divKapa();
	}
}

function getposOffset(what, offsettype)
{
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null)
	{
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}
	
function _divPencere2(sID, obj)
{
	if (document.getElementById(sID).style.display == "none" || document.getElementById(sID).style.display == "")
	{
		_divKapa();
		_bgDiv();
		document.getElementById(sID).style.zIndex = 6;
		document.getElementById(sID).style.display = "block";
		
		var iPositionLeft = 0;
		if (sID == "ListKart") {iPositionLeft = -322;}
		if (sID == "listFotogaleri") {iPositionLeft = -346;}
		
		document.getElementById(sID).style.left = document.body.clientWidth/2+iPositionLeft + "px";
		document.getElementById(sID).style.top = getposOffset(obj, "top") -250 + "px";
		if (sID == "videoPaylas") {document.getElementById(sID).style.top = "400px";}

	}
	else
	{
		_divKapa();
	}
}

function _yorumSikayetEt(iYorumID)
{
	if (window.XMLHttpRequest) {XmlHttp=new XMLHttpRequest();} else if (window.ActiveXObject) {XmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
	XmlHttp.onreadystatechange = function(){
		if (XmlHttp.readyState==4) {
			if (XmlHttp.responseText == "1")
			{
				document.getElementById("yorumSikayet_" + iYorumID).innerHTML = "<span style=\"color:#E44145;font-weight:bold;\">Gönderildi!</span>";
			}
			else
			{
				document.getElementById("yorumSikayet_" + iYorumID).innerHTML = "işlem başarısız";
			}
		}	
	};
	XmlHttp.open("GET","_yorumSikayet.asp?YorumID=" + iYorumID,true);
	XmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	XmlHttp.send(null);
}

function _haberSikayetEt(iHaberID)
{
	if (window.XMLHttpRequest) {XmlHttp=new XMLHttpRequest();} else if (window.ActiveXObject) {XmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
	XmlHttp.onreadystatechange = function(){
		if (XmlHttp.readyState==4) {
			if (XmlHttp.responseText == "1")
			{
				document.getElementById("haberSikayet_" + iHaberID).innerHTML = "<span style=\"color:#E44145;font-weight:bold;\">Gönderildi!</span>";
			}
			else
			{
				document.getElementById("haberSikayet_" + iHaberID).innerHTML = "işlem başarısız";
			}
		}	
	};
	XmlHttp.open("GET","_haberSikayet.asp?HaberID=" + iHaberID,true);
	XmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	XmlHttp.send(null);
}


var sDate = new Date();
var sBugun = sDate.getDate() + "." + sDate.getMonth()+1 + "." + sDate.getYear();


function _etkinlikEkle()
{
	document.getElementById("etkinlikMsg").style.display = "block";document.getElementById("etkinlikMsg").innerHTML = "";
	if (document.getElementById("GrupID").value == "") {document.getElementById("etkinlikMsg").innerHTML = "Grup seçiniz !";document.getElementById("GrupID").focus();return false;}
	if (document.getElementById("Baslik").value == "") {document.getElementById("etkinlikMsg").innerHTML = "Başlık giriniz !";document.getElementById("Baslik").focus();return false;}
	if (document.getElementById("Tarih").value == "") {document.getElementById("etkinlikMsg").innerHTML = "Tarih giriniz !";document.getElementById("Tarih").focus();return false;}
	if (document.getElementById("Sehir").value == "") {document.getElementById("etkinlikMsg").innerHTML = "Şehir giriniz !";document.getElementById("Sehir").focus();return false;}
	if (document.getElementById("Semt").value == "") {document.getElementById("etkinlikMsg").innerHTML = "Semt giriniz !";document.getElementById("Semt").focus();return false;}
	if (document.getElementById("Mekan").value == "") {document.getElementById("etkinlikMsg").innerHTML = "Mekan giriniz !";document.getElementById("Mekan").focus();return false;}
	if (document.getElementById("Organizator").value == "") {document.getElementById("etkinlikMsg").innerHTML = "Organizatör giriniz !";document.getElementById("Organizator").focus();return false;}
	if (document.getElementById("OrganizatorEmail").value == "") {document.getElementById("etkinlikMsg").innerHTML = "Organizatör email giriniz !";document.getElementById("OrganizatorEmail").focus();return false;}
	if (document.getElementById("Icerik").value == "") {document.getElementById("etkinlikMsg").innerHTML = "İçerik giriniz !";document.getElementById("Icerik").focus();return false;}

	sForm = "GrupID=" + ajaxKarakter(document.getElementById("GrupID").value);
	sForm += "&Baslik=" + ajaxKarakter(document.getElementById("Baslik").value);
	sForm += "&Tarih=" + ajaxKarakter(document.getElementById("Tarih").value);
	sForm += "&Ucret=" + ajaxKarakter(document.getElementById("Ucret").value);
	sForm += "&Sehir=" + ajaxKarakter(document.getElementById("Sehir").value);
	sForm += "&Semt=" + ajaxKarakter(document.getElementById("Semt").value);
	sForm += "&Mekan=" + ajaxKarakter(document.getElementById("Mekan").value);
	sForm += "&Organizator=" + ajaxKarakter(document.getElementById("Organizator").value);
	sForm += "&OrganizatorTel=" + ajaxKarakter(document.getElementById("OrganizatorTel").value);
	sForm += "&OrganizatorEmail=" + ajaxKarakter(document.getElementById("OrganizatorEmail").value);
	sForm += "&OrganizatorWeb=" + ajaxKarakter(document.getElementById("OrganizatorWeb").value);
	sForm += "&Icerik=" + ajaxKarakter(document.getElementById("Icerik").value);

	document.getElementById("etkinlikMsg").innerHTML = "<img id=\"imgIndicator\" src=\"images/icon/indicator.gif\" />";
	if (window.XMLHttpRequest) {XmlHttp=new XMLHttpRequest();} else if (window.ActiveXObject) {XmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
	XmlHttp.onreadystatechange = function(){
		if (XmlHttp.readyState==4) {
			if (XmlHttp.responseText == "1")
			{
				document.getElementById("etkinlikMsg").innerHTML = "Ekleme işlemi başarıyla yapıldı ! Onaylandıktan sonra yayınlanacaktır. Bu pencereyi kapatabilirsiniz!";
				document.getElementById("btnEtkinlikEkle").style.display = "none";
			}
			else if (XmlHttp.responseText == "2")
			{
				document.getElementById("etkinlikMsg").innerHTML = "Tarih alanını yanlış girdiniz !";
			}
			else
			{
				document.getElementById("etkinlikMsg").innerHTML = XmlHttp.responseText;
			}
		}	
	};
	XmlHttp.open("POST","_etkinlik.asp",true);
	XmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	XmlHttp.send(sForm);
}

function queryString(Deger) {
  if(Deger!=null) {
    var regEx = new RegExp("(\\?|&)("+Deger+"=)(.*?)(&|$|#)","i")
    var exec = regEx.exec(location.href)
    var Sonuc = RegExp.$3
  } else {
    var regEx = new RegExp("(\\?)(.*?)($)","i")
    var exec = regEx.exec(location.href)
    var Sonuc = RegExp.$2
  }

  return(Sonuc)
}

function _login()
{
	document.getElementById("loginMsg").style.display = "block";document.getElementById("loginMsg").innerHTML = "";
	if (! isValidEmail(document.getElementById("Email").value)) {document.getElementById("loginMsg").innerHTML = "Geçerli bir e-posta giriniz!";document.getElementById("Email").focus();return false;}
	else if (document.getElementById("Password").value == "") {document.getElementById("loginMsg").innerHTML = "Şifre giriniz!";document.getElementById("Password").focus();return false;}
	else
	{
		document.getElementById("loginBtn").style.display = "none";
		sForm = "Email=" + document.getElementById("Email").value;
		sForm += "&Password=" + document.getElementById("Password").value;
		if (document.getElementById("BeniHatirla").checked) {sForm += "&Hatirla=1";}
		sForm += "&Tarih=" + new Date();

		document.getElementById("ajaxIslem").innerHTML = "<img id=\"imgIndicator\" src=\"images/icon/indicator.gif\" />";

		if (window.XMLHttpRequest) {XmlHttp=new XMLHttpRequest();} else if (window.ActiveXObject) {XmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
		XmlHttp.onreadystatechange = function(){
			if (XmlHttp.readyState==4) {
				document.getElementById("ajaxIslem").innerHTML = "";
				iSonuc = XmlHttp.responseText;
				if (iSonuc == "1")
				{
					document.getElementById("loginMsg").innerHTML = "Email veya şifreniz yanlış!";
					document.getElementById("loginBtn").style.display = "block";
				}
				if (iSonuc == "2")
				{
					document.getElementById("loginMsg").innerHTML = "Üyeliğiniz pasif durumdadır!";
					document.getElementById("loginBtn").style.display = "block";
				}
				else if (iSonuc == "3")
				{
					_divKapa();
					document.getElementById("menuUyeOl").style.display = "none";
					document.getElementById("menuProfilim").style.display = "block";
					if (document.getElementById("btnHaberEkle") != null) {document.getElementById("btnHaberEkle").style.display = "block";document.getElementById("haberMsg").innerHTML = "";document.getElementById("imgEkle").onclick = function(){_divPencere('yeniHaber')};document.getElementById("lblEkle").innerHTML = "";}
					if (document.getElementById("btnEtkinlikEkle") != null) {document.getElementById("btnEtkinlikEkle").style.display = "block";document.getElementById("etkinlikMsg").innerHTML = "";document.getElementById("imgEkle").onclick = function(){_divPencere('yeniEtkinlik')};document.getElementById("lblEkle").innerHTML = "";}
					if (document.getElementById("vUpl") != null) {location.href = window.location.pathname;}
					if (window.location.pathname.indexOf("videoYorumlar.asp") != -1) {location.href = window.location.pathname + "?vID=" + queryString("vID");}
					if (window.location.pathname.indexOf("haberler.asp") != -1) {location.href = window.location.pathname;}
					if (window.location.pathname.indexOf("default.asp") != -1 && document.getElementById("videoYok") != null) {location.href = window.location.pathname;}
				}
			}	
		};
		XmlHttp.open("POST","_login.asp",true);
		XmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		XmlHttp.send(sForm);
	}
}

function _yeniUyelik(iSession)
{
	document.getElementById("uyelikMsg").style.display = "block";document.getElementById("uyelikMsg").innerHTML = "";
	if (document.getElementById("UyelikUsername").value == "") {document.getElementById("uyelikMsg").innerHTML = "Kullanıcı adı giriniz!";document.getElementById("UyelikUsername").focus();return false;}
	else if (! isValidEmail(document.getElementById("UyelikEmail").value)) {document.getElementById("uyelikMsg").innerHTML = "Geçerli bir e-mail giriniz!";document.getElementById("UyelikEmail").focus();return false;}
	else if (document.getElementById("UyelikPassword").value.length < 6) {document.getElementById("uyelikMsg").innerHTML = "Şifreniz en az 6 karakter olmalıdır!";document.getElementById("UyelikPassword").focus();return false;}
	else if (document.getElementById("UyelikPassword").value != document.getElementById("UyelikPassword2").value) {document.getElementById("uyelikMsg").innerHTML = "Kontrol şifresi giriniz !";document.getElementById("UyelikPassword2").focus();return false;}
	else
	{
		document.getElementById("yeniUyelikBtn").style.display = "none";
		sForm = "Username=" + document.getElementById("UyelikUsername").value;
		sForm += "&Password=" + document.getElementById("UyelikPassword").value;
		sForm += "&Email=" + document.getElementById("UyelikEmail").value;
		if (document.getElementById("UyeTipFirma").checked)
		{
			sForm += "&UyeTipFirma=1";
		}
		else
		{
			sForm += "&UyeTipFirma=0";
		}
		sForm += "&SessionID=" + iSession;
		sForm += "&Tarih=" + new Date();
	
		document.getElementById("ajaxIslem").innerHTML = "<img id=\"imgIndicator\" src=\"images/icon/indicator.gif\" />";
		if (window.XMLHttpRequest) {XmlHttp=new XMLHttpRequest();} else if (window.ActiveXObject) {XmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
		XmlHttp.onreadystatechange = function(){
			if (XmlHttp.readyState==4) {
				document.getElementById("ajaxIslem").innerHTML = "";
				iSonuc = XmlHttp.responseText;
				if (iSonuc == "1") {document.getElementById("uyelikMsg").innerHTML = "Kullanıcı adı kullanımda!";document.getElementById("UyelikUsername").focus();document.getElementById("yeniUyelikBtn").style.display = "block";return false;}
				else if (iSonuc == "2") {document.getElementById("uyelikMsg").innerHTML = "E-posta adresi kullanımda!";document.getElementById("UyelikEmail").focus();document.getElementById("yeniUyelikBtn").style.display = "block";return false;}
				else if (iSonuc == "3")
				{
					document.getElementById("uyelikMsg").innerHTML =  "<div style=\"top:-20px;position:relative;\">Üyeliğiniz başarıyla yapılmıştır! Adresinize gelen e-postayı onaylayarak giriş yapınız! </div>";
					document.getElementById("UyelikUsername").value = "";
					document.getElementById("UyelikPassword").value = "";
					document.getElementById("UyelikPassword2").value = "";
					document.getElementById("UyelikEmail").value = "";
					document.getElementById("Username").focus();
				}
				else {document.getElementById("uyelikMsg").innerHTML = iSonuc;}
			}	
		};
		XmlHttp.open("POST","_yeniUyelik.asp",true);
		XmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		XmlHttp.send(sForm);
	}
}

function _sifreHatirlat(iSession)
{
	document.getElementById("hatirlatMsg").style.display = "block";document.getElementById("hatirlatMsg").innerHTML = "";
	if (! isValidEmail(document.getElementById("HatirlatEmail").value)) {document.getElementById("hatirlatMsg").innerHTML = "Geçerli bir e-mail giriniz !";document.getElementById("HatirlatEmail").focus();return false;}
	else
	{
		document.getElementById("sifreHatirlatBtn").style.display = "none";
		sForm = "Email=" + document.getElementById("HatirlatEmail").value;
		sForm += "&SessionID=" + iSession;
		sForm += "&Tarih=" + new Date();
		
		document.getElementById("ajaxIslem").innerHTML = "<img id=\"imgIndicator\" src=\"images/icon/indicator.gif\" />";
		if (window.XMLHttpRequest) {XmlHttp=new XMLHttpRequest();} else if (window.ActiveXObject) {XmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
		XmlHttp.onreadystatechange = function(){
			if (XmlHttp.readyState==4) {
				document.getElementById("ajaxIslem").innerHTML = "";
				iSonuc = XmlHttp.responseText;
				if (iSonuc == "0") {document.getElementById("hatirlatMsg").innerHTML = "Geçersiz işlem!";document.getElementById("HatirlatEmail").focus();document.getElementById("sifreHatirlatBtn").style.display = "block";return false;}
				else if (iSonuc == "1") {document.getElementById("hatirlatMsg").innerHTML = "E-posta adresine bağlı üyelik bulunamadı!";document.getElementById("HatirlatEmail").focus();document.getElementById("sifreHatirlatBtn").style.display = "block";return false;}
				else if (iSonuc == "2") {document.getElementById("hatirlatMsg").innerHTML = "Yeni şifreniz E-posta adresinize gönderildi!";return false;} }	
		};
		XmlHttp.open("POST","_sifreHatirlat.asp",true);
		XmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		XmlHttp.send(sForm);
	}
}

function isValidEmail(email, required) {
    if (required==undefined) {   // if not specified, assume it's required
        required=true;
    }
    if (email==null) {
        if (required) {
            return false;
        }
        return true;
    }
    if (email.length==0) {  
        if (required) {
            return false;
        }
        return true;
    }
    if (! allValidChars(email)) {  // check to make sure all characters are valid
        return false;
    }
    if (email.indexOf("@") < 1) { //  must contain @, and it must not be the first character
        return false;
    } else if (email.lastIndexOf(".") <= email.indexOf("@")) {  // last dot must be after the @
        return false;
    } else if (email.indexOf("@") == email.length) {  // @ must not be the last character
        return false;
    } else if (email.indexOf("..") >=0) { // two periods in a row is not valid
	return false;
    } else if (email.indexOf(".") == email.length) {  // . must not be the last character
	return false;
    }
    return true;
}

function allValidChars(email) {
  var parsed = true;
  var validchars = "abcdefghijklmnopqrstuvwxyz0123456789@.-_";
  for (var i=0; i < email.length; i++) {
    var letter = email.charAt(i).toLowerCase();
    if (validchars.indexOf(letter) != -1)
      continue;
    parsed = false;
    break;
  }
  return parsed;
}

function arkadasOnerKontrol()
{
	bReturn = false;
	
	if (document.getElementById("GonderenAd").value == "Lütfen isminizi girin!") {document.getElementById("GonderenAd").value = "";}
	
	for(i=1;i<=5;i++)
	{
		if (document.getElementById("OnerEmail" + i).value == "Arkadaşınızın e-posta adresini yazınız") {document.getElementById("OnerEmail" + i).value = "";}
		if (document.getElementById("OnerEmail" + i).value != "")
		{
			if (! isValidEmail(document.getElementById("OnerEmail" + i).value))
			{
				document.getElementById("OnerEmailMetin" + i).innerHTML = "Geçerli bir e-mail giriniz !";
			}
			else
			{
				document.getElementById("OnerEmailMetin" + i).innerHTML = "";
				bReturn = true;
			}
		}
		else
		{
			document.getElementById("OnerEmailMetin" + i).innerHTML = "";
		}
	}

	if (bReturn == false && document.getElementById("OnerEmail1").value == "" && document.getElementById("OnerEmail2").value == "" && document.getElementById("OnerEmail3").value == "" && document.getElementById("OnerEmail4").value == "" && document.getElementById("OnerEmail5").value == "") {document.getElementById("OnerEmailMetin1").innerHTML = "En az bir email adresi giriniz!";}

	if (document.getElementById("GonderenAd").value == "") 
	{
		document.getElementById("lblGonderenAdMsg").innerHTML = "İsim giriniz !";
		bReturn = false;
	}
	else { document.getElementById("lblGonderenAdMsg").innerHTML = ""; }

	
	return bReturn;
}
