function gax() {
    var r = false;
    if (window.XMLHttpRequest) { // mozilla, safari, etc.
        r = new XMLHttpRequest();
        if (r.overrideMimeType) {
            r.overrideMimeType('text/html');
        }
    } else if (window.ActiveXObject) { // ie
        try {
            r = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                r = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) { }
        }
    }
    return r;
}

function G(i) {
    return document.getElementById(i);
}

function ctims(id) {
    if (typeof (tms[id]) == 'object') {
        if (tms[id].length) {
            clearTimeout(tms[id][0]);
            clearTimeout(tms[id][1]);
        }
    }
    return new Array();
}

function mwa(v, id, c) {
    // wait for the response a total of 45 seconds or cancel
    if (c == 4) {
        hreq = false;
        clearTimeout(tms[id][0]);
        tms[id][1] = setTimeout(
      function(v) {
          return function() {
              v.innerHTML = '';
          };
      } (v), 8000);
        v.innerHTML = 'olmadi galiba. tekrar deneyin.';
        return;
    }
    tms[id][1] = setTimeout(
    function(v) {
        return function() {
            v.innerHTML = 'biraz daha sürecek #' + (++c);
            mwa(v, id, c);
        };
    } (v), 15000);
}


function mpr(id, w, c) {
    var p = '';
    if (hreq) return;
    var h = gax();
    if (!h) { alert('oyunuzu gönderemiyoruz çünkü web tarayiciniz bir seyleri desteklemiyor.'); return }
    hreq = h;
    var v = G('vst' + id); if (!v) return;
    tms[id] = ctims(id);
    hreq.open('POST', 'oyajax.php?id=' + id + '&oy=' + w + '', true);
    hreq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    hreq.onreadystatechange = function() {
        if (hreq.readyState == 4) {
            if (hreq.status == 200) {
                v.innerHTML = c ? 'tamam geçti korkma.' : 'oyunuz kaydedildi. (<a href="javascript:mpr(' + id + ',-2,1)">geri al</a>)';
            }
			else if (hreq.status == 404) {
                v.innerHTML = 'bu entry\'i daha önce oylamissiniz. (<a href="javascript:mpr(' + id + ',-2,1)">geri al</a>)';
            }
			else {
                v.innerHTML = 'bir sebepten oyunuz gidemedi';
            }
            hreq = false;
            clearTimeout(tms[id][1]);
            tms[id][0] = setTimeout(
        function(v) {
            return function() {
                v.innerHTML = '';
            };
        } (v), 15000);
        }
    }
    mwa(v, id, 1);
    v.innerHTML = 'oluyor';
    hreq.send(p);
}


