//----------------------------------------
// App constants
//----------------------------------------

var USERTIP_ACENTE = "AK";
var USERTIP_SIGORTA_SIRKET= "SK";
var USERTIP_SIGORTA_SIRKET_OZEL= "SKP";
var USERTIP_HAZINE= "HK";
var USERTIP_EKSPER= "EK";
var USERTIP_BIRLIK= "BK";
var USERTIP_MUSTERI= "MK";
var USERTIP_TRAMER= "TK";
var USERTIP_EMNIYET= "EMK";
var USERTIP_SAGLIK= "SBK";
var USERTIP_GARANTI_HESABI= "GH";
var USERTIP_JANDARMA= "JK";
var USERTIP_ULASTIRMA_BAKANLIGI= "UBK";
var USERTIP_MILLI_REASURANS= "MRK";


var SORGUTIP_POLICE_NO = 0;	
var SORGUTIP_PLAKA = 1;
var SORGUTIP_MOTOR = 2;
var SORGUTIP_SASI = 3;
var SORGUTIP_MUSTERI_AD_SOYAD = 4;
var SORGUTIP_MUSTERI_VERGI_NO = 5;
var SORGUTIP_MUSTERI_VATANDAS_NO = 6;
var SORGUTIP_OTORIZASYON_NO = 7;
var SORGUTIP_ONAYNO = 8;
var SORGUTIP_BELGE = 10;
var SORGUTIP_SIGORTASIRKET = 11;
var SORGUTIP_POLICEBASLAMATARIHI=12;
var SORGUTIP_EKTURU=13;
var SORGUTIP_EKBASLAMATARIHI=14;
var SORGUTIP_HATAKODU=15;
var SORGUTIP_HASAR_BELGE_NO=16;

var PLAKASORGUTIP_TC = 0;
var PLAKASORGUTIP_VERGI = 1;
var PLAKASORGUTIP_SASI = 2;
var PLAKASORGUTIP_SIRKET = 3;
var PLAKASORGUTIP_MOTOR = 4;

var POLICE_BITIS_YIL = 2005;

//----------------------------------------
// policeSorgu scrn usage
//----------------------------------------
function initKaskoPoliceSorguScrn()
{
	with (document.policeSorguForm)
	{
		captcha.value="";
		if(newSorgu.value == "E"){
			if (sigortaSirketKod.type != "hidden") sigortaSirketKod.selectedIndex = -1;
			if (acenteKod.type != "hidden") acenteKod.value = "";
			policeNo.value = "";
			yenilemeNo.value = "";
			setCheckedRadio(sorguTip,SORGUTIP_POLICE_NO,true);
		}
		else{	
			var sorguTipVal = getCheckedRadio(sorguTip);
			
			setCheckedRadio(sorguTip,SORGUTIP_POLICE_NO,true);
			
			if (policeNo.value != ""){
				 setCheckedRadio(sorguTip,SORGUTIP_POLICE_NO,true);		
			}
			else{
				if (sigortaSirketKod.type != "hidden") sigortaSirketKod.selectedIndex = -1;
				if (acenteKod.type != "hidden") acenteKod.value = "";
				policeNo.value = "";
				yenilemeNo.value = "";
			}
			
			if (plakaIlKod.value != ""){
				setCheckedRadio(sorguTip,SORGUTIP_PLAKA,true);
			}
			else{
				plakaIlKod.value = "";
				plakaNo.value = "";
			}
			
			if (motorNo.value != "") setCheckedRadio(sorguTip,SORGUTIP_MOTOR,true);
			if (typeof(sasiNo) != "undefined"){
				if (sasiNo.value != "") setCheckedRadio(sorguTip,SORGUTIP_SASI,true);
			}

			if (userTip.value == USERTIP_TRAMER || userTip.value == USERTIP_BIRLIK || userTip.value == USERTIP_HAZINE || userTip.value == USERTIP_SAGLIK ||
			    userTip.value == USERTIP_GARANTI_HESABI  || userTip.value == USERTIP_EMNIYET || userTip.value == USERTIP_EKSPER || userTip.value == USERTIP_JANDARMA)
			{
				if (musteriAd.value != ""){ 
					setCheckedRadio(sorguTip,SORGUTIP_MUSTERI_AD_SOYAD,true);
				}
				else{
					musteriAd.value = "";
					musteriSoyad.value = "";
				}	
			}
	
			if (userTip.value == USERTIP_TRAMER || userTip.value == USERTIP_BIRLIK || userTip.value == USERTIP_HAZINE || 
				userTip.value == USERTIP_SAGLIK || userTip.value == USERTIP_GARANTI_HESABI  || userTip.value == USERTIP_EMNIYET || 
				userTip.value == USERTIP_EKSPER || userTip.value == USERTIP_JANDARMA || userTip.value == USERTIP_SIGORTA_SIRKET ||
				userTip.value == USERTIP_SIGORTA_SIRKET_OZEL)
			{
				if(musteriVergiNo) {
					// acenteler vergi numarasindan sorgu yapmiyor
					// bu deger null olabilir
					if (musteriVergiNo.value != "") {
						setCheckedRadio(sorguTip,SORGUTIP_MUSTERI_VERGI_NO,true);
					}
					else {
						musteriVergiNo.value = "";
					}
				}
			}
			if (userTip.value == USERTIP_TRAMER || userTip.value == USERTIP_BIRLIK || userTip.value == USERTIP_HAZINE || 
				userTip.value == USERTIP_SAGLIK || userTip.value == USERTIP_GARANTI_HESABI  || userTip.value == USERTIP_EMNIYET || 
				userTip.value == USERTIP_EKSPER || userTip.value == USERTIP_JANDARMA || userTip.value == USERTIP_SIGORTA_SIRKET ||
				userTip.value == USERTIP_SIGORTA_SIRKET_OZEL)
			{
				if (musteriVatandasNo.value != "") {
					setCheckedRadio(sorguTip,SORGUTIP_MUSTERI_VATANDAS_NO,true);
				}
				else {
					musteriVatandasNo.value = "";
				}
			}
				
			if (!(belgeNo.value =="" || belgeNo.value ==0)) {
				setCheckedRadio(sorguTip,SORGUTIP_BELGE,true);
			}
			else{
				belgeNo.value ="";
			}
		}
	}
	kaskoPoliceSorguTipChange(policeSorguForm);
}

