//--GENEL----------------------------------------------
	//---AJAX -----------------------------------------
function GetXmlHttpObject() {
    var objXMLHttp = null
    if (window.XMLHttpRequest) {
        objXMLHttp = new XMLHttpRequest()
    } else if (window.ActiveXObject) {
        try {
            objXMLHttp = new ActiveXObject("Msxml2.XMLHTTP")
        }
        catch (e) {
            try {
                objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP")
            }
            catch (e) { }
        }
    }

    return objXMLHttp
}
	//---DIV EKRAN POZİSYON----------------------------
	var Xcik;
	var Ycik;
	function XPozisyon(degerim) {
		var Soldan = 0;
		if (degerim.offsetParent) {
			while (degerim.offsetParent) {
				Soldan = Soldan + degerim.offsetLeft
				degerim = degerim.offsetParent;
			}
		} else if (degerim.x) {
			Soldan = Soldan + degerim.x;
		}
		return Soldan;
	}
	function YPozisyon(degerim) {
		var Yukaridan = 0;
		if (degerim.offsetParent) {
			while (degerim.offsetParent) {
				Yukaridan = Yukaridan + degerim.offsetTop
				degerim = degerim.offsetParent;
			}
		} else if (degerim.y) {
			Yukaridan = Yukaridan + degerim.y;
		}
		return Yukaridan;
	}
	//---ALFABE KAPAT----------------------------------
//	function AlfabeKapat(e) {
//	    var keynum;
//	    var keychar;
//	    var numcheck;
//	    if (window.event) {
//	        keynum = e.keyCode;
//	    } else if (e.which) {
//	        keynum = e.which;
//	    }
//	    keychar = String.fromCharCode(keynum);
//	    numcheck = /\d/
//	    return numcheck.test(keychar);
	//	}
	function AlfabeKapat(evt) {
	    var charCode = (evt.which) ? evt.which : event.keyCode
	    if (charCode > 31 && (charCode < 48 || charCode > 57))
	        return false;

	    return true;
	}
	
	//---TEXTAREA SINIR--------------------------------
	function TextSinir(tus,obj,boxad,sinir) {
		if (window.event) {
			keynum = tus.keyCode;
		} else if (tus.which) {
			keynum = tus.which;
		}
		if ((keynum == 8) || (keynum == 46)) {
			if (obj.value.length<1) {
				document.getElementById(boxad).value = sinir;
			} else {
				document.getElementById(boxad).value=((sinir-obj.value.length)+1);
			}
		} else {
			if ((obj.value.length+1)<=sinir) {
				document.getElementById(boxad).value=((sinir-obj.value.length)-1);			
			} else {
				obj.value = obj.value.substring(0,(sinir-1));
				document.getElementById(boxad).value = 0;
			}
		}
	}
	//---HABER TICKER----------------------------------
	var HarfSay = 0;
	var HaberSay = 1;
	function HaberTicker() {
	    HaberIcerik = document.getElementById("Haber" + HaberSay).innerHTML;
	    document.getElementById("Haber" + HaberSay).innerHTML = '';
	    document.getElementById("Haber" + HaberSay).style.display = '';
	    HaberHarf();
	}
	function HaberHarf() {
	    document.getElementById("Haber" + HaberSay).innerHTML = document.getElementById("Haber" + HaberSay).innerHTML + HaberIcerik.charAt(HarfSay);
	    if (HarfSay < HaberIcerik.length) {
	        HarfSay++;
	        setTimeout("HaberHarf()", 100);
	    } else {
	        setTimeout("HaberBekle()", 1000);
	    }
	}
	function HaberBekle() {
	    document.getElementById("Haber" + HaberSay).style.display = 'none';
	    if (HaberSay < document.getElementById("HaberAdet").value) {
	        HaberSay++;
	    } else {
	        HaberSay = 1;
	    }
	    HarfSay = 0;
	    HaberTicker();
	}

	//---İL, İLÇE--------------------------------------
	var mySehirId;
	function GenelIlceYukle(SehirId) {
	    if (SehirId.length==0) {
			return;
}
mySehirId = SehirId;
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		}
		var url="inc_Ilceler.asp";
			url=url+'?SehirId='+SehirId;
			url=url+'&Diger=1&rnd='+Math.random();
			xmlHttp.onreadystatechange=GelenGenelIlce;
			xmlHttp.open("POST",url,true);
			xmlHttp.send(null);
	} 
	function GelenGenelIlce() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			var IlceId = xmlHttp.responseXML.getElementsByTagName("IlceId");
			var Ilce = xmlHttp.responseXML.getElementsByTagName("Ilce");
			var Ilcesi = document.getElementById("Ilcesi").value;
			var gez = document.getElementsByName("Ilce");
			for (var i = 0; i < gez.length; i++) {
			    if (gez[i] != null && gez[i].type == "select-one") {
			        var FrmIlce = gez[i]; //document.getElementById("Ilce");
			        var hiddenIlce = gez[i]; //document.getElementById("Ilce");
			        //hiddenIlce.innerHTML = xmlHttp.responseText;
			        //FrmIlce.innerHTML = xmlHttp.responseText;
			        for (var i = 0; i < Ilce.length; i++) {
			            var Satir = new Option(Ilce[i].firstChild.data, IlceId[i].firstChild.data);
			            FrmIlce.options[i] = Satir;
			            if (FrmIlce.options[i].value == Ilcesi) {
			                FrmIlce.options[i].selected = true;
			               
			            }
			        }
			        if (FrmIlce != null && FrmIlce.value != "")
			            GenelSemtYukle(FrmIlce.value);
			        //return;
			    }
			    
			}
		}
	}
	//---SEMT------------------------------------------
	function GenelSemtYukle(IlceId) {
		if (IlceId.length==0) {
			return;
		}
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		}
		var url="inc_Semtler.asp";
		//url=url+'?SehirId='+document.getElementById("Sehir").value+'&IlceId='+IlceId;
		    url = url + '?SehirId=' + mySehirId + '&IlceId=' + IlceId;
			url=url+'&Diger=1&rnd='+Math.random();
			xmlHttp.onreadystatechange=GelenGenelSemt;
			xmlHttp.open("POST",url,true);
			xmlHttp.send(null);
	} 
	function GelenGenelSemt() {
	    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
	        var SemtId = xmlHttp.responseXML.getElementsByTagName("SemtId");
	        var Semt = xmlHttp.responseXML.getElementsByTagName("Semt");
	        var Semti = document.getElementById("Semti").value;
	        var gez = document.getElementsByName("Semt");
	        for (var i = 0; i < gez.length; i++) {
	            if (gez[i] != null && gez[i].type == "select-one") {
	                var FrmSemt = gez[i];
	                //var FrmSemt = document.getElementById("Semt");
	                //FrmSemt.innerHTML = xmlHttp.responseText;
	                for (var i = 0; i < Semt.length; i++) {
	                    var Satir = new Option(Semt[i].firstChild.data, SemtId[i].firstChild.data);
	                    FrmSemt.options[i] = Satir;
	                    if (FrmSemt.options[i].value == Semti) {
	                        FrmSemt.options[i].selected = true;
	                    }
	                }
	                //return;
	            }
	        }
	    } 
	}
	//---TİP-------------------------------------------
	function GenelTipYukle(Turu) {
		if (Turu.length==0) {
			return;
		}
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		}
		var url="inc_Tipler.asp";
			url=url+'?Turu='+Turu;
			url=url+'&rnd='+Math.random();
			xmlHttp.onreadystatechange=GelenGenelTip;
			xmlHttp.open("POST",url,true);
			xmlHttp.send(null);
	} 
	function GelenGenelTip() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			var TipId = xmlHttp.responseXML.getElementsByTagName("TipId");
			var Tip = xmlHttp.responseXML.getElementsByTagName("Tip");
			var Tipi = document.getElementById("Tipi").value;
			var FrmTip = document.getElementById("Tip");
			FrmTip.innerHTML = xmlHttp.responseText;
			for (var i = 0; i < Tip.length; i++) {
				var Satir = new Option(Tip[i].firstChild.data,TipId[i].firstChild.data);
					FrmTip.options[i] = Satir;
					if (FrmTip.options[i].value == Tipi) {
						FrmTip.options[i].selected=true;	
					}
			}
		}
	}
	//---POPUP-----------------------------------------
	function MM_openBrWindow(theURL,winName,features) {
		window.open(theURL,winName,features);
	}
	//---İLAN BÜYÜK FOTOĞRAF--------------------------------
	function BuyukFoto(FotoAd) {
		document.getElementById("FotoAlan").innerHTML = "";
		document.getElementById("FotoAlan").innerHTML = '<img src="ftp/ilanlar/'+FotoAd+'">';
	}
	//---PROJE BÜYÜK FOTOĞRAF--------------------------------
	function ProjeBuyukFoto(FotoAd) {
		document.getElementById("FotoAlan").innerHTML = "";
		document.getElementById("FotoAlan").innerHTML = '<img src="ftp/projeler/'+FotoAd+'">';
	}
	//---TEMSİLCİ ARAMA KONTROL------------------------
	function TemsilciAra(){
		message = "Temsilcilik aramak için :\n";
		ok=true;
		if (document.TAraFrm.Sehir.value=="0"){ok=false;message+="Şehir seçiniz.\n";}
		if (!ok){alert(message);return false;}
		else return true;
	}
