// Copyrights Korput Internet IT Consultancy & HR Inc © 2006
// All Javascript and CSS code written by Ünal Tabak <www.unaltabak.com>
// Do not change these lines for copyright. 18/January/2006
// http://www.korput.com/

//OnMouseOver's
var img1= new Image( 10, 10 ); 
img1.src = "/images/drop.gif"; 

//if(top!= self) top.location.href = self.location.href

//======================================== GENERAL JAVASCRIPTs START ==============================================

function Browser() 
{ //Get the Browser Type like Netscape'ishes and IE.
	if (navigator.appName =="Netscape") { return "NS"; } else { return "IE"; } //Firefox => NS
}

function text_focus(txt) 
{ //Aktif fontu sarı background yapar 	
	if (Browser()=="IE")
	{
		window.event.srcElement.style.color="#0000CC";
		window.event.srcElement.style.background="#EEFFEE";
		if (window.event.srcElement.type=="text") { window.event.srcElement.select(); } //text-field ise aktif select yap
	} else {
		txt.style.color="#0000CC";
		txt.style.background="#EEFFEE";
		if (txt.type=="text") { txt.select(); } //text-field ise aktif select yap
	}

	return true;
}

function text_blur(txt) 
{ //Aktif fontu beyaz background yapar 
	if (Browser()=="IE")
	{
		window.event.srcElement.style.color="#000080";
		window.event.srcElement.style.background="#ffffff";
	} else {
		txt.style.color="#000080";
		txt.style.background="#ffffff";
	}
	return true;
}

function number_onkeypress(e) //V2.01 IE && NS && ...
{
	var key;
	var keychar;
	var reg;

	if(window.event) {	// for IE, e.keyCode or window.event.keyCode can be used
		key = e.keyCode;
	}
	else if(e.which) {	// netscape'ish
		key = e.which;
	}
	else {	// no event, so pass through
		return true;
	}

	keychar = String.fromCharCode(key); 
	if (key==8 || key==13) //BackSpace or Enter
	{ 
		return true; 
	} else { 
		reg = /[0-9]|\// 
		return reg.test(keychar); 
	}
} 

function tel_onkeyup(tel) 
{
	if (Browser()=="IE") { str = window.event.srcElement.value; } else { str = tel.value; }
	str = str.replace(") ","");
	str = str.replace(" ","");
	str = str.replace("(","");
	str = str.replace(")","");
	new_str="";
	if (str.length!=0)
	{ 
		if (str.length<3)  { new_str= "(" + str.substr(0,3);                         }
		if (str.length==3) { new_str= "(" + str.substr(0,3)                          }
		if (str.length==4) { new_str= "(" + str.substr(0,3) +") " + str.substr(3,1); }
		if (str.length==5) { new_str= "(" + str.substr(0,3) +") " + str.substr(3,2); }
		if (str.length==6) { new_str= "(" + str.substr(0,3) +") " + str.substr(3,3); }
		if (str.length>=7) { new_str= "(" + str.substr(0,3) +") " + str.substr(3,3) + " " + str.substr(6); }
	}
	if (Browser()=="IE") { window.event.srcElement.value = new_str; } else { tel.value = new_str; }
	return true;
}

function kucuk_harf(harf) 
{   //ÜĞİŞÇÖI üğişöı 
	var str;
	if (Browser()=="IE") { str = window.event.srcElement.value; } else { str = harf.value; }
	str = str.replace("Ü","ü");
	str = str.replace("Ğ","ğ");
	str = str.replace("İ","i");
	str = str.replace("Ş","ş");
	str = str.replace("Ç","ç");
	str = str.replace("Ö","ö");
	str = str.replace("I","i");
	str = str.toLowerCase();
	if (Browser()=="IE") { window.event.srcElement.value = str; } else { harf.value = str; }
	return true;
}

function buyuk_harf(harf) 
{   //üğişöı ÜĞİŞÇÖI
	if (Browser()=="IE") { str = window.event.srcElement.value; } else { str = harf.value; }
	str = str.replace("ü","Ü");
	str = str.replace("ğ","Ğ");
	str = str.replace("i","İ");
	str = str.replace("ş","Ş");
	str = str.replace("ç","Ç");
	str = str.replace("ö","Ö");
	str = str.replace("i","I");
	str = str.toUpperCase();
	if (Browser()=="IE") { window.event.srcElement.value = str; } else { harf.value = str; }
	return true;
}

function e_mail(the_email)
{
	var pozisyon = the_email.indexOf("."),pozisyonu = the_email.indexOf("@");
	if (pozisyon == -1 || pozisyonu == -1 || ( ( pozisyonu + 1 ) == the_email.length) || ( ( pozisyon + 1 ) == the_email.length)) {alert("E-mail adresi geçerli bir adres değildir !"); document.getElementById("emaili").focus(); return false;} 
	else {return true;}
}