function checkKaskoPoliceSorguScrn()
{
	with (document.policeSorguForm)
	{
		var sorguTipVal = getCheckedRadio(sorguTip);

		if (sorguTipVal == SORGUTIP_POLICE_NO)
		{
			if (sigortaSirketKod.selectedIndex == -1)return reportError(sigortaSirketKod,policeSigortaSirketKod);
			
			acenteKod.value = acenteKod.value.trim();
			if (acenteKod.value.length == 0) return reportError(acenteKod,policeAcenteKod);
			
			policeNo.value = policeNo.value.trim();
			if (policeNo.value.length == 0) return reportError(policeNo,policePoliceNo);

			yenilemeNo.value = yenilemeNo.value.trim();
			if (yenilemeNo.value.length == 0) yenilemeNo.value = "0";
		}
		else if (sorguTipVal == SORGUTIP_PLAKA)
		{
			plakaIlKod.value = plakaIlKod.value.trim();
			if (plakaIlKod.value.length == 0) return reportError(plakaIlKod,policePlaka);
			if (isNaN(plakaIlKod.value)) return reportError(plakaIlKod,policePlakaIlKodGecersiz);

			plakaNo.value = plakaNo.value.trim();
			if (plakaNo.value.length == 0) return reportError(plakaNo,policePlaka);

			if(userTip.value != USERTIP_TRAMER) {
				if (!plakaGecerliMi(plakaNo)) return reportError(plakaNo, plakaNoGecici);	
			}			

			if (userTip.value != USERTIP_TRAMER && plakaNo.value.length < 5) 
				return reportError(plakaNo,policePlakaNoGecersiz);			
		}		
		else if (sorguTipVal == SORGUTIP_MOTOR)
		{		
			if (!motorNoGecerliMi(motorNo)) return reportError(motorNo,gecersizMotorNoIleSorgu);
			
			motorNo.value = motorNo.value.trim();
			if (motorNo.value.length == 0) return reportError(motorNo,policeMotorNo);
		}
		else if (sorguTipVal == SORGUTIP_SASI)
		{	
			if (!sasiNoGecerliMi(sasiNo)) return reportError(sasiNo,gecersizSasiNoIleSorgu);
			
			sasiNo.value = sasiNo.value.trim();
			if (sasiNo.value.length == 0) return reportError(sasiNo,policeSasiNo);
		}
		else if (sorguTipVal == SORGUTIP_MUSTERI_AD_SOYAD)
		{	
			musteriAd.value = musteriAd.value.trim();
			if (musteriAd.value.length == 0) return reportError(musteriAd,policeMusteriAd);			
			musteriSoyad.value = musteriSoyad.value.trim();
			if (musteriSoyad.value.length == 0) return reportError(musteriSoyad,policeMusteriSoyad);			
		}
		else if (sorguTipVal == SORGUTIP_MUSTERI_VERGI_NO)
		{	
			musteriVergiNo.value = musteriVergiNo.value.trim();
			if (isNaN(musteriVergiNo.value)) return reportError(musteriVergiNo,policeMusteriVergiNoHatali);
			else if (musteriVergiNo.value.length == 0) return reportError(musteriVergiNo,policeMusteriVergiNo);
			else if (musteriVergiNo.value.length != 10) return reportError(musteriVergiNo,policeMusteriVergiNoUzunluguHatali);
			else if (basamaklarAyni(musteriVergiNo)) return reportError(musteriVergiNo,policeMusteriVergiNoHatali);
		}
		else if (sorguTipVal == SORGUTIP_MUSTERI_VATANDAS_NO)
		{	
			musteriVatandasNo.value = musteriVatandasNo.value.trim();
			if (isNaN(musteriVatandasNo.value)) return reportError(musteriVatandasNo,policeMusteriVatandasNoHatali);
			else if (musteriVatandasNo.value.length == 0) return reportError(musteriVatandasNo,policeMusteriVatandasNo);
			else if (musteriVatandasNo.value.length != 11) return reportError(musteriVatandasNo,policeMusteriVatandasNoUzunluguHatali);
			else if (basamaklarAyni(musteriVatandasNo)) return reportError(musteriVatandasNo,policeMusteriVatandasNoHatali);
		}		
		else if (sorguTipVal == SORGUTIP_BELGE)
		{	
			belgeNo.value = belgeNo.value.trim();
			if (belgeNo.value.length == 0 ) return reportError(belgeNo,policeBelgeBelgeNoNo);
			if (belgeNo.value == "0") return reportError(belgeNo,policeBelgeNoHatali);
		}	
		var noc = document.getElementById("noCaptcha");
		if (noc == null || noc.value!="TRAMER") {
			captcha.value = captcha.value.trim();
			if (captcha.value.length == "0") return reportError(captcha, captchaTextRequired); 	
		}
	}

	return true;
}

function initPertSorguScrn2(p) {
	with (document.pertSorguForm) {
		
		plakaIlKod.value = "";
		plakaNo.value = "";
		motorNo.value = "";
		sasiNo.value = "";
		//if(musteriVergiNo != null) { alert("ok"); musteriVergiNo.value = ""; }
		musteriVatandasNo.value = "";
		acenteKod.value = "";
		policeNo.value = "";
		yenilemeNo.value = "";
		hasarDosyaNo.value = "";
		sigortaSirketKod.selectedIndex = 0;
		sigortaSirketKod2.selectedIndex = 0;
		
		sigortaSirketKod.disabled = true;
		setInputClass(sigortaSirketKod);
		acenteKod.disabled = true;
		setInputClass(acenteKod);
		policeNo.disabled = true;
		setInputClass(policeNo);
		yenilemeNo.disabled = true;
		setInputClass(yenilemeNo);
		
		sigortaSirketKod2.disabled = true;
		setInputClass(sigortaSirketKod2);
		hasarDosyaNo.disabled = true;
		setInputClass(hasarDosyaNo);
		
		// grup 1 elemanlari disable yapiliyor
		plakaIlKod.disabled = true;setInputClass(plakaIlKod);
		plakaNo.disabled = true;setInputClass(plakaNo);
		motorNo.disabled = true;setInputClass(motorNo);
		sasiNo.disabled = true;setInputClass(sasiNo);
		if(document.pertSorguForm.musteriVergiNo) { musteriVergiNo.value = ""; musteriVergiNo.disabled = true;setInputClass(musteriVergiNo); }
		musteriVatandasNo.disabled = true;setInputClass(musteriVatandasNo);
		//
		if(p == 1) {
			sigortaSirketKod.disabled = false;
			setInputClass(sigortaSirketKod);
			acenteKod.disabled = false;
			setInputClass(acenteKod);
			policeNo.disabled = false;
			setInputClass(policeNo);
			yenilemeNo.disabled = false;
			setInputClass(yenilemeNo);
			
			plakaIlKod.disabled = true;
			setInputClass(plakaIlKod);
			plakaNo.disabled = true;
			setInputClass(plakaNo);
			motorNo.disabled = true;
			setInputClass(motorNo);
			sasiNo.disabled = true;
			setInputClass(sasiNo);
			if(musteriVergiNo) { musteriVergiNo.disabled = true; setInputClass(musteriVergiNo); }
			musteriVatandasNo.disabled = true;
			setInputClass(musteriVatandasNo);
			

			
		} else if(p == 2) {
			sigortaSirketKod2.disabled = false;
			setInputClass(sigortaSirketKod2);
			hasarDosyaNo.disabled = false;
			setInputClass(hasarDosyaNo); 
			
			plakaIlKod.disabled = true;
			setInputClass(plakaIlKod);
			plakaNo.disabled = true;
			setInputClass(plakaNo);
			motorNo.disabled = true;
			setInputClass(motorNo);
			sasiNo.disabled = true;
			setInputClass(sasiNo);
			if(musteriVergiNo) { musteriVergiNo.disabled = true;setInputClass(musteriVergiNo); }
			musteriVatandasNo.disabled = true;
			setInputClass(musteriVatandasNo);
		}else if(p == 3) {
			sigortaSirketKod.disabled = true;
			setInputClass(sigortaSirketKod);
			acenteKod.disabled = true;
			setInputClass(acenteKod);
			policeNo.disabled = true;
			setInputClass(policeNo);
			yenilemeNo.disabled = true;
			setInputClass(yenilemeNo);
			
			sigortaSirketKod2.disabled = true;
			setInputClass(sigortaSirketKod2);
			hasarDosyaNo.disabled = true;
			setInputClass(hasarDosyaNo);
			
			var sorguTipVal = getCheckedRadio(sorguTip);
			if(sorguTipVal == '1') { plakaIlKod.disabled = false;plakaNo.disabled = false;setInputClass(plakaIlKod);setInputClass(plakaNo); }
			if(sorguTipVal == '2') { motorNo.disabled = false;setInputClass(motorNo); }
			if(sorguTipVal == '3') { sasiNo.disabled = false;setInputClass(sasiNo); }
			if(sorguTipVal == '5') { musteriVergiNo.disabled = false;setInputClass(musteriVergiNo); }
			if(sorguTipVal == '6') { musteriVatandasNo.disabled = false;setInputClass(musteriVatandasNo); }
		}  
		
	}	
}