//-----------------------------------------------------

//----ARAMA İŞLEMLERİ----------------------------------
	//---İL, İLÇE--------------------------------------
	function IlceYukle(SehirId) {
		if (SehirId.length==0) {
			return;
		}
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		}
		var url="inc_Ilceler.asp";
			url=url+'?SehirId='+SehirId;
			url=url+'&rnd='+Math.random();
			xmlHttp.onreadystatechange=GelenIlce;
			xmlHttp.open("POST",url,true);
			xmlHttp.send(null);
	} 
	function GelenIlce() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			var IlceId = xmlHttp.responseXML.getElementsByTagName("IlceId");
			var Ilce = xmlHttp.responseXML.getElementsByTagName("Ilce");
			var Ilcesi = document.getElementById("Ilcesi").value;
			var FrmIlce = document.getElementById("Ilce");
			FrmIlce.innerHTML = xmlHttp.responseText;
			for (var i = 0; i < Ilce.length; i++) {
				var Satir = new Option(Ilce[i].firstChild.data,IlceId[i].firstChild.data);
					FrmIlce.options[i] = Satir;
					if (FrmIlce.options[i].value == Ilcesi) {
						FrmIlce.options[i].selected=true;	
					}
			}
			//if ((document.IlanAraForm.Sehir.value>0) && (document.IlanAraForm.Ilce.value>=0)) {
				SemtYukle(FrmIlce.value);
			//}
		} 
	}
	//---SEMT------------------------------------------
	function SemtYukle(IlceId) {
		if (IlceId.length==0) {
			return;
		}
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		}
		var url="inc_Semtler.asp";
			url=url+'?SehirId='+document.IlanAraForm.Sehir.value+'&IlceId='+IlceId;
			url=url+'&rnd='+Math.random();
			xmlHttp.onreadystatechange=GelenSemt;
			xmlHttp.open("POST",url,true);
			xmlHttp.send(null);
	} 
	function GelenSemt() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			var SemtId = xmlHttp.responseXML.getElementsByTagName("SemtId");
			var Semt = xmlHttp.responseXML.getElementsByTagName("Semt");
			var Semti = document.getElementById("Semti").value;
			var FrmSemt = document.getElementById("Semt");
			FrmSemt.innerHTML = xmlHttp.responseText;
			for (var i = 0; i < Semt.length; i++) {
				var Satir = new Option(Semt[i].firstChild.data,SemtId[i].firstChild.data);
					FrmSemt.options[i] = Satir;
					if (FrmSemt.options[i].value == Semti) {
						FrmSemt.options[i].selected=true;	
					}
			}
			SemtDoldur();
		} 
	}
	//---SEMT SEÇ--------------------------------------
	function SemtEkle() {
		var i = 0;
		var s = 0;
		var varmi = 0;
		var ListBox = document.IlanAraForm.Semt;
		var ListBoxSecili = document.IlanAraForm.SemtSecili;
		for (i = 0; i < ListBox.length; i++) {
			if (ListBox[i].selected) {
				if (ListBox[i].value==0) {
					SemtTemizle();
					var Satir = new Option(ListBox[i].text,ListBox[i].value);
						ListBoxSecili.options[ListBoxSecili.length] = Satir;
						document.IlanAraForm.SemtText.value += ListBox[i].text + ", ";
						document.IlanAraForm.SemtValue.value += ListBox[i].value + ", ";
					break;
				} else {
					for (s = 0; s < ListBoxSecili.length; s++) {
						if (ListBoxSecili[s].value>0) {
							if (ListBox[i].value == ListBoxSecili[s].value) {
								varmi = 1;
							}
						} else {
							varmi = 1;
						}
					}
					if (varmi==0) {
						var Satir = new Option(ListBox[i].text,ListBox[i].value);
						ListBoxSecili.options[ListBoxSecili.length] = Satir;
						document.IlanAraForm.SemtText.value += ListBox[i].text + ", ";
						document.IlanAraForm.SemtValue.value += ListBox[i].value + ", ";
					}
					s = 0;
					varmi = 0;
				}
			}
		}
		ListBox.selectedIndex = -1; 
	} 
	function SemtCikar() {
		var ListBox = document.IlanAraForm.SemtSecili;
		var i = 0;
		var s = 0;
		var SemtValue = new Array();
		var SemtText = new Array();
		for (i = 0; i < ListBox.length; i++) {
			if (ListBox[i].selected == false) {
				SemtValue[s] = ListBox[i].value;
				SemtText[s] = ListBox[i].text;
				s += 1;
			}
		}
		SemtTemizle();
		for (i = 0; i <= SemtValue.length-1; i++) {
			var Satir = new Option(SemtText[i],SemtValue[i]);
			ListBox.options[i] = Satir;
			document.IlanAraForm.SemtText.value += SemtText[i] + ", ";
			document.IlanAraForm.SemtValue.value += SemtValue[i] + ", ";
		}
		ListBox.selectedIndex = -1;
	}
	function SemtDoldur() {
		var i = 0;
		var FrmSemtText = document.IlanAraForm.SemtText.value;
		var FrmSemtValue = document.IlanAraForm.SemtValue.value
			FrmSemtText = FrmSemtText.substring(0,FrmSemtText.length-2);
			FrmSemtValue = FrmSemtValue.substring(0,FrmSemtValue.length-2);
		var SemtText = FrmSemtText.split(", ");
		var SemtValue = FrmSemtValue.split(", ");
		var ListBox = document.IlanAraForm.SemtSecili;
		if (FrmSemtText.length) {
			for (i = 0; i <= SemtValue.length-1; i++) {
				var Satir = new Option(SemtText[i],SemtValue[i]);
				ListBox.options[i] = Satir;
			}
			ListBox.selectedIndex = -1;
		}
	}
	function SemtTemizle() {
		document.IlanAraForm.SemtText.value = "";
		document.IlanAraForm.SemtValue.value = "";
		var ListBox = document.IlanAraForm.SemtSecili;
		var i = 0;
		for (i = ListBox.length-1; i>=0; i--) {
			ListBox.remove(i);
		}
		ListBox.selectedIndex = -1;
	}
