﻿function hucre_boya(SutunIndexi)
{
    document.getElementById('td0101').style.backgroundColor = '#dcdcdc';
    document.getElementById('td0201').style.backgroundColor = '#dcdcdc';
    document.getElementById('td0102').style.backgroundColor = '#ffffff';
    document.getElementById('td0202').style.backgroundColor = '#ffffff';
    var huc1 = 'td' + SutunIndexi + '01';
    var huc2 = 'td' + SutunIndexi + '02';
    document.getElementById(huc1).style.backgroundColor = '#a9a9a9';
    document.getElementById(huc2).style.backgroundColor = '#a9a9a9';
    
    //if (SutunIndexi == '01') { open_url("liste_sa.aspx", "div_masa"); }
    //if (SutunIndexi == '02') { open_url("acilan_kutu.aspx?tur=ilce&kod=mahalle", "div_masa"); }
}

function listele_sa()
{
    var adi = document.getElementById("txt_adi").value;
    var soy = document.getElementById("txt_soyadi").value;
    var url = "liste_sa.aspx?adi=" + adi + "&soyadi=" + soy;
    open_url2(url, "div_liste");
}

function secim_degisti(Sender,AltTur)
{
    var div = "div_" + Sender;
    var url = "acilan_kutu.aspx?tur=" + Sender + "&kod=" + AltTur;
    open_url2(url, div);
}

var xmlhttp=false;
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 	try {
 		 xmlhttp = new XMLHttpRequest();
 	} catch (e) {
 		 xmlhttp=false;
 	}
}

/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
if (!xmlhttp){
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
}
@end @*/

function nesneyarat() {
    var nesne;
    var tarayici = navigator.appName;
    if(tarayici == "Microsoft Internet Explorer"){
        nesne = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        nesne = new XMLHttpRequest();
    }
    return nesne;
}
 
var http = nesneyarat();
 
function islemkutu2() {
    var adi = document.yorumekle.adi.value;
	var soyadi = document.yorumekle.soyadi.value;
	var email = document.yorumekle.email.value;
	var yorumu = document.yorumekle.yorumu.value;
	var haberid = document.yorumekle.haberid.value;
    http.open('get', 'yorum2.php?adi=' + adi + '&soyadi=' + soyadi + '&email=' + email + '&yorumu=' + yorumu + '&haberid=' + haberid);
    http.onreadystatechange = cevapFonksiyonu2;
    http.send(null);
}

function islemkutu3() {
    var adimsoyadim = document.haberigonder.adimsoyadim.value;
	var arkadaseposta = document.haberigonder.arkadaseposta.value;
	var arkadasmesaj = document.haberigonder.arkadasmesaj.value;
	var haberid = document.haberigonder.haberid.value;
	var kendieposta = document.haberigonder.kendieposta.value;
	var s = document.haberigonder.s.value;
    http.open('get', 'yorum_haberigonder.php?adimsoyadim=' + adimsoyadim + '&arkadaseposta=' + arkadaseposta + '&arkadasmesaj=' + arkadasmesaj + '&haberid=' + haberid + '&kendieposta=' + kendieposta + '&s=' + s);
    http.onreadystatechange = cevapFonksiyonu3;
    http.send(null);
}
 
function cevapFonksiyonu2() {
    if(http.readyState == 4){
        document.getElementById('yorumdiv').innerHTML = http.responseText;
    }
}

function cevapFonksiyonu3() {
    if(http.readyState == 4){
        document.getElementById('yorumdiv').innerHTML = http.responseText;
    }
}




if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

/* Ultimater's edited version of:
   http://javascript.internet.com/ajax/ajax-navigation.html */

var please_wait = "<div align=center class=txtcss><br><br><img src=indicator_medium.gif width=32 height=32><br><br>Lütfen Bekleyiniz...</div>"
var please_wait2 = "<img src=images/indicator_medium.gif width=32 height=32>"


function open_url(url, targetId) {
  if(!xmlhttp)return false;
    var e=document.getElementById(targetId);if(!e)return false;
    //if(please_wait)e.innerHTML = please_wait;
    xmlhttp.open("GET", url, true);
    xmlhttp.onreadystatechange = function() { response(url, e); }
    if(xmlhttp.readyState == 1)e.innerHTML = please_wait2;
    try{
      xmlhttp.send(null);
    }catch(l){
    while(e.firstChild)e.removeChild(e.firstChild);//e.innerHTML="" the standard way
    e.appendChild(document.createTextNode("request failed"));
  }
}

function open_url2(url, targetId) {
  if(!xmlhttp)return false;   
    var s=document.getElementById(targetId);if(!s)return false;    
    xmlhttp.open("GET", url, true);    
    xmlhttp.onreadystatechange = function() { response(url, s); }
    if(xmlhttp.readyState == 1) { s.appendChild(document.createTextNode("Lütfen Bekleyin..")); }
    //if(please_wait2) s.innerHTML = please_wait2;    
    try{
      xmlhttp.send(null);      
    }catch(l){
    while(s.firstChild)s.removeChild(s.firstChild);//s.innerHTML="" the standard way
    s.appendChild(document.createTextNode("request failed"));
  }
  //
}

function response(url, e) {
  if(xmlhttp.readyState != 4)return;
    var tmp= (xmlhttp.status == 200 || xmlhttp.status == 0) ? xmlhttp.responseText : "Bir problem ile karşılaşıldı. Hata kodu: " + xmlhttp.status+" "+xmlhttp.statusText;
    var d=document.createElement("div");
    d.innerHTML=tmp;
    setTimeout(function(){
      while(e.firstChild)e.removeChild(e.firstChild);//e.innerHTML="" the standard way
      e.appendChild(d);
    },10)
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