function initPertSorguScrn(p)
{
	with (document.pertSorguForm) {
		sigortaSirketKod.selectedIndex = -1;
		sigortaSirketKod2.selectedIndex = -1;
		// tüm elemanlar disable yapılsın
		sigortaSirketKod.disabled = true;
		setInputClass(sigortaSirketKod);
		acenteKod.disabled = true;
		setInputClass(acenteKod);
		policeNo.disabled = true;
		setInputClass(policeNo);
		yenilemeNo.disabled = true;
		setInputClass(yenilemeNo);
		
		sigortaSirketKod2.disabled = true;
		setInputClass(sigortaSirketKod2);
		hasarDosyaNo.disabled = true;
		setInputClass(hasarDosyaNo);
		
		plakaIlKod.disabled = true;
		setInputClass(plakaIlKod);
		plakaNo.disabled = true;
		setInputClass(plakaNo);
		motorNo.disabled = true;
		setInputClass(motorNo);
		sasiNo.disabled = true;
		setInputClass(sasiNo);
		if(musteriVergiNo) { musteriVergiNo.disabled = true; setInputClass(musteriVergiNo); }
		musteriVatandasNo.disabled = true;
		setInputClass(musteriVatandasNo);
		// alt radio grup disabled ediliyor 
		for(a = 0; a < 4; a++) {
			sorguTipAlt(a).disabled = true;
			setInputClass(sorguTipAlt(a));
		}
		
		if(p == 1) {
			sigortaSirketKod.disabled = false;
			setInputClass(sigortaSirketKod);
			acenteKod.disabled = false;
			setInputClass(acenteKod);
			policeNo.disabled = false;
			setInputClass(policeNo);
			yenilemeNo.disabled = false;
			setInputClass(yenilemeNo);
		} else if(p == 2) {
			sigortaSirketKod2.disabled = false;
			setInputClass(sigortaSirketKod2);
			hasarDosyaNo.disabled = false;
			setInputClass(hasarDosyaNo);
		} else if(p == 3){
			plakaIlKod.disabled = false;
			setInputClass(plakaIlKod);
			plakaNo.disabled = false;
			setInputClass(plakaNo);
			motorNo.disabled = false;
			setInputClass(motorNo);
			sasiNo.disabled = false;
			setInputClass(sasiNo);
			if(musteriVergiNo) { musteriVergiNo.disabled = false; setInputClass(musteriVergiNo); }
			musteriVatandasNo.disabled = false;
			setInputClass(musteriVatandasNo);
			for(a = 0; a < 4; a++) {
				sorguTipAlt(a).disabled = false;
				setInputClass(sorguTipAlt(a));
			}
		}
		aktifSorgu = p;
	}	
	
}

function kaskoPoliceSorguTipChange(form)
{
	var sorguTip = getCheckedRadio(form.sorguTip);
	
	if (form.sigortaSirketKod.type != "hidden") form.sigortaSirketKod.disabled = true;
	if (form.acenteKod.type != "hidden") form.acenteKod.disabled = true;
	form.policeNo.disabled = true;
	form.yenilemeNo.disabled = true;
	form.plakaIlKod.disabled = true;
	form.plakaNo.disabled = true;
	form.motorNo.disabled = true;
	if (form.sasiNo != null) form.sasiNo.disabled = true;	
	if (form.musteriAd!=null){
		form.musteriAd.disabled = true;
		form.musteriSoyad.disabled = true;
	}
	if (form.musteriVergiNo != null) {
		form.musteriVergiNo.disabled = true;
	}
	if(form.musteriVatandasNo != null) {
		form.musteriVatandasNo.disabled = true;
	}
	form.belgeNo.disabled = true;
	
	/*	Seçilmemis ise degerlerini sifirla		*/
	if (sorguTip != SORGUTIP_POLICE_NO)
	{
		if (form.sigortaSirketKod.type != "hidden") form.sigortaSirketKod.selectedIndex = -1;
		if (form.sigortaSirketKod.type != "hidden") form.acenteKod.value = "";
		form.policeNo.value = "";
		form.yenilemeNo.value = "";
	}
	if (sorguTip != SORGUTIP_PLAKA)
	{	
		form.plakaIlKod.value = "";
		form.plakaNo.value = "";
	}
	if (sorguTip != SORGUTIP_MOTOR)	form.motorNo.value = "";
	if (sorguTip != SORGUTIP_SASI){
		if (form.sasiNo != null) form.sasiNo.value = "";	
	}
	if (sorguTip != SORGUTIP_MUSTERI_AD_SOYAD)
	{	
		if (form.musteriAd != null){
			form.musteriAd.value = "";
			form.musteriSoyad.value = "";
		}
	}
	if (sorguTip != SORGUTIP_MUSTERI_VERGI_NO)	
	{
		if (form.musteriVergiNo != null) {
			form.musteriVergiNo.value = "";
		}
	}
	if (sorguTip != SORGUTIP_MUSTERI_VATANDAS_NO) 
	{
		if(form.musteriVatandasNo != null) {
			form.musteriVatandasNo.value = "";
		}
	}
	if (sorguTip != SORGUTIP_BELGE) form.belgeNo.value = "";


	if (sorguTip == SORGUTIP_POLICE_NO)
	{
		if (form.sigortaSirketKod.type != "hidden") form.sigortaSirketKod.disabled = false;
		if (form.acenteKod.type != "hidden") form.acenteKod.disabled = false;
		form.policeNo.disabled = false;
		form.yenilemeNo.disabled = false;
		if (form.sigortaSirketKod.type != "hidden") setFocus(form.sigortaSirketKod);
		if (form.acenteKod.type != "hidden") setFocus(form.acenteKod);
		else setFocus(form.policeNo);
	}
	else if (sorguTip == SORGUTIP_PLAKA)
	{	
		form.plakaIlKod.disabled = false;
		form.plakaNo.disabled = false;
		setFocus(form.plakaIlKod);
	}
	else if (sorguTip == SORGUTIP_MOTOR)
	{	
		form.motorNo.disabled = false;
		setFocus(form.motorNo);	
	}
	else if (sorguTip == SORGUTIP_SASI)
	{	
		form.sasiNo.disabled = false;	
		setFocus(form.sasiNo);
	}
	else if (sorguTip == SORGUTIP_MUSTERI_AD_SOYAD)
	{	
		form.musteriAd.disabled = false;
		form.musteriSoyad.disabled = false;
		setFocus(form.musteriAd);
	}
	else if (sorguTip == SORGUTIP_MUSTERI_VERGI_NO)
	{	
		form.musteriVergiNo.disabled = false;
		setFocus(form.musteriVergiNo);
	}
	else if (sorguTip == SORGUTIP_MUSTERI_VATANDAS_NO)
	{	
		form.musteriVatandasNo.disabled = false;
		setFocus(form.musteriVatandasNo);
	}
	else if (sorguTip == SORGUTIP_BELGE)
	{	
		form.belgeNo.disabled = false;
		setFocus(form.belgeNo);
	}			

	if (form.sigortaSirketKod.type != "hidden") setInputClass(form.sigortaSirketKod);
	setInputClass(form.policeNo     );
	setInputClass(form.policeNo     );
	setInputClass(form.yenilemeNo   );
	setInputClass(form.plakaIlKod   );
	setInputClass(form.plakaNo      );
	setInputClass(form.motorNo      );
	if (form.sasiNo != null) setInputClass(form.sasiNo       );
	if (form.musteriAd != null){
		setInputClass(form.musteriAd    );
		setInputClass(form.musteriSoyad );
	}
	if(form.musteriVergiNo != null) {
		setInputClass(form.musteriVergiNo    );
	}
	if(form.musteriVatandasNo != null) {
		setInputClass(form.musteriVatandasNo );
	}
	setInputClass(form.belgeNo           );
	
	if (form.acenteKod.type != "hidden") 
		setInputClass(form.acenteKod);		
}

//----------------------------------------
//Kasko policeSorgu scrn usage Acente Eksper
//----------------------------------------