//-----------------------------------------------------

//----TEMSİLCİLİK İŞLEMLERİ----------------------------
	//---TEMSİLCİ NO KONTROL---------------------------
	function TemsilciNoKontrol(TNo) {
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		} 
		var url="inc_TemsilciNoKontrol.asp"
			url=url+"?TNo="+TNo;
			url=url+"&rnd="+Math.random();
			xmlHttp.onreadystatechange=GelenTemsilciNo;
			xmlHttp.open("POST",url,true);
			xmlHttp.send(null);
	} 
	function GelenTemsilciNo() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById("TNoAlan").innerHTML = xmlHttp.responseText;
		} 
	}
	//---TEMSİLCİ YENİ ALAN----------------------------
	function Sifirla() {
		document.getElementById("TemsilciAlanSayi").value = 0;
		TemsilciYeniAlan();
	}
	function TemsilciYeniAlan(TNo) {
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		} 
		var url="inc_TemsilciYeniAlan.asp"
			AlanSayi = Number(document.getElementById("TemsilciAlanSayi").value) + 1;
			url=url+"?AlanSayi="+AlanSayi;
			url=url+"&TNo="+TNo;
			url=url+"&rnd="+Math.random();
			xmlHttp.onreadystatechange=GelenTemsilci;
			xmlHttp.open("POST",url,true);
			document.getElementById("TemsilciAlanSayi").value = Number(document.getElementById("TemsilciAlanSayi").value) + 1;
			xmlHttp.send(null);
	} 
	function GelenTemsilci() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			if (document.getElementById("TemsilciAlan").innerHTML==false) {
				document.getElementById("TemsilciAlan").innerHTML = xmlHttp.responseText;
			} else {
				var TAd = new Array();
				var TSoyad = new Array();
				var TUnvan = new Array();
				var TEMail = new Array();
				var TTip = new Array();
				var TTelAlan = new Array();
				var TTel = new Array();
				var TFaxAlan = new Array();
				var TFax = new Array();
				var TCepAlan = new Array();
				var TCep = new Array();
				for (i=1; i<=Number(document.getElementById("TemsilciAlanSayi").value)-1; i++){
					TAd[i-1] = document.getElementById("TAd_"+i).value;
					TSoyad[i-1] = document.getElementById("TSoyad_"+i).value;
					TUnvan[i-1] = document.getElementById("TUnvan_"+i).value;
					TEMail[i-1] = document.getElementById("TEMail_"+i).value;
					TTip[i-1] = document.getElementById("TTip_"+i).value;
					TTelAlan[i-1] = document.getElementById("TTelAlan_"+i).value;
					TTel[i-1] = document.getElementById("TTel_"+i).value;
					TFaxAlan[i-1] = document.getElementById("TFaxAlan_"+i).value;
					TFax[i-1] = document.getElementById("TFax_"+i).value;
					TCepAlan[i-1] = document.getElementById("TCepAlan_"+i).value;
					TCep[i-1] = document.getElementById("TCep_"+i).value;
				}
				document.getElementById("TemsilciAlan").innerHTML = document.getElementById("TemsilciAlan").innerHTML + xmlHttp.responseText;
				for (i=1; i<=Number(document.getElementById("TemsilciAlanSayi").value)-1; i++){
					document.getElementById("TAd_"+i).value = TAd[i-1];
					document.getElementById("TSoyad_"+i).value = TSoyad[i-1];
					document.getElementById("TUnvan_"+i).value = TUnvan[i-1];
					document.getElementById("TEMail_"+i).value = TEMail[i-1];
					document.getElementById("TTip_"+i).value = TTip[i-1];
					document.getElementById("TTelAlan_"+i).value = TTelAlan[i-1];
					document.getElementById("TTel_"+i).value = TTel[i-1];
					document.getElementById("TFaxAlan_"+i).value = TFaxAlan[i-1];
					document.getElementById("TFax_"+i).value = TFax[i-1];
					document.getElementById("TCepAlan_"+i).value = TCepAlan[i-1];
					document.getElementById("TCep_"+i).value = TCep[i-1];
				}
			}
		} 
	}
	//---TEMSİLCİ ALAN SİL-----------------------------
	var sayac = 1;
	var sakla = "";
	var gelen = 0;
	var giden = 0;
	var TNo = "";
	function TemsilciAlanSil(deger,deger2) {
		gelen = Number(deger);
		TNo = deger2;
		if (sayac!=Number(document.getElementById("TemsilciAlanSayi").value)) {
			if (sayac>=gelen) {
				giden = sayac+1;
			} else {
				giden = sayac;
			}
			TemsilciAlanSilIslem();
		}
	}
	function TemsilciAlanSilIslem() {
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		} 
		var url="inc_TemsilciAlanSil.asp";
			url=url+"?AlanSayi="+sayac;
			url=url+"&TNo="+TNo;
			url=url+"&TId="+document.getElementById("TId_"+giden).value;
			url=url+"&Ad="+document.getElementById("TAd_"+giden).value;
			url=url+"&Soyad="+document.getElementById("TSoyad_"+giden).value;
			url=url+"&Unvan="+document.getElementById("TUnvan_"+giden).value;
			url=url+"&EMail="+document.getElementById("TEMail_"+giden).value;
			url=url+"&Tip="+document.getElementById("TTip_"+giden).value;
			url=url+"&TelAlan="+document.getElementById("TTelAlan_"+giden).value;
			url=url+"&Tel="+document.getElementById("TTel_"+giden).value;
			url=url+"&FaxAlan="+document.getElementById("TFaxAlan_"+giden).value;
			url=url+"&Fax="+document.getElementById("TFax_"+giden).value;
			url=url+"&CepAlan="+document.getElementById("TCepAlan_"+giden).value;
			url=url+"&Cep="+document.getElementById("TCep_"+giden).value;
			url=url+"&rnd="+Math.random();
			xmlHttp.onreadystatechange=GelenTemsilciSil;
			xmlHttp.open("POST",url,true);
			xmlHttp.send(null);
	}
	function GelenTemsilciSil() {
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			if (sayac<Number(document.getElementById("TemsilciAlanSayi").value)) {
				sakla = sakla + xmlHttp.responseText;
				sayac++;
				if (sayac!=Number(document.getElementById("TemsilciAlanSayi").value)) {
					TemsilciAlanSil(gelen,TNo);
				} else{
					document.getElementById("TemsilciAlan").innerHTML = sakla;
					document.getElementById("TemsilciAlanSayi").value--;
					sayac = 1;
					sakla = "";
					gelen = 0;
					giden = 0;
				}
			}
		} 
	}
	//---HARİTA----------------------------------------
	function TemsilcilikHarita(dil) {
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="319" height="200" id="harita" align="middle">');
		document.write('<param name="allowScriptAccess" value="sameDomain">');
		document.write('<param name="movie" value="images/'+dil+'/swf/TemsilcilikHarita.swf">');
		document.write('<param name="loop" value="false">');
		document.write('<param name="menu" value="false">');
		document.write('<param name="quality" value="best">');
		document.write('<param name="bgcolor" value="#f2f1f1">');
		document.write('<embed src="images/'+dil+ 'swf/TemsilcilikHarita.swf" loop="false" menu="false" quality="best" bgcolor="#f2f1f1" width="319" height="200" name="harita" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">');
		document.write('</object>');
	}
	//---DUYURU ŞEHİR----------------------------------
	function SehirEkle() {
		var i = 0;
		var s = 0;
		var varmi = 0;
		var ListBox = document.DuyuruFrm.Sehir;
		var ListBoxSecili = document.DuyuruFrm.SehirSecili;
		for (i = 0; i < ListBox.length; i++) {
			if (ListBox[i].selected) {
				if (ListBox[i].value==0) {
					SehirTemizle();
					var Satir = new Option(ListBox[i].text,ListBox[i].value);
						ListBoxSecili.options[ListBoxSecili.length] = Satir;
						document.DuyuruFrm.SehirText.value += ListBox[i].text + ", ";
						document.DuyuruFrm.SehirValue.value += ListBox[i].value + ", ";
					break;
				} else {
					for (s = 0; s < ListBoxSecili.length; s++) {
						if (ListBoxSecili[s].value>0) {
							if (ListBox[i].value == ListBoxSecili[s].value) {
								varmi = 1;
							}
						} else {
							varmi = 1;
						}
					}
					if (varmi==0) {
						var Satir = new Option(ListBox[i].text,ListBox[i].value);
						ListBoxSecili.options[ListBoxSecili.length] = Satir;
						document.DuyuruFrm.SehirText.value += ListBox[i].text + ", ";
						document.DuyuruFrm.SehirValue.value += ListBox[i].value + ", ";
					}
					s = 0;
					varmi = 0;
				}
			}
		}
		ListBox.selectedIndex = -1; 
	} 
	function SehirCikar() {
		var ListBox = document.DuyuruFrm.SehirSecili;
		var i = 0;
		var s = 0;
		var SehirValue = new Array();
		var SehirText = new Array();
		for (i = 0; i < ListBox.length; i++) {
			if (ListBox[i].selected == false) {
				SehirValue[s] = ListBox[i].value;
				SehirText[s] = ListBox[i].text;
				s += 1;
			}
		}
		SehirTemizle();
		for (i = 0; i <= SehirValue.length-1; i++) {
			var Satir = new Option(SehirText[i],SehirValue[i]);
			ListBox.options[i] = Satir;
			document.DuyuruFrm.SehirText.value += SehirText[i] + ", ";
			document.DuyuruFrm.SehirValue.value += SehirValue[i] + ", ";
		}
		ListBox.selectedIndex = -1;
	}
	function SehirDoldur() {
		var i = 0;
		var FrmSehirText = document.DuyuruFrm.SehirText.value;
		var FrmSehirValue = document.DuyuruFrm.SehirValue.value
			FrmSehirText = FrmSehirText.substring(0,FrmSehirText.length-2);
			FrmSehirValue = FrmSehirValue.substring(0,FrmSehirValue.length-2);
		var SehirText = FrmSehirText.split(", ");
		var SehirValue = FrmSehirValue.split(", ");
		var ListBox = document.DuyuruFrm.SehirSecili;
		if (FrmSehirText.length) {
			for (i = 0; i <= SehirValue.length-1; i++) {
				var Satir = new Option(SehirText[i],SehirValue[i]);
				ListBox.options[i] = Satir;
			}
			ListBox.selectedIndex = -1;
		}
	}
	function SehirTemizle() {
		document.DuyuruFrm.SehirText.value = "";
		document.DuyuruFrm.SehirValue.value = "";
		var ListBox = document.DuyuruFrm.SehirSecili;
		var i = 0;
		for (i = ListBox.length-1; i>=0; i--) {
			ListBox.remove(i);
		}
		ListBox.selectedIndex = -1;
	}
