﻿function checkfirst(input){ 
var found = false; 
var str="0123456789"; 
for (var i = 0;i<str.length;i++){ if (input.charAt(0) == str.charAt(i)) 
found = true; } 
return found; } 
function checksecond(input){ var found = false; var str="/*+!%&()=?<>£#$½~¨@,;:.€é "; str = str + "'"; str = str + '"'; for (var i = 0;i<input.length;i++) for (var j = 0;j<str.length;j++) if (input.charAt(i) == str.charAt(j)) found = true; return found; } function validateForm(nick,kanalim) { 
if (nick=="" || nick=="Rumuz Giriniz") alert("Odaya girmek için rumuz girmelisiniz"); 
else if (checkfirst(nick)) alert("Hatali rumuz girdiniz.\nRumuz rakamla baslayamaz"); 
else if (nick.charCodeAt(0) == 45) alert("Hatali rumuz girdiniz.\nRumuz \" - \" isareti ile baslayamaz"); 
else if (checksecond(nick)) alert("Hatali rumuz girdiniz.\nLütfen bosluk ve Türkçe karakter kullanmayiniz"); 
else{ document.SohbetForm.kanalim.value = kanalim; document.SohbetForm.submit(); } } 
function check(input){ 
var found = false; 
var str1="0123456789-";
for (var i = 0;i<str1.length;i++){ 
if (input.charAt(0) == str1.charAt(i)) found = true; } 
if (!found){ var str2="öÖçÇiIsSgGüÜ/*+!%&()=?<>£#$½~¨@,;:.€é "; str2 = str2 + "'"; str2 = str2 + '"'; 
for (var i = 0;i<input.length;i++) for (var j = 0;j<str2.length;j++) if (input.charAt(i) == str2.charAt(j)) found = true; } return found; } 
function checkforOda(input){ var found = false; var str="öÖçÇiIsSgGüÜ "; 
for (var i = 0;i<input.length;i++) 
for (var j = 0;j<str.length;j++) if (input.charAt(i) == str.charAt(j)) found = true; return found; } 
function ignore(){ if (self.document.cr.getSelectedUser()=="") 
alert("Özel sohbet etmek istemediginiz kullaniciyi fareyle\nisaretledikten sonra Engelle butonuna basmalisiniz"); 
else self.document.cr.output("/silence "+self.document.cr.getSelectedUser()); } 
function changeNick(){ nick=prompt("Yeni rumuz giriniz: ( Türkçe karakter kulanmayiniz )\n* Genel odalar içindeyken rumuz degistiremezsiniz",""); 
if(nick && nick!=null && nick!="null" && nick!=""){ if (check(nick)) { 
alert("Hatali rumuz girdiniz.\nLütfen bosluk ve Türkçe karakter kullanmayiniz"); } 
else{ self.document.cr.nick(nick); } } } function openRoom(name,topic){ if (name=="") { 
alert("Oda ismini girmelisiniz"); } 
else if (checkforOda(name)) {
	alert("Oda ismini hatali girdiniz.\nLütfen bosluk ve Türkçe karakter kullanmayiniz"); } 
	else{ self.document.cr.room("#"+name); self.document.cr.output("/topic #"+name+" "+topic); } } function oda(){ var popupWindow = null; popupWindow=window.open("openroom/","popupWindow","width=225,height=120,status=no,toolbar=no,menubar=no,directories=no,location=no,scrollbars=no,resizable=no,titlebar=yes,left=350,top=250,screenX=300,screenY=250,alwaysRaised=yes,z-lock=yes"); 
	if (popupWindow != null) { if (popupWindow.opener == null) { popupWindow.opener = self; } popupWindow.focus(); } } 
function odamynet(){ var popupWindowsohbetler = null; popupWindowsohbetler=window.open("/popuproom/","popupWindowsohbetler","width=420,height=300,status=no,toolbar=no,menubar=no,directories=no,location=no,scrollbars=yes,resizable=no,titlebar=yes,left=350,top=250,screenX=300,screenY=250,alwaysRaised=yes,z-lock=yes"); 
if (popupWindowsohbetler != null) {
	if (popupWindowsohbetler.opener == null) { popupWindowsohbetler.opener = self; } popupWindowsohbetler.focus(); } } 
function odaozel(){ var popupWindowsohbetler=null; popupWindowsohbetler=window.open("/popupprivateroom/?nodenumber=0","popupWindowsohbetler","width=420,height=300,status=no,toolbar=no,menubar=no,directories=no,location=no,scrollbars=yes,resizable=no,titlebar=yes,left=350,top=250,screenX=300,screenY=250,alwaysRaised=yes,z-lock=yes"); 
if (popupWindowsohbetler != null) { if (popupWindowsohbetler.opener == null) { popupWindowsohbetler.opener = self; } popupWindowsohbetler.focus(); } } 
function joinMynetOda(roomName){ document.cr.output("/join #"+roomName); } function popup(url){ var yenipencere = null; yenipencere=window.open(url,'yenipencere','width=550,height=300,status=no,toolbar=no,menubar=no,directories=no,location=no,scrollbars=yes,resizable=yes,alwaysRaised=yes,screenX=20,screenY=5,titlebar=yes,z-lock=yes,left=20,top=130'); yenipencere.location.href=url; if (yenipencere != null) { 
if (yenipencere.opener == null){ yenipencere.opener = self; } yenipencere.focus(); } } 
function changeAvatar(avatar){ document.cr.output('/set ' + document.cr.nick() + ' avatar ' + avatar); } 
function selectActions(s){ if(s != ""){ if(s.substring(0,2) == "%u"){ 
if(document.cr.getSelectedUser() != "") document.cr.output('/ACTION ' + document.cr.getSelectedUser() + s.substring(2));
else alert("Lütfen önce birini seçiniz"); } 
else document.cr.output('/ACTION ' + s ); } document.cr.insert(''); } function selectSounds(s){ if(s != "") 
document.cr.output('/SOUND ' + s );
document.cr.insert(''); } function selectPics(s){ if(s != "") 
document.cr.insert(String.fromCharCode(5) + s + String.fromCharCode(5)); }


		$(document).ready(function()
		{
			$("#genel").click(function()				
			{
				
				var checked_status = this.checked;
				$("input[class^='genel']").each(function()
				{
					this.checked = checked_status;
				});
			});		
			$("#oyun").click(function()				
			{
				var checked_status = this.checked;
				$("input[class^='oyun']").each(function()
				{
					this.checked = checked_status;
				});
			});
			$("#dunya").click(function()				
			{
				var checked_status = this.checked;
				$("input[class^='dunya']").each(function()
				{
					this.checked = checked_status;
				});
			});
			$("#iliski").click(function()				
			{
				var checked_status = this.checked;
				$("input[class^='iliski']").each(function()
				{
					this.checked = checked_status;
				});
			});				
		});
		