function initKaskoPoliceSorguScrn_Acente()
{
	with (document.policeSorguForm)
	{
		captcha.value="";
		if(newSorgu.value == "E"){
			setCheckedRadio(sorguTip,SORGUTIP_POLICE_NO,true);	
			setCheckedRadio(plakaSorguTip,PLAKASORGUTIP_SASI,true);
			kaskoSayfaGirisSorguAlanlariniSil_Acente();
			kaskoPlakaSorguAlanlariniSil_Acente();
		}	
		else{
			var sorguTipVal = getCheckedRadio(sorguTip);
			setCheckedRadio(sorguTip,SORGUTIP_POLICE_NO,true);
			
			if (policeNo.value != ""){
				setCheckedRadio(sorguTip,SORGUTIP_POLICE_NO,true);		
			}	
			if (plakaIlKod.value != ""){
				setCheckedRadio(sorguTip,SORGUTIP_PLAKA,true);
				
				if(tcKimlikNo.value!="")
					setCheckedRadio(plakaSorguTip,PLAKASORGUTIP_TC,true);		

				if(vergiKimlikNo.value!="")
					setCheckedRadio(plakaSorguTip,PLAKASORGUTIP_VERGI,true);

				if(sasiNoPlaka.value!="")
					setCheckedRadio(plakaSorguTip,PLAKASORGUTIP_SASI,true);		

				if(motorNo.value!="")
					setCheckedRadio(plakaSorguTip,PLAKASORGUTIP_MOTOR,true);																	
			}				
			if (sasiNo.value != ""){ 
				setCheckedRadio(sorguTip,SORGUTIP_SASI,true);
			}			
			if (tramerBelgeNo.value != "" && tramerBelgeNo.value != "0"){ 
				setCheckedRadio(sorguTip,SORGUTIP_BELGE,true);
			}			
		}
		
		kaskoSorguAlanlariniGorunmezYap_Acente();		
		kaskoPoliceSorguTipChange_Acente(true);	
	}	
}

function kaskoPoliceSorguTipChange_Acente()
{
	with (document.policeSorguForm)
	{
		var sorguTipi = getCheckedRadio(sorguTip);
				
		kaskoSorguAlanlariniDisableYap_Acente();

		kaskoSorguAlanlariniSil_Acente();		

		kaskoSorguAlanlariniGorunmezYap_Acente();
				
		if(sorguTipi == SORGUTIP_POLICE_NO)
		{	
			sigortaSirketKod.disabled = false;
			policeNo.disabled = false;
			yenilemeNo.disabled = false;
			acenteKod.disabled = false;
			document.getElementById("pol1").style.display = "";			
			document.getElementById("pol2").style.display = "";
			document.getElementById("pol3").style.display = "";
			
		}	
		if(sorguTipi == SORGUTIP_PLAKA)
		{
			plakaIlKod.disabled = false;
			plakaNo.disabled = false;	

			//plaka ile sorgulamada default secili alan sasi no
			if(tcKimlikNo.value=="" && vergiKimlikNo.value=="" && sasiNoPlaka.value=="" && motorNo.value==""){
				setCheckedRadio(plakaSorguTip,PLAKASORGUTIP_SASI,true);
			}
			
			var plakaSorguTipVal = getCheckedRadio(plakaSorguTip);
				
			if(plakaSorguTipVal == PLAKASORGUTIP_SASI)
				sasiNoPlaka.disabled = false;
			if(plakaSorguTipVal == PLAKASORGUTIP_TC)
				tcKimlikNo.disabled = false;
			if(plakaSorguTipVal == PLAKASORGUTIP_VERGI)
				vergiKimlikNo.disabled = false;
			if(plakaSorguTipVal == PLAKASORGUTIP_MOTOR)
				motorNo.disabled = false;
												
			document.getElementById("plaka3").style.display = "";	
			document.getElementById("plaka4").style.display = "";
			document.getElementById("plaka5").style.display = "";		
			document.getElementById("plaka6").style.display = "";	
		}			
		if(sorguTipi == SORGUTIP_SASI)
		{
			sasiNo.disabled = false;
			policeBitisYearSasiNo.disabled = false;
			sigortaSirketKodSasi.disabled = false;			
			document.getElementById("sasi1").style.display = "";
			document.getElementById("sasi2").style.display = "";			
		}	
		if(sorguTipi == SORGUTIP_BELGE)
		{
			tramerBelgeNo.disabled = false;
			sigortaSirketKodBelge.disabled = false;			
			document.getElementById("belge1").style.display = "";
		}		

		setInputClass(sigortaSirketKod  );
		setInputClass(acenteKod    );		
		setInputClass(plakaIlKod   );
		setInputClass(plakaNo      );
		setInputClass(sasiNo       );
		setInputClass(policeBitisYearSasiNo);
		setInputClass(motorNo	   );
		setInputClass(sasiNoPlaka  );
		setInputClass(tcKimlikNo   );
		setInputClass(vergiKimlikNo);	
		setInputClass(tramerBelgeNo);				
	}
}	

function kaskoPlakaSorguTipChanged_Acente()
{
	with (document.policeSorguForm)
	{
		var plakaSorguTipVal = getCheckedRadio(plakaSorguTip);
		
		kaskoPlakaSorguAlanlariniSil_Acente();

		sasiNoPlaka.disabled = true;
		motorNo.disabled = true;
		vergiKimlikNo.disabled = true;
		tcKimlikNo.disabled = true;
		
		if(plakaSorguTipVal == PLAKASORGUTIP_SASI)
		{
			sasiNoPlaka.disabled = false;
		}
		if(plakaSorguTipVal == PLAKASORGUTIP_VERGI)
		{
			vergiKimlikNo.disabled = false;
		}
		if(plakaSorguTipVal == PLAKASORGUTIP_TC)
		{
			tcKimlikNo.disabled = false;
		}			
		if(plakaSorguTipVal == PLAKASORGUTIP_MOTOR)
		{
			motorNo.disabled = false;
		}								
			
		setInputClass(motorNo	   );
		setInputClass(sasiNoPlaka  );
		setInputClass(tcKimlikNo   );
		setInputClass(vergiKimlikNo);
	}
}

function kaskoSayfaGirisSorguAlanlariniSil_Acente(){

	with (document.policeSorguForm)
	{
		acenteKod.value="";
		policeNo.value="";
		yenilemeNo.value="";
		sigortaSirketKod.selectedIndex = -1;
		plakaIlKod.value="";
		plakaNo.value="";	
		tcKimlikNo.value="";
		vergiKimlikNo.value="";	
		motorNo.value="";
		sasiNoPlaka.value="";		
		policeBitisYearSasiNo.value="";	
		sasiNo.value="";			
		sigortaSirketKodSasi.selectedIndex = -1;
		tramerBelgeNo.value="";			
		sigortaSirketKodBelge.selectedIndex = -1;
	}
}

function kaskoPlakaSorguAlanlariniSil_Acente()
{
	with (document.policeSorguForm)
	{
		motorNo.value = "";
		sasiNoPlaka.value = "";
		vergiKimlikNo.value = "";
		tcKimlikNo.value = "";				
	}
}

function kaskoSorguAlanlariniSil_Acente()
{
	with (document.policeSorguForm)
	{
		var sorguTipVal = getCheckedRadio(sorguTip);

		if (sorguTipVal != SORGUTIP_POLICE_NO){
			acenteKod.value="";
			policeNo.value="";
			yenilemeNo.value="";
			sigortaSirketKod.selectedIndex = -1;			
		}		
		if (sorguTipVal != SORGUTIP_PLAKA){
			plakaIlKod.value="";
			plakaNo.value="";	
			tcKimlikNo.value="";
			vergiKimlikNo.value="";	
			motorNo.value="";
			sasiNoPlaka.value="";
		}		
		if (sorguTipVal != SORGUTIP_SASI){
			policeBitisYearSasiNo.value="";	
			sasiNo.value="";			
			sigortaSirketKodSasi.selectedIndex = -1;					
		}	
		if(sorguTipVal == SORGUTIP_PLAKA){

			var plakaSorguTipVal = getCheckedRadio(plakaSorguTip);

			if(plakaSorguTipVal != PLAKASORGUTIP_SASI){
				sasiNoPlaka.value="";
			}
			if(plakaSorguTipVal != PLAKASORGUTIP_TC){
				tcKimlikNo.value="";
			}
			if(plakaSorguTipVal != PLAKASORGUTIP_VERGI){
				vergiKimlikNo.value="";					
			}
			if(plakaSorguTipVal != PLAKASORGUTIP_MOTOR){
				motorNo.value="";					
			}			
					
		}
		if (sorguTipVal != SORGUTIP_BELGE){
			tramerBelgeNo.value="";	
			sigortaSirketKodBelge.selectedIndex = -1;					
		}	
			
	}
}