function email_onkeypress(e) //V2.01 IE && NS && ...
{
	var key;
	var keychar;
	var reg;

	if(window.event) {	// for IE, e.keyCode or window.event.keyCode can be used
		key = e.keyCode;
	}
	else if(e.which) {	// netscape'ish
		key = e.which;
	}
	else {	// no event, so pass through
		return true;
	}

	keychar = String.fromCharCode(key); 
	if (key==8 || key==13) //BackSpace or Enter
	{ 
		return true; 
	} else { 
		reg = /[a-zA-Z0-9\.\_\@\_]/ 
		return reg.test(keychar); 
	}
} 

function multiple_emails_semicolon_correct(str)
{ //;<email1;email2;...;emailx>; başındaki sonundaki ; ları siler

	var i=0,str2="",x="",semi_colon=1;
	while (i <= str.length) 
	{
		x=str.substr(i,1);
		if ( semi_colon==1 ) { if ( x != ";" ) { str2 = str2 + x; semi_colon=0; } } else { str2 = str2 + x; }
		i=i+1;
	}
	str=str2;
	str2="";
	x="";
	semi_colon=1;
	i=str.length-1;	
	while (i >= 0) 
	{
		x=str.substr( i , 1 );
		if ( semi_colon==1 ) { if ( x != ";" ) { str2 = x + str2; semi_colon=0; } } else { str2 = x + str2; }
		i=i-1;
	}
	return str2;
}

function LTrim(str)
{ //Left Trim
	var i=0,str2="",x="",firstspace=1;
	while (i <= str.length) 
	{
		x=str.substr(i,1);
		if ( firstspace==1 ) { if ( x != " " ) { str2 = str2 + x; firstspace=0; } } else { str2 = str2 + x; }
		i=i+1;
	}
	return str2;
}

function RTrim(str)
{ //Right Trim
	var i=str.length-1,str2="",x="",lastspace=1;
	while (i >= 0) 
	{
		x=str.substr( i , 1 );
		if ( lastspace==1 ) { if ( x != " " ) { str2 = x + str2; lastspace=0; } } else { str2 = x + str2; }
		i=i-1;
	}
	return str2;
}

function Trim(str)
{ //All Trim - left & right
	return RTrim(LTrim(str));
}


//======================================== GENERAL JAVASCRIPT START END ==============================================

//======================================== CUSTOM JAVASCRIPT START ==============================================
function giris_kontrol()
{ //Ana Sayfadaki Üye Login Giriş öncesi kontrol
	//if (document.ph.aranan.value!="") {alert("Aradığınız Bilgi :\n\n'" +document.ph.aranan.value +"'\n\n ..bulunamadı!"); document.ph.aranan.value=""; return false;}
	document.getElementById('kullanici').value = Trim ( document.getElementById('kullanici').value );
	if (document.getElementById("kullanici").value==null || document.getElementById("sifre").value==null || document.getElementById("kullanici").value=="" || document.getElementById("sifre").value=="" )
	{ 
	  alert("Kullanıcı/E-mail ve Şifre alanlarının her ikisi de dolu olmalıdır!");  
	  if (document.getElementById("kullanici").value==null || document.getElementById("kullanici").value=="")	{ document.getElementById("kullanici").focus(); }
	  else { if (document.getElementById("sifre").value==null || document.getElementById("sifre").value=="")	{ document.getElementById("sifre").focus();	} }
	  return false; 
	} else 
	{ return true; }
}

function anket_kontrol(anketno , kul) //Anketleri gönderen ve gösteren function
{
	sonuc = 0;
	anket = document.getElementsByName(anketno);
	selected = false;
	if (anket.length == '') {
		selected = anket.checked;
	} else {
		for (i=0; i <anket.length; i++) {
		if (anket[i].checked) {
			selected = true;
			sonuc = anket[i].value;
			}
		}
	}
	if (!selected) { alert("Dikkat ! Anket şıkkı seçimi YAPMADINIZ.\n\nLütfen önce anket seçeneğinizi işaretleyiniz,\nsonrasında OYLA butonuna basınız.");}
	else {
		anketwin=window.open("anket.php?anket=" +anketno +"&sonuc=" +sonuc +"&kullanici=" +kul,"anketwin","toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0,width=230,height=400");
		anketwin=anketwin.focus();
	}
}



//------------------------------------------------
function uyegiris_show()
{
	if (document.getElementById)
	{
		document.getElementById('uyegiris').style.visibility='visible';
	} else {
	if (document.layers) 
	{ //NS4
		document.uyegiris.visibility = 'visible';
	}
	else { //IE4
		document.all.uyegiris.style.visibility = 'visible';	
		 }
	}
}

//------------------------------------------------
function uyegiris_hide()
{
	if (document.getElementById)
	{
		document.getElementById('uyegiris').height = "0px";
	} else {
	if (document.layers) 
	{ //NS4
		document.uyegiris.height = "0px";
	}
	else { //IE4
		document.all.uyegiris.height = "0px";
		 }
	}
}

//======================================== CUSTOM JAVASCRIPT END ==============================================