function popup( sname,kalinlik,yukseklik,isim ) {



        window.open(sname,isim,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=" + kalinlik+ ",height=" + yukseklik+"resizeable=0");



}



function at(sel)

{

        frames['stmain'].location.href = sel;

}



function dis(f)

{

        if(document.getElementById)

        {

                var obj = document.getElementById(f);

                obj.disabled = true;



        }

        else if (document.all)

        {

                var obj = document.all(f);

                obj.disabled = true;

        }

}



function kontrol()



{



        var hata = '';



        var dd = document.getElementById;



        var i = dd('e').value;



        var j = dd('f').value;



        var ads = dd('a').value;



        var email = dd('b').value;



        var kadi = dd('d').value;



        var il = dd('il').value;





        if(i != j)



        {



                hata = 'Sifreler birbirini tutmuyor. Kontrol edip, tekrar deneyin';



                alert(hata);



        }

                if((i == '') || (j == '') || (ads == '') || (email == '') || (kadi == '') || (il == ''))

        {



                hata = 'Asagidaki hucreler bos birakilamaz : \n - Sifre \n - Adi Soyad \n - E-Mail \n - Kullanici Adi \n - Sehir ';

                alert(hata);

        }



        document.hedeValue = (hata == '');

}



function jm(targ,selObj,restore)

{ //v3.0



  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

  if (restore) selObj.selectedIndex=0;



}



function jump(selObj,restore){



var url = selObj.options[selObj.selectedIndex].value;



if (url) 

{

	remote = window.open(url, 'other');



	if (remote != null) 

	{

		if (remote.opener == null)



		remote.opener = self;

	}



}



if (restore) selObj.selectedIndex=0;



}



function changeStyle(tagName,styleName)



{

                tagName.className = styleName;

}



function goUrl(url,frm)



{

                open(url,frm);

}



function bkzver(a)

{

    if(document.selection)



    {

            var sel = document.selection.createRange();

        if(sel.parentElement() == document.getElementById("aciklama"))



        {

           var b = a;

            sel.text = "("+b+": "+sel.text+")";

            sel.select();



        return false;

        }

    }



    else

    {

        var nedir="";

        var b="";



        if(a == 'url') b = 'adresi';



        else b = 'kelimeyi';

        nedir = prompt(a+" verilecek "+b+" giriniz","");



        if(nedir != "" && nedir != null)

        {

                document.getElementById("aciklama").value += "("+a+": "+nedir+")";

                document.getElementById("aciklama").focus();

                return false;

        }

        else return false;

    }

}



function sec()

{

	for (var i=0;i<document.mesajform.elements.length;i++)

	{

	        var e=document.mesajform.elements[i];



	        if ((e.name != 'allbox') && (e.type=='checkbox'))

	        {

	                if (e.checked != true)

	                {

	                        e.checked = true;

	                }



	                else

	                {

	                        e.checked = false;

	                }

	        }

	}

}



var dlara=null;

var dara=null;



function brcont()

{

	if (document.getElementById)

	{

			dlara = document.getElementById("lara");

			dara = document.getElementById("ara");

	}

	else if (document.all)

	{

			dlara = document.all("lara");

			dara = document.all("ara");

	}

	else if (document.layers)

	{

	        dlara = document.layers["lara"];

	        dara = document.layers["ara"];

	}

}



function goster()

{

        brcont();

        dlara.style.visibility = 'visible';

        dara.style.visibility = 'hidden';

}



function gizle()

{

        brcont();

        dlara.style.visibility = 'hidden';

        dara.style.visibility = 'visible';

}



function h(obj,drm)

{

                if(drm == "goster")

                        document.getElementById(obj).style.visibility = 'visible';

                else

                        document.getElementById(obj).style.visibility = 'hidden';

}



function gG(obj) 

{

        if (document.getElementById(obj).style.display == 'block')

                document.getElementById(obj).style.display = 'none';

        else

                document.getElementById(obj).style.display = 'block';

}



var id=0,bid=0,lo=null,is="",bis="",se="",pr='<td onmousedown="md(this)" onmouseup="bn(this)" onmouseover="ov(this)" onmouseout="bn(this)" class="but" onclick=';



function ov(o)

{

  o.id="butOver";

}



function md(o)

{

  o.id="butDown";

}



function bn(o)

{

  o.id="";

}



function hr(o)

{

        if(o)o.click();

}



function b(t,u,c,tt)

{

  is="a"+(id++);

  document.write(pr+'"hr('+is+')"><a id='+is);

  if(tt)document.write(" title='"+tt+"'");

  document.write(' target='+t+' href="'+u+'">&nbsp;'+c+'&nbsp;</a></td>');

}



function bjs(t,js,c,tt)

{

  document.write(pr+'"'+js+'"><a href="#" onclick="'+js+'">&nbsp;'+c+'&nbsp;</a></td>');

}



function b2(t,u,c,s)

{

  is="a"+(id++);

  document.write(pr+'"hr('+is+')" colspan='+s+'><a id='+is+' target='+t+' href="'+u+'">&nbsp;'+c+'&nbsp;</a></td>');

}



function s(f,c)

{

  document.write(pr+'"document.getElementById(\''+f+'\').submit()" style="cursor:hand">&nbsp;&nbsp;'+c+'&nbsp;</td>');

}



function a(u,c,t)

{

  is="a"+(id++);

  document.write(pr+'"hr('+is+')" title="'+t+'"><a id='+is+' href="'+u+'" class=icon>&nbsp;'+c+'&nbsp;</a></td>');

}



function p(u,c,t,m)

{

  is="a"+(id++);

  document.write(pr+'"hr('+is+')" title="'+t+'"><a id='+is+' onclick="return confirm(\''+m+'\')" href="'+u+'" class=icon>&nbsp;'+c+'&nbsp;</a></td>');

}





function ct()

{

  tc=document.getElementById('ctf');

  if(tc)

  {

    var i=document.getElementsByTagName("input")

    var c=0;

    for(j=0;j<i.length;j++){if(i[j].type=="checkbox"){if(i[j].checked)c++;}}

    tc.style.display=c>0?'inline':'none';

  }

}



function ci(i)

{

  ic=document.getElementById('c'+i);

  with(ic)

  {

    style.display=style.display=='none'?'inline':'none';

    checked=checked?false:true;

    ct();

  }

}

function e(f,i,an, b)

{

        with(document)

        {

		  var faceurl = encodeURIComponent('http://ekosozluk.org/show.php?eid=' + i);

          write('<div align=right style="width:100%"><table id=m'+i+' style="visibility:hidden"><tr><td class=ei><a name="cid'+i+'"></a><a href="sozluk.php?process=eid&eid='+i+'">( #'+i+' )</a></td>');

				  write('<td><a href="javascript:od(\'http://www.facebook.com/sharer.php?u=' + faceurl + '&t=' + b + '\', \'600\', \'400\')"><img src="images/fb-icon.png"></a></td>');

				  write('<td><a href="http://twitter.com/home?status=EkoSözlükten ' + faceurl +'" tittle="twitter\'ına yaz!" target="_blank"><img src="images/tw-icon.png"></a></td>');

                  document.write('<td>&nbsp;</td>');

				  a("javascript:od('sozluk.php?process=arti&id="+i+"')","+","+");

                  a("javascript:od('sozluk.php?process=eksi&id="+i+"');","-","+");

                  document.write('<td>&nbsp;</td>');

                  a("javascript:od('sozluk.php?process=popupmsg&islem=yenimsj.popup&gkime="+an+"&eid="+i+"','400','250');","msg","mesaj");

                  a("javascript:od('sozluk.php?process=ben&kim="+an+"','350','400')","?","kim?");





		  document.write('<td>&nbsp;</td>');

          write('</tr></table></div>');

          var d=getElementById('d'+i);

          var m="document.getElementById('m"+i+"').style.visibility=";

          d.onmouseover=new Function(m+"'visible'");

          d.onmouseout=new Function(m+"'hidden'");

        }

}

function e_mod(f,i,an,sr,b)

{

        with(document)

        {

		  var faceurl = encodeURIComponent('http://www.kotusozluk.com/show.php?eid=' + i);

          write('<div align=right style="width:100%"><table id=m'+i+' style="visibility:hidden"><tr><td class=ei><a name="cid'+i+'"></a><a href="sozluk.php?process=eid&eid='+i+'">( #'+i+' )</a></td>');

				  write('<td><a href="javascript:od(\'http://www.facebook.com/sharer.php?u=' + faceurl + '&t=' + b + '\', \'600\', \'400\')"><img src="images/fb-icon.png"></a></td>');

				  write('<td><a href="http://twitter.com/home?status=KötüSözlükten ' + faceurl +'" tittle="twitter\'ına yaz!" target="_blank"><img src="images/tw-icon.png"></a></td>');

				  a("javascript:mpr(" + i + ",1)", ":)", "sükela!");

                  a("javascript:od('sozluk.php?process=eksi&id="+i+"');","-","+");

                  document.write('<td>&nbsp;</td>');

                  a("javascript:od('sozluk.php?process=popupmsg&islem=yenimsj.popup&gkime="+an+"&eid="+i+"','400','250');","msg","mesaj");

			a("javascript:location.href='sozluk.php?process=eduzenle&id="+i+"&sr="+sr+"';","düzenle","düzenle");

            a("javascript:od('sozluk.php?process=esil&id="+i+"&sr="+sr+"','350','150')","sil","sil!");

			a("javascript:od('sozluk.php?process=ben&kim="+an+"','350','400')","?","kim?");



		  document.write('<td>&nbsp;</td>');



          write('</tr></table></div>');

          var d=getElementById('d'+i);

          var m="document.getElementById('m"+i+"').style.visibility=";

          d.onmouseover=new Function(m+"'visible'");

          d.onmouseout=new Function(m+"'hidden'");

        }

}

function e_ben(f,i,an,sr,b)

{

        with(document)

        {

		  var faceurl = encodeURIComponent('http://www.kotusozluk.com/show.php?eid=' + i);

          write('<div align=right style="width:100%"><table id=m'+i+' style="visibility:hidden"><tr><td class=ei><a name="cid'+i+'"></a><a href="sozluk.php?process=eid&eid='+i+'">( #'+i+' )</a></td>');

                  document.write('<td>&nbsp;</td>');

				  write('<td><a href="javascript:od(\'http://www.facebook.com/sharer.php?u=' + faceurl + '&t=' + b + '\', \'600\', \'400\')"><img src="images/fb-icon.png"></a></td>');

				  write('<td><a href="http://twitter.com/home?status=KötüSözlükten ' + faceurl +'" tittle="twitter\'ına yaz!" target="_blank"><img src="images/tw-icon.png"></a></td>');

			a("javascript:location.href='sozluk.php?process=eduzenle&id="+i+"&sr="+sr+"';","düzenle","düzenle");

		  a("javascript:od('sozluk.php?process=esil&id="+i+"&sr="+sr+"','250','150')","sil","sil!");

		  a("javascript:od('sozluk.php?process=ben&kim="+an+"','400','400')","?","kim?");

          write('</tr></table></div>');

          var d=getElementById('d'+i);

          var m="document.getElementById('m"+i+"').style.visibility=";

          d.onmouseover=new Function(m+"'visible'");

          d.onmouseout=new Function(m+"'hidden'");

        }

}

function zyrt(f,i,an,b)

{

        with(document)

        {

		  var faceurl = encodeURIComponent('http://www.kotusozluk.com/show.php?eid=' + i);

          write('<div align=right style="width:100%"><table id=m'+i+' style="visibility:hidden"><tr><td class=ei><a name="cid'+i+'"></a><a href="sozluk.php?process=eid&eid='+i+'">( #'+i+' )</a></td>');

                  document.write('<td>&nbsp;</td>');

		  write('<td><a href="javascript:od(\'http://www.facebook.com/sharer.php?u=' + faceurl + '&t=' + b + '\', \'600\', \'400\')"><img src="images/fb-icon.png"></a></td>');

		  write('<td><a href="http://twitter.com/home?status=KötüSözlükten ' + faceurl +'" tittle="twitter\'ına yaz!" target="_blank"><img src="images/tw-icon.png"></a></td>');	 

          write('</tr></table></div>');

          var d=getElementById('d'+i);

          var m="document.getElementById('m"+i+"').style.visibility=";

          d.onmouseover=new Function(m+"'visible'");

          d.onmouseout=new Function(m+"'hidden'");

        }

}



function dd(i)

{

        od('sozluk.php?process=privmsg&islem=yenimsj&gkime='+i);

        document.getElementById('d'+i).style.visibility='hidden';

}





function tr(i)

{

  document.write('<tr style="cursor:default" onmouseover="document.getElementById("m'+i+'").style.visibility=\'visible\'" onmouseout="style.borderWidth=\'0\';document.getElementById("m'+i+'").style.visibility=\'hidden\'">');

}



function od(u,w,h,x,y)

{

  if(!w)w=320;if(!h)h=200;if(!x)x=(screen.width-w)/2;if(!y)y=(screen.height-h)/2;

  var w=window.open(u,"_blank","resizable=yes,scrollbars=yes,top="+x.toString()+",left="+y.toString()+",width="+w.toString()+",height="+h.toString());

  w.focus();

}



function odf(u,w,h,x,y)

{

        od(u,w,h,x,y);return false;

}



function au(d)

{

  document.write('<tr><td nowrap align=right class=aul>(<a class=aul href="?t='+an+'">'+an+'</a>, '+d+')</td></tr>');

}



function sets(doc,fn)

{

  if(doc) {

    var len = doc.styleSheets.length;

    if(doc.createStyleSheet)

    {

            if (fn=="") {

              if(len>1) doc.styleSheets[1].href="";

            } else {

              if (len<2) doc.createStyleSheet(fn); else doc.styleSheets[1].href=fn;

            }

    }

    else

    {

      doc.location.reload();

    }

  }

}



function bp(o,m,c)

{

        var oo;

        for(var n=1;n<=m;n++) {

                oo = document.createElement("OPTION");

                o.options.add(oo);

                oo.innerText = n;

                oo.Value = n;

                oo.selected = n==c;

        }

}



var inpp=false,o=null,maxs=11,lx=20,w=213,bi=false,sint=new Array(20,23,30,43,61,82,107,135,166,197,213);



function os()

{

  if((o=document.getElementById('a'))!=null) with(o.style) with(document.body)

  {

          bi=n<=0;left=scrollLeft+sint[bi?0:(maxs-1)]+(clientWidth-233)+2;

          if(o.clientHeight+44<clientHeight) top=scrollTop+44;

  }

}



function ca()

{

        with(document.body) with(o.style) {

                left=(scrollLeft+sint[n]+(clientWidth-233))+"px";width=((w+lx)-sint[n])+"px";

                if(bi){if(++n<maxs)setTimeout("ca()",20); else {inpp=false;document.body.focus();document.getElementById('amain').disabled=true}}

                else{if(n-->0)setTimeout("ca()",20); else {inpp=false;document.getElementById('amain').disabled=false;}}

  }

}



function pp()

{

        if(!inpp) { inpp=true;o=document.getElementById('a');bi=n<=0;n=bi?0:(maxs-1);ca(); }

}



function tgb(i)

{

  t=document.getElementById('t'+i);

  m=document.getElementById('m'+i);

  b=document.getElementById('b'+i);

  if(t&&m&&b) {

    for(var j=0;j<bid;j++) {

      if(i==("b"+j))continue;

      document.getElementById('bb'+j).style.display='inline';

      document.getElementById('tb'+j).innerHTML='&rsaquo;&rsaquo;'+'&nbsp;';

      document.getElementById('mb'+j).style.display='none';

    }

    t.innerHTML=m.style.display=='none'?'&lsaquo;&lsaquo;':'&rsaquo;&rsaquo;'+'&nbsp;';

    m.style.display=m.style.display=='none'?'inline':'none';

    b.style.display=b.style.display=='none'?'inline':'none';

  }

}



function obba(n,t)

{

  bis="b"+(bid++);

  document.write('<a style="vertical-align:middle;" id=t'+bis+' href="#" onclick="tgb(\''+bis+'\');">&rsaquo;&rsaquo;&nbsp;</a>'+

    '<div id=m'+bis+' style="vertical-align:middle;width:90%;display:none;"><a href="msg.asp?to='+escape(n)+'" onclick="tgb(\''+bis+'\');od(\'msg.asp?to='+escape(n)+'\');return false">&nbsp;/msg</a>'+

    '&nbsp;&middot;<a href="info.asp?n='+escape(n)+'" onclick="tgb(\''+bis+'\');od(\'info.asp?n='+escape(n)+'\',350,420);return false">&nbsp;?</a>'+

    '&nbsp;&middot;<a href="index.asp?a=sr&so=y&f=y&au='+escape(n)+'" target="sozindex" onclick="tgb(\''+bis+'\');top.sozindex.location.href=\'index.asp?a=sr&so=y&f=y&au='+escape(n)+'\'">&nbsp;son</a>'+

    '</div><div id=b'+bis+' style="vertical-align:middle;width:90%;display:inline;"><a href="#" onclick="od(\'msg.asp?to='+escape(n)+'\');return false" id='+bis+'>'+n+'</a></div><br>');

}

function ob(n,t)

{

        t = (15-t)/15.0;

        document.write('<a href="sozluk.php?process=privmsg&islem=yenimsj&kime='+escape(n)+'" onclick="od(\'sozluk.php?process=privmsg&islem=yenimsj&kime='+escape(n)+'\');return false">'+n+'</a><br>');

}



function hen(d,a,b){var k=document.getElementById(d);if(document.selection && !window.opera){var tn=document.selection.createRange();if(tn.parentElement()==k){ tn.text = a+tn.text+b;tn.select();} else alert("önce bakýnýz vermek istediðiniz metni seçiyorsunuz.");}else if(k.selectionStart||k.selectionStart=='0'){var u = k.value;var end = k.selectionEnd;var start = k.selectionStart;k.value = u.substring(0,start)+a+u.substring(start,end)+b+u.substring(end);end += a.length+b.length;k.setSelectionRange(end, end);} else k.value += a+b;k.focus();return true;}





function tac()

{

  var c = document.getElementsByTagName("input");

  for(var i=0;i<c.length;i++)if(c[i].type=="checkbox")c[i].checked=!c[i].checked;

}



function selcnt()

{

  var c = document.getElementsByTagName("input");

  var cnt = 0;

  for(var i=0;i<c.length;i++)if(c[i].type=="checkbox")cnt += c[i].checked?1:0;

  return cnt;

}

/*function ara()

{

  if(top.left)top.left.location.href='sozluk.php?process=search&vampara_baslik='+escape(document.getElementById('q').value);

}

*/

function ara() {

    if (top.left) top.left.location.href = 'sozluk.php?process=search&vampara_baslik=' + G('q').value;

}



function G(i) {

    return document.getElementById(i);

}



function idara()

{

  if(top.main)top.main.location.href='sozluk.php?process=eid&eid='+escape(document.getElementById('q').value);

}

function dab()

{

  var c = document.getElementsByTagName("input");

  for(var i=0;i<c.length;i++)if(c[i].type=="submit"||c[i].type=="button")c[i].disabled=true;

}