function kaskoSorguAlanlariniGorunmezYap_Acente()
{
	with (document.policeSorguForm)
	{
		document.getElementById("pol1").style.display = "none";		
		document.getElementById("pol2").style.display = "none";		
		document.getElementById("pol3").style.display = "none";		
		document.getElementById("plaka3").style.display = "none";
		document.getElementById("plaka4").style.display = "none";
		document.getElementById("plaka5").style.display = "none";
		document.getElementById("plaka6").style.display = "none";			
		document.getElementById("sasi1").style.display = "none";			
		document.getElementById("sasi2").style.display = "none";
		document.getElementById("belge1").style.display = "none";
	}
}	

function kaskoSorguAlanlariniDisableYap_Acente()
{
	with (document.policeSorguForm)
	{
		sigortaSirketKod.disabled=true;
		policeNo.disabled = true;
		yenilemeNo.disabled=true;
		plakaIlKod.disabled = true;
		plakaNo.disabled = true;
		sasiNo.disabled = true;
		sasiNoPlaka.disabled = true;
		tcKimlikNo.disabled = true;
		vergiKimlikNo.disabled = true;
		policeBitisYearSasiNo.disabled = true;
		sigortaSirketKodSasi.disabled = true;	
		motorNo.disabled = true;
		tramerBelgeNo.disabled = true;
		sigortaSirketKodBelge.disabled = true;
	}
}	

function checkKaskoPoliceSorguScrn_Acente()
{
	with (document.policeSorguForm)
	{
		var sorguTipi = getCheckedRadio(sorguTip);
		var plakaSorguTipVal = getCheckedRadio(plakaSorguTip);

		//police no ile sorgulama kontolleri
		if(sorguTipi == SORGUTIP_POLICE_NO)
		{	
			if(sigortaSirketKod.selectedIndex == -1)
				return reportError(sigortaSirketKod,hasarBelgeSigortaSirketKod);
							
			acenteKod.value = acenteKod.value.trim();
			if (acenteKod.value.length == 0) return reportError(acenteKod,hasarBelgeAcenteKod);

			policeNo.value = policeNo.value.trim();
			if (policeNo.value.length == 0) return reportError(policeNo,hasarBelgePoliceNo);

			yenilemeNo.value = yenilemeNo.value.trim();
			if (yenilemeNo.value.length == 0) yenilemeNo.value = "0";			
		}
		// plaka ile sorgulama kontrolleri			
		if(sorguTipi == SORGUTIP_PLAKA)
		{			
			plakaIlKod.value = plakaIlKod.value.trim();
			if (plakaIlKod.value.length == 0) return reportError(plakaIlKod,hasarBelgePlaka);
			if (isNaN(plakaIlKod.value)) return reportError(plakaIlKod,hasarBelgePlakaIlKodGecersiz);
			
			plakaNo.value = plakaNo.value.trim();
			if (plakaNo.value.length == 0) return reportError(plakaNo,hasarBelgePlaka);
			
			//plaka no 2 haneden kucuk ise sorgulama yapilamayacak
			if (plakaNo.value.length < 2) 
				return reportError(plakaNo,plakaNoGecersiz);
			
			if (!plakaGecerliMi(plakaNo))
				return reportError(plakaNo, plakaNoGecici);				
						
			if(plakaSorguTipVal == PLAKASORGUTIP_TC)
			{
				tcKimlikNo.value = tcKimlikNo.value.trim();
				if (tcKimlikNo.value.length == 0) return reportError(tcKimlikNo,tcKimlikNoGirilmemis);

				if (isNaN(tcKimlikNo.value)) return reportError(tcKimlikNo,tcKimlikNoHatali);
				
				//11 basamaktan az girildiyse ve plaka gecici vs. ise sorgulama yapilamayacak
				if (tcKimlikNo.value.length != 11) 
					return reportError(tcKimlikNo,tcKimlikNoGecersiz);
					
				// 11 basamak da ayni girildiyse ve plaka ge?ici vs. ise sorgulama yapilamayacak
				if (basamaklarAyni(tcKimlikNo)) 
					return reportError(tcKimlikNo,tcKimlikNoHatali);
			}			
			if(plakaSorguTipVal == PLAKASORGUTIP_VERGI)
			{
				vergiKimlikNo.value = vergiKimlikNo.value.trim();
				if (vergiKimlikNo.value.length == 0) return reportError(vergiKimlikNo,vergiKimlikNoGirilmemis);
				
				if (isNaN(vergiKimlikNo.value)) return reportError(vergiKimlikNo,vergiKimlikNoHatali);

				if (vergiKimlikNo.value.length != 10) 
					return reportError(vergiKimlikNo,vergiKimlikNoGecersiz);
				
				if (basamaklarAyni(vergiKimlikNo)) 
					return reportError(vergiKimlikNo,vergiKimlikNoHatali);					
			}
			if(plakaSorguTipVal == PLAKASORGUTIP_SASI)
			{
				if (!sasiNoGecerliMi(sasiNoPlaka)) return reportError(sasiNoPlaka,gecersizSasiNoIleSorgu);
				
				sasiNoPlaka.value = sasiNoPlaka.value.trim();
				if (sasiNoPlaka.value.length == 0) return reportError(sasiNoPlaka,hasarBelgeSasiNo);
				
				//var upperCasePlaka = plakaNo.value.toUpperCase();
				if (sasiNoPlaka.value.length < 4) 
					return reportError(sasiNoPlaka, sasiNoGecersiz);
			}
			if(plakaSorguTipVal == PLAKASORGUTIP_MOTOR)
			{
				if (!motorNoGecerliMi(motorNo)) return reportError(motorNo,gecersizMotorNoIleSorgu);
				
				motorNo.value = motorNo.value.trim();
				if (motorNo.value.length == 0) return reportError(motorNo,policeMotorNo);
			
				if (motorNo.value.length < 4) 
					return reportError(motorNo, motorNoGecersiz);				
			}			
			if(plakaSorguTipVal == null)
				return reportError(plakaNo,plakaNoSorguKriteriEksik);	
		}
			
		//?asi ile sorgulama kontolleri
		if(sorguTipi == SORGUTIP_SASI)
		{
			if (!sasiNoGecerliMi(sasiNo)) return reportError(sasiNo,gecersizSasiNoIleSorgu);
		
			sasiNo.value = sasiNo.value.trim();
			if (sasiNo.value.length == 0) return reportError(sasiNo,hasarBelgeSasiNo);
			
			if (sasiNo.value.length < 4) return reportError(sasiNo,sasiNoGecersizKriter);
			
			if(sigortaSirketKodSasi.selectedIndex == -1)
				return reportError(sigortaSirketKodSasi,hasarBelgeSigortaSirketKod);
	
			
			policeBitisYearSasiNo.value = policeBitisYearSasiNo.value.trim();
			if (policeBitisYearSasiNo.value.length == 0) return reportError(policeBitisYearSasiNo,hasarBelgePoliceBitisYear);
			if (isNaN(policeBitisYearSasiNo.value))
				return reportError(policeBitisYearSasiNo,hasarBelgePoliceBitisYearGecersiz);
			else {
				var policeBitisYearVal = Number(policeBitisYearSasiNo.value);
				if (policeBitisYearVal < POLICE_BITIS_YIL_KONTROL) return reportError(policeBitisYearSasiNo,hasarBelgePoliceBitisYearGecersiz);
			}					
		}	

		//tramer Belge No ile sorgulama kontolleri
		if(sorguTipi == SORGUTIP_BELGE)
		{
			tramerBelgeNo.value = tramerBelgeNo.value.trim();
			if (tramerBelgeNo.value.length == 0) return reportError(tramerBelgeNo,hasarBelgeTramerBelgeNo);
			if (tramerBelgeNo.value == '0') return reportError(tramerBelgeNo,hasarBelgeTramerBelgeNo);
			if (isNaN(tramerBelgeNo.value)) return reportError(tramerBelgeNo,tramerBelgeNoGecersiz);
			if (sigortaSirketKodBelge.selectedIndex == -1) return reportError(sigortaSirketKodBelge,hasarBelgeSigortaSirketKod);
		}

		var noc = document.getElementById("noCaptcha");
		if (noc == null || noc.value!="TRAMER") {
			captcha.value = captcha.value.trim();
			if (captcha.value.length == "0") return reportError(captcha, captchaTextRequired); 	
		}

	}
}


