//JavaScript Kodlari
//Coder ErsaT
var siteurl = 'http://www.erenetoyun.com/';
function HataBildir(id){
	if(confirm('Hata Bildirimi\n\n1- Hata bildirimi yapmadan önce sayfayı yenileyip tekrar deneyiniz.\n2- Vazgeç veya Iptal diyerek te sayfayı yenileyebilirsiniz.\n3- Oyunları oynayabilmeniz için sisteminizde Flash Player gerekli, Flash Playerinizin olduğundan veya güncel olduğundan emin olun.\n4- Lütfen son olarak yardım sayfamızı ziyaret edip olası nedenleri tekrar gözden geçirin\n5- Bütün bunlara rağmen oyunu oynayamıyorsanız lütfen bize bildirin.\n\nBildirim yaptığınız için teşekkür ederiz.')){
		window.open(siteurl+'hatabildir.php?id='+id+'', 'hatabildir', 'width=425, height=295');
	
	}else{
		location.reload();
	}
}
function Tavsiye(id){
	window.open(siteurl+'tavsiye.php?id='+id+'', 'tavsiye', 'width=440, height=450');
}
function yonlen(url){
	top.location=siteurl+url;	
}
function TamEkran(id){
	document.getElementById('tamekran').style.display = 'block';
	document.getElementById('player').style.display = 'none';
	window.open(siteurl+'tamekran.php?id='+id+'', 'tamekran', 'DisplayFullScreen');
}
function TamEkranCik(){
	document.getElementById('tamekran').style.display = 'none';
	document.getElementById('player').style.display = 'block';
}
function kapat(id){
if(document.images){
(new Image()).src=""+siteurl+"reklam_kapat.php?id="+id;
}
return true;
}
function Favoriler(isim,url){
var msg_netscape = "NetScape message";
var msg_opera = "Bu özellik Opera'nın bu versiyonunda kullanılmıyor. Lütfen browser ayarlarınızdan tamamlayın.";
var msg_other = "Bu özellik browseriniz tarafından desteklemiyor. Lütfen browser ayarlarınızdan tamamlamaya çalışın.";
var agt = navigator.userAgent.toLowerCase();
if(agt.indexOf("opera") != -1){
	if(window.opera && window.print){
		return true;
		}else{
			alert(msg_other);
		}
	}else if(agt.indexOf("firefox") != -1)
		window.sidebar.addPanel(isim,url,"");
	else if((agt.indexOf("msie") != -1) && (parseInt(navigator.appVersion) >=4)) window.external.AddFavorite(url,isim);
	else if(agt.indexOf("netscape") != -1) window.sidebar.addPanel(isim,url,"")
else if(window.sidebar && window.sidebar.addPanel) window.sidebar.addPanel(isim,url,"");
else alert(msg_other);
}
function AnaSayfamYap(URL){
	var l = document.getElementById('anasayfa');
    var Text = 'Giriş sayfanızı http://www.erenetoyun.com olarak ayarlamak ister misiniz?';
    if (document.all){
		l.style.behavior='url(#default#homepage)';
		l.setHomePage(URL);

	}else if(document.getElementById || document.layers){
		if(confirm(Text)){
			netscape.security.PrivilegeManager.enablePrivilege("UniversalPreferencesWrite");
			navigator.preference('browser.startup.homepage',URL);
		}
	}else{
		alert('Üzgünüz, browseriniz bu özelliği desteklemiyor. Browser ayarlarınızdan tamamlayın.');
	}
	return false;    
}
function RastgeleOyun(kategori){
	if(kategori){
		top.location = siteurl+'rastgele-oyun.php?kategori='+kategori;
	}else{
		top.location = siteurl+'rastgele-oyun.php';
	}
}
function MM_jumpMenu(targ,selObj,restore){
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}
function aciklama_oner(){
	if(document.form1.aciklama.value == ''){
		alert('Oyun açıklaması boş olamaz. Lütfen geçerli bir açıklama yazınız.');
		document.form1.aciklama.focus();
		return false;

	}else if(document.form1.aciklama.value.length<100){
		alert('Oyun açıklaması 100 karakter den az olamaz');
		document.form1.aciklama.focus();
		return false;

	}else if(document.form1.aciklama.value.length>2000){
		alert('Oyun açıklaması 2000 karakter den fazla olamaz');
		document.form1.aciklama.focus();
		return false;

	}else if(document.form1.code.value == ''){
		alert('Lütfen güvenlik kodunu yazınız');
		document.form1.code.focus();
		return false;

	}else if(!confirm('Dikkat!!\nForm kontrolü şimdilik tamamlandı. Açıklamanızı bize iletebilirsiniz.\nFakat Gönder demeden önce açıklamanızı İptal veya Vazgeç deyip mouse ile seçip kopyalayınız. Formda hata olursa tekrar yazmak durumunda kalmazsınız.\nİşleme devam etmek için Tamam butonunu kullanınız')){
		document.form1.aciklama.select();
		return false;
	}
}
function textCounter(field, countfield, maxlimit) {
  if (field.value.length > maxlimit)
      {field.value = field.value.substring(0, maxlimit);}
      else
      {countfield.value = maxlimit - field.value.length;}
  }

