function pt1(id){ 
	var div=document.getElementById(id);
	div.className = 'L2';
}
function pt2(id){ 
	var div=document.getElementById(id);
	div.className = 'L1';
}
function Trim(value)
{
    value = value.match(/^\s*(\S+(\s+\S+)*)\s*$/);
    return (value == null) ? "" : value[1];
}

function Fokus(Degis){
	if (Trim(Degis.value) == '0'){Degis.value = '';}
}

function XFokus(Degis){
	if (Trim(Degis.value) == ''){Degis.value = '0';}
}

function replace2(s, from1, to1) {
	var p,str;
	str=s;
	p = str.indexOf(from1);
	while (p > -1) {
		str=str.substring(0, p) + to1 + str.substring(p+from1.length);
		p = str.indexOf(from1);
	}
	return str;
}

function Amount_onkeypress(e) {	
	var key = (window.Event) ? e.which : e.keyCode;
	  if((key<48 || key>57) && key!=8 && key!=13) 
	  	return false;
	}

function Amount_onkeyup(thisis) {
	var tempstr,newstr,str,i,str2 ;
	var commapos,aftercomma,commacount;
	i=0;
	str = thisis.value;
	while ((str.length>1)&&(str.substr(0,1)=='0')){
		str=str.substr(1);
	}
	if (str.indexOf(",")<0){
	
		str=replace2(str,'.','');

		commacount=0;
		commapos=str.indexOf(";");
	
		if (commapos>=0) 
		{
			aftercomma=str.substr(commapos);
			str=str.substr(0,commapos);
		}
		else
			aftercomma="";
	
		if (str.length > 3) 
		{
			tempstr=str;
			newstr="";
			while (tempstr.length>3)
			{
				newstr="."+tempstr.substr(tempstr.length-3)+newstr; 
				tempstr=tempstr.substr(0,tempstr.length-3);
			}
			thisis.value = tempstr+newstr+aftercomma;
		}else{thisis.value = str;}
	}
	if(thisis.value=='0'){thisis.value='';}
}

function Only_Numeric(e) {	
	//alert(window.event.srcElement.value);
	var whichCode = (window.Event) ? e.which : e.keyCode;
	
	if (whichCode == 13) return true;  // Enter
	if (whichCode == 44) return true;  // Comma
	if (whichCode > 57 ){
	return false;}
	if (whichCode < 48 && whichCode > 13){
	return false;}
}