//----------------------------------------
// policePublicSorgu scrn usage
//----------------------------------------
function initKaskoPolicePublicSorguScrn()
{
	with (document.policePublicSorguForm)
	{
		captcha.value = "";
		if(newSorgu.value == "E"){
			setCheckedRadio(sorguTip,SORGUTIP_POLICE_NO,true);	
			setCheckedRadio(plakaSorguTip,PLAKASORGUTIP_SASI,true);
			kaskoSayfaGirisSorguAlanlariniSil();
			kaskoPlakaSorguAlanlariniSil();
		}	
		else{
			var sorguTipVal = getCheckedRadio(sorguTip);
			setCheckedRadio(sorguTip,SORGUTIP_POLICE_NO,true);
			
			if (policeNo.value != ""){
				setCheckedRadio(sorguTip,SORGUTIP_POLICE_NO,true);		
			}	
			if (plakaIlKod.value != ""){
				setCheckedRadio(sorguTip,SORGUTIP_PLAKA,true);
				
				if(tcKimlikNo.value!="")
					setCheckedRadio(plakaSorguTip,PLAKASORGUTIP_TC,true);		

				if(vergiKimlikNo.value!="")
					setCheckedRadio(plakaSorguTip,PLAKASORGUTIP_VERGI,true);

				if(sasiNoPlaka.value!="")
					setCheckedRadio(plakaSorguTip,PLAKASORGUTIP_SASI,true);		

				if(motorNo.value!="")
					setCheckedRadio(plakaSorguTip,PLAKASORGUTIP_MOTOR,true);																	
			}				
			if (sasiNo.value != ""){ 
				setCheckedRadio(sorguTip,SORGUTIP_SASI,true);
			}			

			if(tramerBelgeNo.value!=""){
				setCheckedRadio(sorguTip,SORGUTIP_BELGE,true);						
		}
		}
		
		kaskoSorguAlanlariniGorunmezYap();		
		kaskoPolicePublicSorguTipChange(true);	
	}	
}
function kaskoPlakaSorguAlanlariniSil()
{
	with (document.policePublicSorguForm)
	{
			motorNo.value = "";
			sasiNoPlaka.value = "";
			vergiKimlikNo.value = "";
			tcKimlikNo.value = "";			
			tramerBelgeNo.value="";		
			sigortaSirketKodBelge.selectedIndex = -1;		
	}
}


function kaskoPlakaSorguTipChanged()
{
	with (document.policePublicSorguForm)
	{
		var plakaSorguTipVal = getCheckedRadio(plakaSorguTip);
		
		kaskoPlakaSorguAlanlariniSil();

		sasiNoPlaka.disabled = true;
		motorNo.disabled = true;
		vergiKimlikNo.disabled = true;
		tcKimlikNo.disabled = true;
		
		if(plakaSorguTipVal == PLAKASORGUTIP_SASI)
		{
			sasiNoPlaka.disabled = false;
		}
		if(plakaSorguTipVal == PLAKASORGUTIP_VERGI)
		{
			vergiKimlikNo.disabled = false;
		}
		if(plakaSorguTipVal == PLAKASORGUTIP_TC)
		{
			tcKimlikNo.disabled = false;
		}			
		if(plakaSorguTipVal == PLAKASORGUTIP_MOTOR)
		{
			motorNo.disabled = false;
		}								
			
		setInputClass(motorNo	   );
		setInputClass(sasiNoPlaka  );
		setInputClass(tcKimlikNo   );
		setInputClass(vergiKimlikNo);	
		setInputClass(vergiKimlikNo);		
	}
}

function kaskoPolicePublicSorguTipChange()
{
	with (document.policePublicSorguForm)
	{
		var sorguTipi = getCheckedRadio(sorguTip);
				
		kaskoSorguAlanlariniDisableYap();

		kaskoSorguAlanlariniSil();		

		kaskoSorguAlanlariniGorunmezYap();
				
		if(sorguTipi == SORGUTIP_POLICE_NO)
		{	
			sigortaSirketKod.disabled = false;
			policeNo.disabled = false;
			yenilemeNo.disabled = false;
			acenteKod.disabled = false;
			document.getElementById("pol1").style.display = "";			
			document.getElementById("pol2").style.display = "";
			document.getElementById("pol3").style.display = "";
			
		}	
		if(sorguTipi == SORGUTIP_PLAKA)
		{
			plakaIlKod.disabled = false;
			plakaNo.disabled = false;	

			//plaka ile sorgulamada default seçili alan sasi no
			if(tcKimlikNo.value=="" && vergiKimlikNo.value=="" && sasiNoPlaka.value=="" && motorNo.value==""){
				setCheckedRadio(plakaSorguTip,PLAKASORGUTIP_SASI,true);
			}
			
			var plakaSorguTipVal = getCheckedRadio(plakaSorguTip);
				
			if(plakaSorguTipVal == PLAKASORGUTIP_SASI)
				sasiNoPlaka.disabled = false;
			if(plakaSorguTipVal == PLAKASORGUTIP_TC)
				tcKimlikNo.disabled = false;
			if(plakaSorguTipVal == PLAKASORGUTIP_VERGI)
				vergiKimlikNo.disabled = false;
			if(plakaSorguTipVal == PLAKASORGUTIP_MOTOR)
				motorNo.disabled = false;
												
			document.getElementById("plaka3").style.display = "";	
			document.getElementById("plaka4").style.display = "";
			document.getElementById("plaka5").style.display = "";		
			document.getElementById("plaka6").style.display = "";	
		}			
		if(sorguTipi == SORGUTIP_SASI)
		{
			sasiNo.disabled = false;
			policeBitisYearSasiNo.disabled = false;
			sigortaSirketKodSasi.disabled = false;			
			document.getElementById("sasi1").style.display = "";
			document.getElementById("sasi2").style.display = "";			
		}	
				
		if(sorguTipi == SORGUTIP_BELGE)
		{
			tramerBelgeNo.disabled = false;
			sigortaSirketKodBelge.disabled = false;			
			document.getElementById("belge1").style.display = "";
		}		
					
		setInputClass(sigortaSirketKod  );
		setInputClass(acenteKod    );		
		setInputClass(plakaIlKod   );
		setInputClass(plakaNo      );
		setInputClass(sasiNo       );
		setInputClass(policeBitisYearSasiNo);
		setInputClass(motorNo	   );
		setInputClass(sasiNoPlaka  );
		setInputClass(tcKimlikNo   );
		setInputClass(vergiKimlikNo);	
		setInputClass(vergiKimlikNo);				
		setInputClass(sigortaSirketKodBelge);
		setInputClass(tramerBelgeNo);	
	}
}	
	
function kaskoSorguAlanlariniDisableYap()
{
	with (document.policePublicSorguForm)
	{
		sigortaSirketKod.disabled=true;
		policeNo.disabled = true;
		yenilemeNo.disabled=true;
		plakaIlKod.disabled = true;
		plakaNo.disabled = true;
		sasiNo.disabled = true;
		sasiNoPlaka.disabled = true;
		tcKimlikNo.disabled = true;
		vergiKimlikNo.disabled = true;
		policeBitisYearSasiNo.disabled = true;
		sigortaSirketKodSasi.disabled = true;	
		motorNo.disabled = true;
		sigortaSirketKodBelge.disabled = true;	
		tramerBelgeNo.disabled = true;		
	}
}	