//-----------------------------------------------------

//----EMLAK PAZARI İŞLEMLERİ---------------------------
	//---EMLAK PAZARI ANA DIV--------------------------
	function EPIAnaDiv(Turu,TikKutu) {
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		}
		HataDivKapat();
		document.getElementById("Turu").value = Turu;
		document.getElementById("TikKutu").value = TikKutu;
		var url="inc_EPIAnaDiv.asp";
			url=url+"?Turu="+Turu;
			url=url+"&TikKutu="+TikKutu;
			url=url+"&rnd="+Math.random();
			xmlHttp.onreadystatechange=GelenEPIAnaDiv;
			xmlHttp.open("POST",url,true);
			xmlHttp.send(null);
	} 
	function GelenEPIAnaDiv() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById("EPIAnaDiv").innerHTML = xmlHttp.responseText;
			Xcik = XPozisyon(document.getElementById("Foto1"));
			Ycik = YPozisyon(document.getElementById("Foto"+document.getElementById("TikKutu").value));
			document.getElementById("EPIAnaDiv").style.left = Xcik-1;
			document.getElementById("EPIAnaDiv").style.top = Ycik-26;
			document.getElementById("EPIAnaDiv").style.display = "";
			Xcik = 0;
			Ycik = 0;
			EPIDivIcerik();
		} 
	}
	function AnaDivKapat() { 
		document.getElementById("EPIDiv").style.display = "none";
		document.getElementById("EPIDiv").innerHTML = "";
		document.getElementById("EPIAnaDiv").style.display = "none";
		document.getElementById("EPIAnaDiv").innerHTML = "";
	}
	//---EMLAK PAZARI DIV------------------------------
	function EPIDivIcerik() {
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		}
		var url="inc_EPIDiv.asp";
			url=url+"?Turu="+document.getElementById("Turu").value;
			url=url+"&TikKutu="+document.getElementById("TikKutu").value;
			url=url+"&rnd="+Math.random();
			xmlHttp.onreadystatechange=GelenEPIDivIcerik;
			xmlHttp.open("POST",url,true);
			xmlHttp.send(null);
	}
	function GelenEPIDivIcerik() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById("EPIDiv").style.left = 1;
			document.getElementById("EPIDiv").style.top = 72;
			document.getElementById("EPIDiv").innerHTML = xmlHttp.responseText;
			document.getElementById("EPIDiv").style.display = "";
		}
	}
	//---EMLAK PAZARI DIV KAYIT SEÇ--------------------	
	function EPIDivSec(Turu,TikKutu,IlanId) {
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		}
		ok=true;
		message="";
		var IlanDizi = document.getElementById("IlanIdTut").value.split(", ");
		for (i = 0; i < IlanDizi.length-1; i++) {
			if (IlanId==IlanDizi[i]){
				ok=false;
				message="Bu ilan daha önce seçilmiştir.\n";
				break;
			}
		}
		if (!ok){
			alert(message);
		} else {
			document.getElementById("IlanIdTut").value = document.getElementById("IlanIdTut").value + IlanId + ", ";
			document.getElementById("Turu").value = Turu;
			document.getElementById("TikKutu").value = TikKutu;
			var url="inc_EPIKutuAlanIcerik.asp";
				url=url+"?Turu="+Turu;
				url=url+"&TikKutu="+TikKutu;
				url=url+"&IlanId="+IlanId;
				url=url+"&rnd="+Math.random();
				xmlHttp.onreadystatechange=GelenEPIDivSec;
				xmlHttp.open("POST",url,true);
				xmlHttp.send(null);	
		}
	}
	function GelenEPIDivSec() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById("EPIKutuAlan_"+document.getElementById("TikKutu").value).innerHTML = xmlHttp.responseText;
			document.getElementById("EPIDiv").style.display = "none";
			document.getElementById("EPIDiv").innerHTML = "";
			document.getElementById("EPIAnaDiv").style.display = "none";
			document.getElementById("EPIAnaDiv").innerHTML = "";
			document.getElementById("DoluKutu").value = document.getElementById("DoluKutu").value + document.getElementById("TikKutu").value + ", ";
		}
	}
	//---EMLAK PAZARI YENİ KUTU------------------------
	function EPIYeniKutu(Turu,TikKutu) {
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		} 
		HataDivKapat();
		document.getElementById("Turu").value = Turu;
		document.getElementById("TikKutu").value = TikKutu;
		if (document.getElementById("IlanId_"+document.getElementById("TikKutu").value).value!=0) {
			var Dizi = document.getElementById("DoluKutu").value.split(", ");
			var YeniSira = "";
			for (i = 0; i < Dizi.length-1; i++) {
				if (TikKutu!=Dizi[i]) {
					YeniSira = YeniSira + Dizi[i] + ", "
				}
			}
			document.getElementById("DoluKutu").value = YeniSira;
			var IlanDizi = document.getElementById("IlanIdTut").value.split(", ");
			var IlanYeniSira = "";
			for (i = 0; i < IlanDizi.length-1; i++) {
				if (document.getElementById("IlanId_"+document.getElementById("TikKutu").value).value!=IlanDizi[i]) {
					IlanYeniSira = IlanYeniSira + IlanDizi[i] + ", "
				}
			}
			document.getElementById("IlanIdTut").value = IlanYeniSira;
		}
		var url="inc_EPIYeniKutu.asp";
			url=url+"?Turu="+Turu;
			url=url+"&TikKutu="+TikKutu;
			url=url+"&rnd="+Math.random();
			xmlHttp.onreadystatechange=GelenEPIYeniKutu;
			xmlHttp.open("POST",url,true);
			xmlHttp.send(null);
	}
	function GelenEPIYeniKutu() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById("EPIKutuAlan_"+document.getElementById("TikKutu").value).innerHTML = xmlHttp.responseText;
		} 
	}
	//---EMLAK PAZARI TELEFON KONTROL------------------
	function EPKontrol() {
		ok=true;
		var Dizi = document.getElementById("DoluKutu").value.split(", ");
		for (i = 0; i < Dizi.length-1; i++) {
			Tel = document.getElementById("Tel_"+Dizi[i]).value;
			if (Tel=="0"){
				ok=false;
				message="İşaretli ilanın Telefon bilgisini seçiniz.\n";
				Xcik = XPozisyon(document.getElementById("Tel_"+Dizi[i]));
				Ycik = YPozisyon(document.getElementById("Tel_"+Dizi[i]));
				document.getElementById("HataDiv").style.left = Xcik+127;
				document.getElementById("HataDiv").style.top = Ycik;
				document.getElementById("HataDiv").style.display = "";
				break;
			}
		}
		if (!ok){
			window.location.hash = "Ilan"+Dizi[i];
			alert(message);
			return false;
		} else {
			return true;
		}
	}
	function HataDivKapat() {
		document.getElementById("HataDiv").style.display = "none";
	}
	//---EMLAK PAZARI FOTO DEĞİŞTİR--------------------
	function EPIF_Degis(Yon,TikKutu) {
		Toplam = document.getElementById("TFoto_"+TikKutu).value;
		Foto = document.getElementById("FotoAd_"+TikKutu).value;
		Secili = document.getElementById("Sira_"+TikKutu).value;
		if (Number(Yon)==1) {
			if (Number(Secili)==1) {
				YSecili = Number(Toplam);
			} else {
				YSecili = Number(Secili) - 1;
			}
		} else {
			if (Number(Secili)<Number(Toplam)) {
				YSecili = Number(Secili) + 1;
			} else {
				YSecili = 1;
			}
		}
		var Degis = Foto;
		YFoto = Degis.replace('-'+Secili+'_','-'+YSecili+'_');
		document.getElementById("FotoAlan_"+TikKutu).innerHTML = '<img src="ftp/ilanlar/'+YFoto+'" id=Foto'+TikKutu+' name=Foto'+TikKutu+' border="0">';
		document.getElementById("FotoAd_"+TikKutu).value = YFoto;
		document.getElementById("Sira_"+TikKutu).value = YSecili;
	}