function ilceReset()
{
	document.getElementById('ilceID').value="";
	document.getElementById('ilce').value="";
}
function semtReset()
{
	document.getElementById('semt').value="";
	document.getElementById('semtID').value="";
}
function fillIn(anaparentID,parentID,catID,hiddenText,hiddenID,kolon,anaID,anaVar,fieldType,aciklama)
{
	var hiddenTextVal="";
	var hiddenIDVal="";
	var anaIDVal="";

	if(hiddenText!="")
		hiddenTextVal = document.getElementById(hiddenText).value;
	if(hiddenID!="")
		hiddenIDVal = document.getElementById(hiddenID).value;
	if(anaID!="")
		anaIDVal = document.getElementById(anaID).value;
	var dest = "fill.asp?baba=3012&anaparentID="+anaparentID+"&parentID="+parentID+"&catID="+catID+"&hiddenText="+hiddenTextVal+"&hiddenID="+hiddenIDVal+"&fieldText="+hiddenText+"&fieldHidden="+hiddenID+"&kolon="+kolon+"&anaID="+anaIDVal+"&anaVar="+anaVar+"&fieldType="+fieldType;
	detail_window = window.open(dest, "displayWindow", "width=700,height=500,scrollbars=yes,resizable=no,toolbar=no,location=no,menubar=no,status=no");
	self.name = "anne";
	return false;
}
function fillIn2(anaparentID,parentID,catID,hiddenText,hiddenID,kolon,anaID,anaVar,fieldType,aciklama)
{
	var hiddenTextVal="";
	var hiddenIDVal="";
	var anaIDVal="";

	if(hiddenText!="")
		hiddenTextVal = document.getElementById(hiddenText).value;
	if(hiddenID!="")
		hiddenIDVal = document.getElementById(hiddenID).value;
	if(anaID!="")
		anaIDVal = document.getElementById(anaID).value;
	var dest = "fill2.asp?baba=3012&anaparentID="+anaparentID+"&parentID="+parentID+"&catID="+catID+"&hiddenText="+hiddenTextVal+"&hiddenID="+hiddenIDVal+"&fieldText="+hiddenText+"&fieldHidden="+hiddenID+"&kolon="+kolon+"&anaID="+anaIDVal+"&anaVar="+anaVar+"&fieldType="+fieldType;
	detail_window = window.open(dest, "displayWindow", "width=700,height=500,scrollbars=yes,resizable=no,toolbar=no,location=no,menubar=no,status=no");
	self.name = "anne";
	return false;
}
function toggle(id)
{
	el = document.getElementById(id);
	var display = el.style.display ? '' : 'none';
	el.style.display = display;
}
function toggle2(id)
{
	el = document.getElementById(id);
	var display = el.style.display ? 'none' : '';
	el.style.display = 'none';
}
function selectTemizle2(FormName, FieldName, CheckValue)
{
	if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	objCheckBoxes.options[0].selected = CheckValue;
}
function selectTemizle(FormName, FieldName, CheckValue)
{
	if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.options.length;
	for(var i = 0; i < countCheckBoxes; i++)
		objCheckBoxes.options[i].selected = CheckValue;
}
function checkTemizle(FormName, FieldName, CheckValue)
{
	if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = CheckValue;
}
function degerTemizle(FormName, FieldName)
{
	if(!document.forms[FormName])
		return;
	var objField = document.forms[FormName].elements[FieldName];
	if(!objField)
		return;
	objField.value="";
}
function kriterGizle(deger){
	if(deger==0){
		document.getElementById("linkGizle1").className="fld1";
		document.getElementById("linkGizle").className="fld2";
		}
	else
	{
		document.getElementById("linkGizle1").className="fld2";
		document.getElementById("linkGizle").className="fld1";
	}
}
function fldDegistir(id,showhide){
	var divs=document.getElementsByName(id);
	for (var i=0; i<divs.length; i++)
	{
	   divs[i].className=showhide;
	}
}
function switchTip2(FormName,field){
	id=field.value;
	if(id==""){
		checkTemizle(FormName, 'kimekiralik', false);
		fldDegistir('fldSatilik','fld2');
		fldDegistir('fldKiralik','fld2');
	}
	if(id=="Satılık"){
		checkTemizle(FormName, 'kimekiralik', false);
		fldDegistir('fldSatilik','fld1');
		fldDegistir('fldKiralik','fld2');
	}
	if(id=="Kiralık"){
		fldDegistir('fldSatilik','fld2');
		fldDegistir('fldKiralik','fld1');
	}
}
function switchTip(FormName,field){
	id=field.value;
	checkTemizle(FormName, 'tip2', false);
	checkTemizle(FormName, 'durum2', false);
	checkTemizle(FormName, 'ozellikler', false);
	if(id==1){
		fldDegistir('fldKonut','fld1');
		fldDegistir('fldKonutIsyeri','fld1');
		fldDegistir('fldIsyeri','fld2');
		fldDegistir('fldArsaIsyeri','fld2');
		fldDegistir('fldArsa','fld2');
	}
	if(id==2){
		fldDegistir('fldKonut','fld2');
		fldDegistir('fldKonutIsyeri','fld1');
		fldDegistir('fldIsyeri','fld1');
		fldDegistir('fldArsaIsyeri','fld1');
		fldDegistir('fldArsa','fld2');
	}
	if(id==3){
		fldDegistir('fldKonut','fld2');
		fldDegistir('fldKonutIsyeri','fld2');
		fldDegistir('fldIsyeri','fld2');
		fldDegistir('fldArsaIsyeri','fld1');
		fldDegistir('fldArsa','fld1');
		degerTemizle(FormName, 'apartman');
		degerTemizle(FormName, 'binano');
		degerTemizle(FormName, 'daireno');
	}
}
function doReset(){
	degerTemizle('frmSrc1','portfoyID');
	selectTemizle2('frmSrc1','tarih',true);
	selectTemizle2('frmSrc1','sirala',true);
	degerTemizle('frmSrc1','keyword');
	switchTip('frmSrc1',document.frmSrc1.tipCat1);
	document.frmSrc1.tipCat1.checked=true;
	document.frmSrc1.durum24.checked=true;
	checkTemizle('frmSrc1','devren',false);
	degerTemizle('frmSrc1','fiyat1');
	degerTemizle('frmSrc1','fiyat2');
	degerTemizle('frmSrc1','m21');
	degerTemizle('frmSrc1','m22');
	selectTemizle2('frmSrc1','doviz',true);
	selectTemizle2('frmSrc1','ilID',true);
	degerTemizle('frmSrc1','ilceID');
	degerTemizle('frmSrc1','ilce');
	degerTemizle('frmSrc1','semt');
	degerTemizle('frmSrc1','semtID');
	checkTemizle('frmSrc1','resim',false);
	checkTemizle('frmSrc1','fiyatdurumu',false);
	checkTemizle('frmSrc1','oda',false);
	checkTemizle('frmSrc1','kat',false);
	checkTemizle('frmSrc1','isitma',false);
	checkTemizle('frmSrc1','yapidurumu',false);
	checkTemizle('frmSrc1','ozellikler',false);
	degerTemizle('frmSrc1','yas1');
	degerTemizle('frmSrc1','yas2');
	return false;
}
function kolayerisim(id){
	document.kolayErisim.tipCat.value= id;
	document.kolayErisim.submit();
	return true;
}
function checkIlan(frm) {	
	if(Trim(frm.PID.value)==""){
		alert("Lütfen ilan numarasını yazınız!");
		return false;
	}
	else{
			return true;
		}
	return false;
}
function L4(PID){
document.location.href="portfoy.asp?PID="+PID;
}
function L5(PID){
document.location.href="projeler2.asp?PID="+PID;
}