function kaskoSorguAlanlariniGorunmezYap()
{
	with (document.policePublicSorguForm)
	{
		document.getElementById("pol1").style.display = "none";		
		document.getElementById("pol2").style.display = "none";		
		document.getElementById("pol3").style.display = "none";			
		document.getElementById("plaka3").style.display = "none";
		document.getElementById("plaka4").style.display = "none";
		document.getElementById("plaka5").style.display = "none";
		document.getElementById("plaka6").style.display = "none";			
		document.getElementById("sasi1").style.display = "none";			
		document.getElementById("sasi2").style.display = "none";
		document.getElementById("belge1").style.display = "none";
	}
}	
function kaskoSayfaGirisSorguAlanlariniSil(){
	with (document.policePublicSorguForm)
	{
		acenteKod.value="";
		policeNo.value="";
		yenilemeNo.value="";
		sigortaSirketKod.selectedIndex = -1;
		plakaIlKod.value="";
		plakaNo.value="";	
		tcKimlikNo.value="";
		vergiKimlikNo.value="";	
		motorNo.value="";
		sasiNoPlaka.value="";		
		policeBitisYearSasiNo.value="";	
		sasiNo.value="";			
		sigortaSirketKodSasi.selectedIndex = -1;		
		tramerBelgeNo.value="";			
		sigortaSirketKodBelge.selectedIndex = -1;			
	}
}
function kaskoSorguAlanlariniSil()
{
	with (document.policePublicSorguForm)
	{
		var sorguTipVal = getCheckedRadio(sorguTip);

		if (sorguTipVal != SORGUTIP_POLICE_NO){
			acenteKod.value="";
			policeNo.value="";
			yenilemeNo.value="";
			sigortaSirketKod.selectedIndex = -1;			
		}		
		if (sorguTipVal != SORGUTIP_PLAKA){
			plakaIlKod.value="";
			plakaNo.value="";	
			tcKimlikNo.value="";
			vergiKimlikNo.value="";	
			motorNo.value="";
			sasiNoPlaka.value="";
		}		
		if (sorguTipVal != SORGUTIP_SASI){
			policeBitisYearSasiNo.value="";	
			sasiNo.value="";			
			sigortaSirketKodSasi.selectedIndex = -1;					
		}	
		if (sorguTipVal != SORGUTIP_BELGE){
			tramerBelgeNo.value="";			
			sigortaSirketKodBelge.selectedIndex = -1;					
		}		
		if(sorguTipVal == SORGUTIP_PLAKA){

			var plakaSorguTipVal = getCheckedRadio(plakaSorguTip);
			
			if(plakaSorguTipVal != PLAKASORGUTIP_SASI){
				sasiNoPlaka.value="";
			}
			if(plakaSorguTipVal != PLAKASORGUTIP_TC){
				tcKimlikNo.value="";
			}
			if(plakaSorguTipVal != PLAKASORGUTIP_VERGI){
				vergiKimlikNo.value="";					
			}
			if(plakaSorguTipVal != PLAKASORGUTIP_MOTOR){
				motorNo.value="";					
			}							
		}			
	}
}

function checkKaskoPolicePublicSorguScrn()
{
	with (document.policePublicSorguForm)
	{
		var sorguTipi = getCheckedRadio(sorguTip);
		var plakaSorguTipVal = getCheckedRadio(plakaSorguTip);

		//poliçe no ile sorgulama kontolleri
		if(sorguTipi == SORGUTIP_POLICE_NO)
		{	
			if(sigortaSirketKod.selectedIndex == -1)
				return reportError(sigortaSirketKod,hasarBelgeSigortaSirketKod);
							
			acenteKod.value = acenteKod.value.trim();
			if (acenteKod.value.length == 0) return reportError(acenteKod,hasarBelgeAcenteKod);

			policeNo.value = policeNo.value.trim();
			if (policeNo.value.length == 0) return reportError(policeNo,hasarBelgePoliceNo);

			yenilemeNo.value = yenilemeNo.value.trim();
			if (yenilemeNo.value.length == 0) yenilemeNo.value = "0";			
		}
		// plaka ile sorgulama kontrolleri			
		if(sorguTipi == SORGUTIP_PLAKA)
		{			
			plakaIlKod.value = plakaIlKod.value.trim();
			if (plakaIlKod.value.length == 0) return reportError(plakaIlKod,hasarBelgePlaka);
			if (isNaN(plakaIlKod.value)) return reportError(plakaIlKod,hasarBelgePlakaIlKodGecersiz);
			
			plakaNo.value = plakaNo.value.trim();
			if (plakaNo.value.length == 0) return reportError(plakaNo,hasarBelgePlaka);
			
			//plaka no 2 haneden küçük ise sorgulama yap?lamayacak
			if (plakaNo.value.length < 2) 
				return reportError(plakaNo,plakaNoGecersiz);
				
			if (!plakaGecerliMi(plakaNo.toUpperCase()))
				return reportError(plakaNo, plakaNoGecici);				
							
			if(plakaSorguTipVal == PLAKASORGUTIP_TC)
			{
				tcKimlikNo.value = tcKimlikNo.value.trim();
				if (tcKimlikNo.value.length == 0) return reportError(tcKimlikNo,tcKimlikNoGirilmemis);

				if (isNaN(tcKimlikNo.value)) return reportError(tcKimlikNo,tcKimlikNoHatali);
				
				//11 basamaktan az girildiyse ve plaka ge?ici vs. ise sorgulama yapılamayacak
				if (tcKimlikNo.value.length != 11) 
					return reportError(tcKimlikNo,tcKimlikNoGecersiz);
					
				// 11 basamak da aynı girildiyse ve plaka geçici vs. ise sorgulama yapılamayacak
				if (basamaklarAyni(tcKimlikNo)) 
					return reportError(tcKimlikNo,tcKimlikNoHatali);
			}			
			if(plakaSorguTipVal == PLAKASORGUTIP_VERGI)
			{
				vergiKimlikNo.value = vergiKimlikNo.value.trim();
				if (vergiKimlikNo.value.length == 0) return reportError(vergiKimlikNo,vergiKimlikNoGirilmemis);
				
				if (isNaN(vergiKimlikNo.value)) return reportError(vergiKimlikNo,vergiKimlikNoHatali);

				if (vergiKimlikNo.value.length != 10) 
					return reportError(vergiKimlikNo,vergiKimlikNoGecersiz);
				
				if (basamaklarAyni(vergiKimlikNo)) 
					return reportError(vergiKimlikNo,vergiKimlikNoHatali);					
			}
			if(plakaSorguTipVal == PLAKASORGUTIP_SASI)
			{
				if (!sasiNoGecerliMi(sasiNoPlaka)) return reportError(sasiNoPlaka,gecersizSasiNoIleSorgu);
				
				sasiNoPlaka.value = sasiNoPlaka.value.trim();
				if (sasiNoPlaka.value.length == 0) return reportError(sasiNoPlaka,hasarBelgeSasiNo);
				
				//var upperCasePlaka = plakaNo.value.toUpperCase();
				if (sasiNoPlaka.value.length < 4) 
					return reportError(sasiNoPlaka, sasiNoGecersiz);
			}
			if(plakaSorguTipVal == PLAKASORGUTIP_MOTOR)
			{
				if (!motorNoGecerliMi(motorNo)) return reportError(motorNo,gecersizMotorNoIleSorgu);
				
				motorNo.value = motorNo.value.trim();
				if (motorNo.value.length == 0) return reportError(motorNo,policeMotorNo);
			
				if (motorNo.value.length < 4) 
					return reportError(motorNo, motorNoGecersiz);				
			}			
			if(plakaSorguTipVal == null)
				return reportError(plakaNo,plakaNoSorguKriteriEksik);						
		}	
		//sasi ile sorgulama kontolleri
		if(sorguTipi == SORGUTIP_SASI)
		{
			if (!sasiNoGecerliMi(sasiNo)) return reportError(sasiNo,gecersizSasiNoIleSorgu);
			
			sasiNo.value = sasiNo.value.trim();
			if (sasiNo.value.length == 0) return reportError(sasiNo,hasarBelgeSasiNo);
			
			if (sasiNo.value.length < 4) return reportError(sasiNo,sasiNoGecersizKriter);
			
			if(sigortaSirketKodSasi.selectedIndex == -1)
				return reportError(sigortaSirketKodSasi,hasarBelgeSigortaSirketKod);
	
			
			policeBitisYearSasiNo.value = policeBitisYearSasiNo.value.trim();
			if (policeBitisYearSasiNo.value.length == 0) return reportError(policeBitisYearSasiNo,hasarBelgePoliceBitisYear);
			if (isNaN(policeBitisYearSasiNo.value))
				return reportError(policeBitisYearSasiNo,hasarBelgePoliceBitisYearGecersiz);
			else {
				var policeBitisYearVal = Number(policeBitisYearSasiNo.value);
				if (policeBitisYearVal < POLICE_BITIS_YIL) return reportError(policeBitisYearSasiNo,hasarBelgePoliceBitisYearGecersiz);
			}					
		}				
		//tramer Belge No ile sorgulama kontolleri
		if(sorguTipi == SORGUTIP_BELGE)
		{
			tramerBelgeNo.value = tramerBelgeNo.value.trim();
			
			if (tramerBelgeNo.value.length == 0) return reportError(tramerBelgeNo,hasarBelgeTramerBelgeNo);

			if (tramerBelgeNo.value == '0') return reportError(tramerBelgeNo,hasarBelgeTramerBelgeNo);
						
			if (isNaN(tramerBelgeNo.value)) return reportError(tramerBelgeNo,tramerBelgeNoGecersiz);
			
			if (sigortaSirketKodBelge.selectedIndex == -1) return reportError(sigortaSirketKodBelge,hasarBelgeSigortaSirketKod);
		}

		captcha.value = captcha.value.trim();
		if (captcha.value.length == "0") return reportError(captcha, captchaTextRequired); 	
	}
}

