// codes for scroll starts. //
function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function GetDivProperty() {
	this.opera = (window.opera); this.ns4 = (document.layers); this.ie = (document.all);
	this.ns6 = (document.getElementById && !document.all && !this.opera);
    var sV = "", sD = arguments[0], oD = findObj(sD), sP = arguments[1]; if (oD == null) {return 0;}
	var sF = (sD.indexOf("?") > 0) ? sD.substring(sD.indexOf("?")+1) : "";
	if ((sF != "") && (this.ie)) {sD = "parent.frames['" + sF + "']." + sD.substring(0,sD.indexOf("?"));}
	if ((sP == "left") || (sP == "top")) {
		if (!this.ns4) {oD = oD.style;} sV = eval("oD." + sP);
		if ((this.ie) && (sV == "")) { 
			if (sP == "top") { sV = eval(sD + ".offsetTop");} 
			else { sV = eval(sD + ".offsetLeft");}}}
	else {if (this.opera) {oD = oD.style;
			if (sP == "height") { sV = oD.pixelHeight;} 
			else if (sP == "width") { sV = oD.pixelWidth;}}
		else if (this.ns4) {sV = eval("oD.clip." + sP);} 
		else if (this.ns6) {sV = document.defaultView.getComputedStyle(oD, "").getPropertyValue(sP);} 
	    else if (this.ie) { 
			if (sP == "width") {sV = eval(sD + ".offsetWidth");} 
			else if (sP == "height") {sV = eval(sD + ".offsetHeight");}}}
	sV = (sV == "") ? 0 : sV; if (isNaN(sV)) {if (sV.indexOf('px') > 0) { sV = sV.substring(0,sV.indexOf('px'));}} 
	return parseInt(sV); 
}

function MoveDiv(sD, sX, sY){
	var	oD = findObj(sD), sS=""; if (!oD) {return;}
	if (!document.layers) {oD = oD.style;}
	if((parseInt(navigator.appVersion)>4 || navigator.userAgent.indexOf("MSIE")>-1) && (!window.opera)) {sS="px";}
	if (sX != "") {eval("oD.left = '" + sX + sS + "'");}
	if (sY != "") {eval("oD.top = '" + sY + sS + "'");}
}

function scrlDivs() { 
	var aA = arguments, iA = aA.length, oD = findObj('scrlContainer'); if (!oD) {return;}
	if (oD.scrollTimeout != null) {clearTimeout(oD.scrollTimeout);}
	var sID1 = 'scrlContainer', sID2 = 'scrlContent';   
	var iSS = (iA > 0) ? parseInt(aA[0]) : 1, iPx = (iA > 1) ? parseInt(aA[1]) : 1;   
	var iMs = (iA > 2) ? parseInt(aA[2]) : 50;   
	var iST = (-1 * GetDivProperty(sID2, 'height')), iSB = GetDivProperty(sID1, 'height');   
	var iCX = GetDivProperty(sID2, 'left'), iCY = GetDivProperty(sID2, 'top');  
	if (iSS) {if (iCY >= iST) {MoveDiv(sID2, String(iCX), String(iCY-iPx));}
		else {MoveDiv(sID2, String(iCX), String(iSB));}
		oD.scrollTimeout = setTimeout("scrlDivs(" + iSS + "," + iPx + "," + iMs + ")", iMs);}   
}
// codes for scroll ends. //



function basla() {
var d = document.all
	if (window.outerWidth > 950 || document.body.clientWidth > 950 ) {
		d.Main_Table1.style.width='939px';
		d.Buyuk_Ekr.style.visibility='visible';
		d.Buyuk_Ekr.style.width='200px';
		d.BYK_IMG.style.width='200px';
	} else {
		d.Main_Table1.style.width='739px';
		d.Buyuk_Ekr.style.visibility='hidden';
		d.Buyuk_Ekr.style.width='0px';
		d.BYK_IMG.style.width='0px';
	};
};

function pencereac(URL,genislik,yukseklik) {
	var ozellik='width=' + genislik + ',height=' + yukseklik + ',hotkeys=yes,left=0,top=0,scrollbars=yes,alwaysRaised=yes,alwaysLowered=no,dependent=yes,resizable=yes,toolbar=yes'
	var win=window.open(URL,"KEGKI",ozellik,false);
	var g=screen.availWidth;
	var h=screen.availHeight;
	var x=(g-genislik)/2;
	var y=(h-yukseklik)/2;
	win.moveTo(x,y)
}

function haber_win(URL,genislik,yukseklik) {
	var ozellik='width=' + genislik + ',height=' + yukseklik + ',hotkeys=no,left=0,top=0,scrollbars=yes,alwaysRaised=yes,alwaysLowered=no,dependent=yes,resizable=yes'
	var win=window.open(URL,"_blank",ozellik,false);
	var g=screen.availWidth;
	var h=screen.availHeight;
	var x=(g-genislik)/2;
	var y=(h-yukseklik)/2;
	win.moveTo(x,y)
}