//-----------------------------------------------------	

//----VİTRİN İŞLEMLERİ---------------------------
	//---VİTRİN ANA DIV--------------------------
	function VIAnaDiv(Turu,TikKutu) {
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		}
		document.getElementById("Turu").value = Turu;
		document.getElementById("TikKutu").value = TikKutu;
		var url="inc_VIAnaDiv.asp";
			url=url+"?Turu="+Turu;
			url=url+"&TikKutu="+TikKutu;
			url=url+"&rnd="+Math.random();
			xmlHttp.onreadystatechange=GelenVIAnaDiv;
			xmlHttp.open("POST",url,true);
			xmlHttp.send(null);
	} 
	function GelenVIAnaDiv() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById("VIAnaDiv").innerHTML = xmlHttp.responseText;
			Xcik = XPozisyon(document.getElementById("Foto1"));
			Ycik = YPozisyon(document.getElementById("Foto"+document.getElementById("TikKutu").value));
			document.getElementById("VIAnaDiv").style.left = Xcik-10;
			document.getElementById("VIAnaDiv").style.top = Ycik-28;
			document.getElementById("VIAnaDiv").style.display = "";
			Xcik = 0;
			Ycik = 0;
			VIDivIcerik();
		} 
	}
	function VIAnaDivKapat() { 
		document.getElementById("VIDiv").style.display = "none";
		document.getElementById("VIDiv").innerHTML = "";
		document.getElementById("VIAnaDiv").style.display = "none";
		document.getElementById("VIAnaDiv").innerHTML = "";
	}
	//---VİTRİN DIV------------------------------
	function VIDivIcerik() {
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		}
		var url="inc_VIDiv.asp";
			url=url+"?Turu="+document.getElementById("Turu").value;
			url=url+"&TikKutu="+document.getElementById("TikKutu").value;
			url=url+"&rnd="+Math.random();
			xmlHttp.onreadystatechange=GelenVIDivIcerik;
			xmlHttp.open("POST",url,true);
			xmlHttp.send(null);
	}
	function GelenVIDivIcerik() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById("VIDiv").style.left = 1;
			document.getElementById("VIDiv").style.top = 72;
			document.getElementById("VIDiv").innerHTML = xmlHttp.responseText;
			document.getElementById("VIDiv").style.display = "";
		}
	}
	//---VİTRİN DIV KAYIT SEÇ--------------------	
	function VIDivSec(Turu,TikKutu,IlanId) {
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		}
		ok=true;
		message="";
		var IlanDizi = document.getElementById("IlanIdTut").value.split(", ");
		for (i = 0; i < IlanDizi.length-1; i++) {
			if (IlanId==IlanDizi[i]){
				ok=false;
				message="Bu ilan daha önce seçilmiştir.\n";
				break;
			}
		}
		if (!ok){
			alert(message);
		} else {
			document.getElementById("IlanIdTut").value = document.getElementById("IlanIdTut").value + IlanId + ", ";
			document.getElementById("Turu").value = Turu;
			document.getElementById("TikKutu").value = TikKutu;
			var url="inc_VIKutuAlanIcerik.asp";
				url=url+"?Turu="+Turu;
				url=url+"&TikKutu="+TikKutu;
				url=url+"&IlanId="+IlanId;
				url=url+"&rnd="+Math.random();
				xmlHttp.onreadystatechange=GelenVIDivSec;
				xmlHttp.open("POST",url,true);
				xmlHttp.send(null);	
		}
	}
	function GelenVIDivSec() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById("VIKutuAlan_"+document.getElementById("TikKutu").value).innerHTML = xmlHttp.responseText;
			document.getElementById("VIDiv").style.display = "none";
			document.getElementById("VIDiv").innerHTML = "";
			document.getElementById("VIAnaDiv").style.display = "none";
			document.getElementById("VIAnaDiv").innerHTML = "";
			document.getElementById("DoluKutu").value = document.getElementById("DoluKutu").value + document.getElementById("TikKutu").value + ", ";
		}
	}
	//---VİTRİN YENİ KUTU------------------------
	function VIYeniKutu(Turu,TikKutu) {
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		} 
		document.getElementById("Turu").value = Turu;
		document.getElementById("TikKutu").value = TikKutu;
		if (document.getElementById("IlanId_"+document.getElementById("TikKutu").value).value!=0) {
			var Dizi = document.getElementById("DoluKutu").value.split(", ");
			var YeniSira = "";
			for (i = 0; i < Dizi.length-1; i++) {
				if (TikKutu!=Dizi[i]) {
					YeniSira = YeniSira + Dizi[i] + ", "
				}
			}
			document.getElementById("DoluKutu").value = YeniSira;
			var IlanDizi = document.getElementById("IlanIdTut").value.split(", ");
			var IlanYeniSira = "";
			for (i = 0; i < IlanDizi.length-1; i++) {
				if (document.getElementById("IlanId_"+document.getElementById("TikKutu").value).value!=IlanDizi[i]) {
					IlanYeniSira = IlanYeniSira + IlanDizi[i] + ", "
				}
			}
			document.getElementById("IlanIdTut").value = IlanYeniSira;
		}
		var url="inc_VIYeniKutu.asp";
			url=url+"?Turu="+Turu;
			url=url+"&TikKutu="+TikKutu;
			url=url+"&rnd="+Math.random();
			xmlHttp.onreadystatechange=GelenVIYeniKutu;
			xmlHttp.open("POST",url,true);
			xmlHttp.send(null);
	}
	function GelenVIYeniKutu() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById("VIKutuAlan_"+document.getElementById("TikKutu").value).innerHTML = xmlHttp.responseText;
		} 
	}