function checkKaskoPoliceLimitliSorguScrn(){
	with (document.limitliPoliceBilgileriForm)
	{
		// plaka ile ilgili kontroller 
		plakaIlKodu.value = plakaIlKodu.value.trim();
		if (plakaIlKodu.value.length == 0) return reportError(plakaIlKodu,policePlaka);
		if (isNaN(plakaIlKodu.value)) return reportError(plakaIlKodu,policePlakaIlKodGecersiz);

		plakaNo.value = plakaNo.value.trim();
		if (plakaNo.value.length == 0) return reportError(plakaNo,policePlaka);

		if(userTip.value != USERTIP_TRAMER)
		{
			if (!plakaGecerliMi(plakaNo))
				return reportError(plakaNo, plakaNoGecici);	
		}			
			
		if (userTip.value != USERTIP_TRAMER && plakaNo.value.length < 5) 
			return reportError(plakaNo, policePlakaNoGecersiz);

		// tarih ile ilgili kontroller	
		gecerlilikTarih.value = gecerlilikTarih.value.trim();
		if (gecerlilikTarih.value.length == 0) return reportError(gecerlilikTarih,policeGenelSorguTarih);
		if (!checkDate(gecerlilikTarih.value)) return reportError(gecerlilikTarih,policeGenelSorguTarihGecersiz);	
			
	}
	return true;
}

function checkKaskoPoliceSorguScrn123()
{
	with (document.pertSorguForm)
	{
		var sorguTipVal = getCheckedRadio(sorguTip);		

		if (sorguTipVal == SORGUTIP_POLICE_NO)
		{
			if (sigortaSirketKod.selectedIndex == -1 || sigortaSirketKod.value == '')return reportError(sigortaSirketKod,policeSigortaSirketKod);
			
			acenteKod.value = acenteKod.value.trim();
			if (acenteKod.value.length == 0) return reportError(acenteKod,policeAcenteKod);
			
			policeNo.value = policeNo.value.trim();
			if (policeNo.value.length == 0) return reportError(policeNo,policePoliceNo);

			yenilemeNo.value = yenilemeNo.value.trim();
			if (yenilemeNo.value.length == 0) return reportError(yenilemeNo,policeYenilemeNo);
		}
		else if (sorguTipVal == SORGUTIP_PLAKA)
		{
			plakaIlKod.value = plakaIlKod.value.trim();
			if (plakaIlKod.value.length == 0) return reportError(plakaIlKod,policePlaka);
			if (isNaN(plakaIlKod.value)) return reportError(plakaIlKod,policePlakaIlKodGecersiz);

			plakaNo.value = plakaNo.value.trim();
			if (plakaNo.value.length == 0) return reportError(plakaNo,policePlaka);
			
			if (!plakaGecerliMi(plakaNo)) return reportError(plakaNo, plakaNoGecici);	

			if (userTip.value != USERTIP_TRAMER && plakaNo.value.length < 5) 
				return reportError(plakaNo,policePlakaNoGecersiz);			
		}		
		else if (sorguTipVal == SORGUTIP_MOTOR)
		{		
			if (!motorNoGecerliMi(motorNo)) return reportError(motorNo,gecersizMotorNoIleSorgu);
			
			motorNo.value = motorNo.value.trim();
			if (motorNo.value.length == 0) return reportError(motorNo,policeMotorNo);
		}
		else if (sorguTipVal == SORGUTIP_SASI)
		{	
			if (!sasiNoGecerliMi(sasiNo)) return reportError(sasiNo,gecersizSasiNoIleSorgu);
			
			sasiNo.value = sasiNo.value.trim();
			if (sasiNo.value.length == 0) return reportError(sasiNo,policeSasiNo);
		}
		else if (sorguTipVal == SORGUTIP_MUSTERI_AD_SOYAD)
		{	
			musteriAd.value = musteriAd.value.trim();
			if (musteriAd.value.length == 0) return reportError(musteriAd,policeMusteriAd);			
			musteriSoyad.value = musteriSoyad.value.trim();
			if (musteriSoyad.value.length == 0) return reportError(musteriSoyad,policeMusteriSoyad);			
		}
		else if (sorguTipVal == SORGUTIP_MUSTERI_VERGI_NO)
		{	
			musteriVergiNo.value = musteriVergiNo.value.trim();
			if (isNaN(musteriVergiNo.value)) return reportError(musteriVergiNo,policeMusteriVergiNoHatali);
			else if (musteriVergiNo.value.length == 0) return reportError(musteriVergiNo,policeMusteriVergiNo);
			else if (musteriVergiNo.value.length != 10) return reportError(musteriVergiNo,policeMusteriVergiNoUzunluguHatali);
			else if (basamaklarAyni(musteriVergiNo)) return reportError(musteriVergiNo,policeMusteriVergiNoHatali);
		}
		else if (sorguTipVal == SORGUTIP_MUSTERI_VATANDAS_NO)
		{	
			musteriVatandasNo.value = musteriVatandasNo.value.trim();
			if (isNaN(musteriVatandasNo.value)) return reportError(musteriVatandasNo,policeMusteriVatandasNoHatali);
			else if (musteriVatandasNo.value.length == 0) return reportError(musteriVatandasNo,policeMusteriVatandasNo);
			else if (musteriVatandasNo.value.length != 11) return reportError(musteriVatandasNo,policeMusteriVatandasNoUzunluguHatali);
			else if (basamaklarAyni(musteriVatandasNo)) return reportError(musteriVatandasNo,policeMusteriVatandasNoHatali);
		}		
		else if (sorguTipVal == SORGUTIP_BELGE)
		{	
			belgeNo.value = belgeNo.value.trim();
			if (belgeNo.value.length == 0 ) return reportError(belgeNo,policeBelgeBelgeNoNo);
			if (belgeNo.value == "0") return reportError(belgeNo,policeBelgeNoHatali);
		}
		else if (sorguTipVal == SORGUTIP_HASAR_BELGE_NO)
		{	
			hasarDosyaNo.value = hasarDosyaNo.value.trim();
			if(sigortaSirketKod2.value == '') return reportError(sigortaSirketKod2, "Sigorta şirketi seçilmelidir...");
			if (hasarDosyaNo.value.length == 0 ) return reportError(hasarDosyaNo,"Hasar Dosya No girmelisiniz.");
			if (hasarDosyaNo.value == "0") return reportError(hasarDosyaNo,"Hasar Dosya No yanlış girdiniz.");
		}
		
		var noc = document.getElementById("noCaptcha");
		if (noc == null || noc.value!="TRAMER") {
			captcha.value = captcha.value.trim();
			if (captcha.value.length == "0") return reportError(captcha, captchaTextRequired); 	
		}
	}
	return true;
}