function form_kontrol() {
	if (document.form1.isim.value == ""){
		alert ("İsim giriniz");
		document.form1.isim.focus();
		return false;
	}

	if (document.form1.mail.value == ""){
		alert ("Email giriniz?");
		document.form1.mail.focus();
		return false;
	}
	
	var epostasi = document.form1.mail.value
	if ( (epostasi.indexOf ('@',0) == -1) || (epostasi.indexOf('.',0) == -1) || (epostasi.indexOf(' ',0) != -1) || (epostasi.length<6) ){
		alert ("Email de sorun var. Kontrol ediniz");
		document.form1.mail.focus();
		return false;
	}

	if (document.form1.sehir.selectedIndex==0){
		alert ('Şehir seçiniz?')
		document.form1.sehir.focus()
		return false
	}

	if (document.form1.konu.selectedIndex==0){
		alert ('Konu seçiniz?')
		document.form1.konu.focus()
		return false
	}

	if (document.form1.mesaj.value == ""){
		alert ("İletişim için mesaj giriniz");
		document.form1.mesaj.focus();
		return false;
	}

	if (document.form1.code.value == ""){
		alert ("Güvenlik kodu giriniz");
		document.form1.code.focus();
		return false;
	}
}
function maillist_kontrol(){
	if (document.form2.mail.value == ""){
		alert ("E-mail adresi girmelisiniz?");
		document.form2.mail.focus();
		return false;
	}
	
	var epostasi = document.form2.mail.value
	if ( (epostasi.indexOf ('@',0) == -1) || (epostasi.indexOf('.',0) == -1) || (epostasi.indexOf(' ',0) != -1) || (epostasi.length<6) ){
		alert ("E-mail adresin de sorun var. Kontrol ediniz");
		document.form2.mail.focus();
		return false;
	}	
}
function ackapa(id){
	var e = document.getElementById(id).style;
	if(e.display == 'none'){
		e.display = 'block';
	}else if(e.display == 'block'){
		e.display = 'none';
	}else{
		e.display = 'block';
	}
}
function OyunAra(){
	ackapa('oyun_arama');
	if(document.getElementById('oyun_arama').style.display == 'block') document.header_arama.etiket.focus();
}
function gosterme(id){
	document.getElementById(id).style.display = 'none';
}
function erenetoyun(u,d,m,o,h){
	s='swf';
	if(h==''){ ds = u+'/'+d+'/'+s+'/'+o; }else{ ds=o; }
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="100%" height="438" id="WMPlay" name="WMPlay">');
	document.write('<param name="movie" value="'+ds+'">');
	document.write('<param name="quality" value="High">');
	document.write('<param name="menu" value="0">');
	document.write('<param name="_cx" value="7673">');
	document.write('<param name="_cy" value="5583">');
	document.write('<param name="FlashVars" value>');
	document.write('<param name="Src" value="'+ds+'">');
	document.write('<param name="WMode" value="Window">');
	document.write('<param name="Play" value="-1">');
	document.write('<param name="Loop" value="-1">');
	document.write('<param name="SAlign" value>');
	document.write('<param name="Base" value>');
	document.write('<param name="allowNetworking" value="internal">');
	document.write('<param name="AllowScriptAccess" value="always">');
	document.write('<param name="Scale" value="ShowAll">');
	document.write('<param name="DeviceFont" value="0">');
	document.write('<param name="EmbedMovie" value="0">');
	document.write('<param name="BGColor" value>');
	document.write('<param name="SWRemote" value>');
	document.write('<param name="MovieData" value>');
	document.write('<param name="SeamlessTabbing" value="1">');
	document.write('<embed src="'+ds+'" width="100%" height="438" allowNetworking="internal" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"><\/embed><\/object>');
}
function erenetoyun2(u,d,m,o,h){
	s='swf';
	if(h==''){ ds = u+'/'+d+'/'+s+'/'+o; }else{ ds=o; }
	document.write('<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0" id="blackout26" width="598" height="460">');
	document.write('<param name="src" value="'+ds+'">');
	document.write('<param name="sw1" value="'+ds+'">');
	document.write('<param name="swStretchStyle" value="fill">');
	document.write('<param name="swRemote" value="swSaveEnabled=\'true\' swVolume=\'true\' swRestart=\'true\' swPausePlay=\'true\' swFastForward=\'true\' swContextMenu=\'true\'">');
	document.write('<param name="bgColor" value="#000000">');
	document.write('<embed src="'+ds+'" sw1="'+ds+'" bgColor="#000000" width="598" height="460" swRemote=" swSaveEnabled=\'true\' swVolume=\'true\' swRestart=\'true\' swPausePlay=\'true\' swFastForward=\'true\' swContextMenu=\'true\'" swStretchStyle="fill" type="application/x-director" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/"><\/embed><\/object>');
}
//Cookie Reklam
function writeCookie(name, value, days){
    if(days==null || days=="")days=365;
    var d=new Date();
    d.setTime(d.getTime()+(days*24*60*60*1000));
    var expires="; expires="+d.toGMTString();
    document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name){
    var c=document.cookie ;
    if (c.indexOf(name)!=-1){
        pos1=c.indexOf("=", c.indexOf(name))+1;
        pos2=c.indexOf(";",pos1);
		if(pos2==-1) pos2=c.length;;
        data=c.substring(pos1,pos2);
        return data;
    }
}
function r_kapat(){
	var r = document.getElementById('dikey_reklam_alani');
	var rg = document.getElementById('dikey_reklam_alani_g');
	if(r.style.display == "block"){
		r.style.display="none";
		rg.style.display="block";
		writeCookie('kayan_reklam', 0, 1);
	}else{
		r.style.display="block";
		rg.style.display="none";
		writeCookie('kayan_reklam', 1, 1);
	}
}
function r_bak(){
	var r = document.getElementById('dikey_reklam_alani');
	var rg = document.getElementById('dikey_reklam_alani_g');
	if(readCookie('kayan_reklam') == 0 ){
		r.style.display = 'none';
		rg.style.display = 'block';
	}else{
		r.style.display = 'block';
		rg.style.display = 'none';
	}
}
//Cookie Reklam
//Yorum
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
{field.value = field.value.substring(0, maxlimit);}
else
{countfield.value = maxlimit - field.value.length;}
}

var say1=0
var say2=2
function say(){
say1++
say2--
if(say2 > 0){
	document.getElementById('similey_sinir').innerHTML = "<strong>"+say2+"<\/strong> similey hakkınız kaldı.";
}else{
 	 document.getElementById('similey_sinir').innerHTML = "İkiden fazla similey kullanamazsınız. İkiden fazla similey kullanırsanız yorumunuz <span style=\"color:#FF3300;\"><strong>kabul edilmez<\/strong>.<\/span>";
}
if(say1 >= 2){
document.getElementById('similey').style.display = 'none';
}
}
function mesaja_ekle(simi){
		say();
		document.yorumlar.yorum.value += " "+simi+" ";
		document.yorumlar.yorum.focus();
}
function ForumKodu(Kod, Metin) {
	if (Kod != "") {
		KodEkle = prompt(Metin,"");
		if ((KodEkle != null) && (KodEkle != "")){
			document.yorumlar.yorum.value += "[" + Kod + "]" + KodEkle + "[/"+ Kod + "] ";
		}
	}
	document.yorumlar.yorum.focus();
}
//Yorum