//-----------------------------------------------------	

//---ILCE - SEMT ARAMA-----------------------------------
	function IlceSemtYukle(Gelen) {
		if (Gelen.length>=3) {
			if (document.IlanAraForm.Sehir.value!=0) {
				xmlHttp=GetXmlHttpObject();
				if (xmlHttp==null) {
					alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
					return;
				}
				var url="inc_IlceSemtAra.asp";
					url=url+'?Text='+Gelen;
					url=url+'&SehirId='+document.IlanAraForm.Sehir.value;
					url=url+'&rnd='+Math.random();
					xmlHttp.onreadystatechange=GelenIlceSemt;
					xmlHttp.open("POST",url,true);
					xmlHttp.send(null);
			}
		} else	{
			document.getElementById("IlceSemtDiv").innerHTML = "";
			document.getElementById("IlceSemtDiv").style.display = 'none';
		}
	} 
	function GelenIlceSemt() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById("IlceSemtDiv").innerHTML = xmlHttp.responseText;
			Xcik = XPozisyon(document.getElementById("IlceSemtDivKonum"));
			Ycik = YPozisyon(document.getElementById("IlceSemtDivKonum"));
			document.getElementById("IlceSemtDiv").style.left = Xcik;
			document.getElementById("IlceSemtDiv").style.top = Ycik+38;
			document.getElementById("IlceSemtDiv").style.display = "";
			Xcik = 0;
			Ycik = 0;
		}
	}
	
	function IlceSemtSec(Gelen) {
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		}
		var Izin = true;
		var IlceSemtDizi = document.getElementById("IlceSemtId").value.split(",");
		for (i = 0; i < IlceSemtDizi.length; i++) {
			if (IlceSemtDizi[i]==Gelen) {
				Izin = false;
			}
		}
		if (Izin == true) {
			if (document.getElementById("IlceSemtId").value=='') {
				document.getElementById("IlceSemtId").value = Gelen;
			} else {
				document.getElementById("IlceSemtId").value = document.getElementById("IlceSemtId").value + "," + Gelen;
			}
			var url="inc_IlceSemtSec.asp";
				url=url+'?IlceSemtId='+document.getElementById("IlceSemtId").value;
				url=url+'&rnd='+Math.random();
				xmlHttp.onreadystatechange=SecilenIlceSemt;
				xmlHttp.open("POST",url,true);
				xmlHttp.send(null);
		}
	} 
	function SecilenIlceSemt() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById("Secilenler").innerHTML = xmlHttp.responseText;
			IlceSemtDivGizle();
		}
	}
	
	function IlceSemtKaldir(Gelen) {
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		}
		var IlceSemtDizi = document.getElementById("IlceSemtId").value.split(",");
		document.getElementById("IlceSemtId").value = '';
		for (i = 0; i < IlceSemtDizi.length; i++) {
			if (IlceSemtDizi[i]!=Gelen) {
				if (document.getElementById("IlceSemtId").value=='') {
					document.getElementById("IlceSemtId").value = IlceSemtDizi[i];
				} else {
					document.getElementById("IlceSemtId").value = document.getElementById("IlceSemtId").value + "," + IlceSemtDizi[i];
				}
			}
		}
		var url="inc_IlceSemtSec.asp";
			url=url+'?IlceSemtId='+document.getElementById("IlceSemtId").value;
			url=url+'&rnd='+Math.random();
			xmlHttp.onreadystatechange=KaldirilanIlceSemt;
			xmlHttp.open("POST",url,true);
			xmlHttp.send(null);
	} 
	function KaldirilanIlceSemt() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById("Secilenler").innerHTML = xmlHttp.responseText;
			IlceSemtDivGizle();
		}
	}
	
	function IlceSemtOku() {
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null) {
			alert ("Kullandığınız browser kayıt işlemlerini desteklemiyor.");
			return;
		}
		var url="inc_IlceSemtSec.asp";
			url=url+'?IlceSemtId='+document.getElementById("IlceSemtId").value;
			url=url+'&rnd='+Math.random();
			xmlHttp.onreadystatechange=OkunanIlceSemt;
			xmlHttp.open("POST",url,true);
			xmlHttp.send(null);
	} 
	function OkunanIlceSemt() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById("Secilenler").innerHTML = xmlHttp.responseText;
			IlceSemtDivGizle();
		}
	}

	function IlceSemtDivGizle() {
		document.getElementById("IlceSemt").value = "";
		document.getElementById("IlceSemtDiv").style.display = 'none';
		document.getElementById("IlceSemtDiv").innerHTML = "";
	}
//-----------------------------------------------------
	function Popup(ctrl, url, windowName, height, width, scrollbars) {
	    if (scrollbars == '') {

	        scrollbars = 'no';
	    }

	    newwindow = window.open(url, windowName, "width=" + width + ",height=" + height + ",location=no,scrollbars=" + scrollbars + ",resizable=1");
	    if (window.focus) {
	        newwindow.focus()
	    }
	    return false;
	}