function chk_pilot(src) {
if (navigator.appVersion.indexOf("MSIE") > 0) {
	if (document.all.PILOT_IST.checked == true || document.all.PILOT_MAR.checked == true || document.all.PILOT_CAN.checked == true ) {
		document.all.PILOT_EVET.checked = true;
	} else {
		document.all.PILOT_HAYIR.checked = true;
	}
} 
}

function chk_num(src) {
if (navigator.appVersion.indexOf("MSIE") > 0) {
	if (isNaN(src.value) == true) {
		bcolor=src.style.backgroundColor;
		src.style.backgroundColor='red';
		alert('Hatalı bilgi girişi!');
		src.style.backgroundColor=bcolor;
		src.value = "";
		src.focus();
	}
} 
}

function chk_date(src) {
if (navigator.appVersion.indexOf("MSIE") > 0 ) {
	if (isDate(src)) { 
		return true
	}	else if (src.value != "") {
		return true
		bcolor=src.style.backgroundColor;
		src.style.backgroundColor='red';
		alert('Hatalı tarih girişi! (dd.mm.yyyy)');
		src.style.backgroundColor=bcolor;
		src.value = "";
		src.focus()
	}
}
}


function getLastDay(iMonth, iYear)
{
var iLastDay = 28
var i;
for(i = iLastDay; i <= 31; i++) {
	var tmp = new Date(iYear,iMonth,i);
	if(iMonth == tmp.getMonth()) iLastDay = i;
	}
return iLastDay;
}

function isDateFormat(sDate)
{
var sDateFormat = /^\d{2}\.\d{2}\.\d{4}$/
var regex = new RegExp(sDateFormat);
return regex.test(sDate);
}


function isDate(src) {
sDate=src.value

var myArray = new Array();

myArray = sDate.split(".")

var iDay = parseInt(myArray[0]);
var iMonth = parseInt(myArray[1]);
var iYear = parseInt(myArray[2]);


if(!isDateFormat(sDate)) return false;

if ((iDay > getLastDay(iMonth - 1,iYear) || (iDay < 1)) || ((iMonth < 1) || (iMonth > 12)) || (iYear < 1970)) {
	 return false;
}
src.value=sDate
return true;
}

function chk_Acenta() {
if ( document.all.FIRMA.value=="" || document.all.VDAIRE.value=="" || document.all.VNO.value=="" || document.all.USER.value=="" || document.all.PASS.value=="" ) {
		bcolor=document.all.FIRMA.style.backgroundColor;
		document.all.FIRMA.style.backgroundColor='red';
		document.all.VDAIRE.style.backgroundColor='red';
		document.all.VNO.style.backgroundColor='red';
		document.all.USER.style.backgroundColor='red';
		document.all.PASS.style.backgroundColor='red';
		alert('Eksik Bilgi Girişi!');
		document.all.FIRMA.style.backgroundColor=bcolor;
		document.all.VDAIRE.style.backgroundColor=bcolor;
		document.all.VNO.style.backgroundColor=bcolor;
		document.all.USER.style.backgroundColor=bcolor;
		document.all.PASS.style.backgroundColor=bcolor;
		return false;
} else {return true;}
}

function chk_SP() {
if ( document.all.GEMIADI.value=="" || document.all.CAGRI.value=="" || document.all.SP1GELIS.value=="" || document.all.A_ID.value=="" || document.all.HUTC.value=="" ) {
//		bcolor=document.all.FIRMA.style.backgroundColor;
//		document.all.FIRMA.style.backgroundColor='red';
		alert('Eksik Bilgi Girişi!');
//		document.all.FIRMA.style.backgroundColor=bcolor;
//		document.all.VDAIRE.style.backgroundColor=bcolor;
		return false;
} else {return true;}
}

function chk_ETA(src) {
if (src.selectedIndex == 8 ) {
	metin = src.options[src.selectedIndex].text;
	deger = window.prompt('Boğaza Tahmini Giriş Zamanı', metin );
	if ( deger != "" && deger != false && deger != null ) {
		src.options[src.selectedIndex].text = deger;
		src.options[src.selectedIndex].value = deger;
	}
}
}

function getnow(src) {
	d = new Date(); 
	yaz=d.getMonth()+1
	if (src==true) {
		return d.getDate() + '.' + yaz + '.' + d.getYear() ;
	} else {
		return d.getDate() + '.' + yaz + '.' + d.getYear() + ' ' + d.getHours() + ':' +d.getMinutes();
	};
	return src.value;
}

function Chk_Explorer() {
if (navigator.appVersion.indexOf("MSIE") > 0) {
} else {
	window.alert("Sistem MS Internet Explorer 5.5 ve üstü ile çalışır");
}
}

