﻿var tabvar=null;

function cmId_get()
{
    var id="";
    var func1=egeajax.cmID_get();
    if(func1.value !=null){id=func1.value;}
    return id;
}
function ucrkont_get(){
    var ucrkont=0;
    var func1=egeajax.ucrkont_get();
    if(func1.value !=null){ucrkont=func1.value;}
    return ucrkont;
}
//
function ucretli_kontrol(arsivno,protokol){
   var msg="";
   var func1=egeajax.ucretli_kontrol(arsivno,protokol);
   if(func1.value==null){ 
     return msg;
   }
   var dizi=func1.value;
   for(var i=0;i < dizi.length;i++){
         msg += dizi[i].toString()+'\n';
   }
   return msg;
}
//        
function idcombo_get(idname,index1){
 var max=0;
 var idx=null;
 var nodex=null;
 if(index1 < 0){return "";}   
 nodex=document.getElementById(idname);
 if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
   nodex=document.getElementById(idname);
 }  
 var value1=nodex.options[index1].value.toString();
 return value1;  
}
//
function radio_secim(idname){
  var max=0;
  var idx=null;
  var nodex=null;
  //
  nodex=document.getElementById(idname);
  if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
   nodex=document.getElementById(idname);
 }
 var elem1=nodex.getElementsByTagName('INPUT');
 var durum=1; 
 for (var i=0;i<elem1.length;i++){
      var node1=elem1[i];
      if(node1.checked==true)
      {
        durum=Number(node1.value);
      }
   }
  return durum;  
}

function radio_get(idname){
  var max=0;
  var idx=null;
  var nodex=null;
  //
  nodex=document.getElementById(idname);
  if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
   nodex=document.getElementById(idname);
 }
  var elem1=nodex.getElementsByTagName('INPUT');
  var durum=1; 
  for (var i=0;i<elem1.length;i++)
  {
      var node1=elem1[i];
      if(node1.checked==true)
      {
        durum=Trim(node1.value);
      }
   }
  return durum;  
}

function radio_set(idname,index){
  var max=0;
  var idx=null;
  var nodex=null;
  //
  nodex=document.getElementById(idname);
  if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
   nodex=document.getElementById(idname);
 }
 //
 index=Number(index);
 if(index  < 0){index=0;}
 var elem1=nodex.getElementsByTagName('INPUT');
 for (var i=0;i<elem1.length;i++){
   if(elem1[i].value==index){elem1[i].checked=true;}
 }

}


function cekbox_cek(idname){
  var max=0;
  var idx=null;
  var nodex=null;
  //
  nodex=document.getElementById(idname);
  if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
   nodex=document.getElementById(idname);
 }
  var secili=false;
  var elem1=nodex.getElementsByTagName('INPUT');
  for (var i=0;i<elem1.length;i++)
  {
      var node1=elem1[i];
      if(node1.checked==true)
      {
        secili=true;
      }
   }
  return secili;  
}

function cekbox_get(idname){
  var secili=0;
  var max=0;
  var idx=null;
  var nodex=null;
  //
  nodex=document.getElementById(idname);
  if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
   nodex=document.getElementById(idname);
 }
 //
 var elem1=nodex.getElementsByTagName('INPUT');
  for (var i=0;i<elem1.length;i++)
  {
      var node1=elem1[i];
      if(node1.checked==true)
      {
        secili=1;
      }
   }
  return secili;  
}
//
function cekbox_set(idname,secim){
  var sec=false;
  if(secim > 0){ sec=true;}  
  var max=0;
  var idx=null;
  var nodex=null;
  //
  nodex=document.getElementById(idname);
  if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
   nodex=document.getElementById(idname);
 }
 //
 var elem1=nodex.getElementsByTagName('INPUT');
 for (var i=0;i<elem1.length;i++){
     elem1[i].checked=sec;
  }
}


function idvalued_get(idname){
  var max=0;
  var idx=null;
  var nodex=null;
  nodex=document.getElementById(idname);
  if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
   nodex=document.getElementById(idname);
 }
 if(nodex==null){return null;}
 if(typeof(nodex) !='object'){ return null;}
 var datestr=nodex.value;
 datestr=Trim(datestr);
 if(datestr.length < 1 ){return null;}
 var yil=Number(datestr.substr(6,4));
 var ay =Number(datestr.substr(3,2));
 var gun=Number(datestr.substr(0,2));
 var date1=new Date(yil,ay-1,gun,0,0,0,0);

  return(date1);
}
//
function idvaluez_get(idname){
  var max=0;
  var idx=null;
  var nodex=null;
  nodex=document.getElementById(idname);
  if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
   nodex=document.getElementById(idname);
 }
 if(nodex==null){return null;}
 if(typeof(nodex) !='object'){ return null;}
 var datestr=nodex.value;
 datestr=Trim(datestr);
 if(datestr.length < 1 ){return null;}
 var yil=Number(datestr.substr(6,4));
 var ay =Number(datestr.substr(3,2));
 var gun=Number(datestr.substr(0,2));
 var saat=Number(datestr.substr(11,2));
 var dak=Number(datestr.substr(14,2));
 
 var date1=new Date(yil,ay-1,gun,saat,dak,0,0);

  return(date1);
}

//
function gettime(date1){

var saat=date1.getHours();
var dak=date1.getMinutes();
var saatx=saat;
var dakx=dak;
if(saat < 10){saatx="0"+saat; }
if(dak < 10){dakx="0"+dak;}
return (saatx+":"+dakx);

}

function dateparse(datestr){
 if((datestr==null) || (datestr=='undefined')){ return null;}
 if(datestr.length > 0){
     var gun=datestr.substr(0,2);
     var ay  =datestr.substr(3,2);
     var yil=datestr.substr(6,4);
     var date1=new Date(yil,ay-1,gun,0,0,0,0);
     return date1;
 }    
 return null;
}


function dateparse1(datestr){
 if((datestr==null) || (datestr=='undefined')){ return null;}
 if(datestr.length > 0){
     var yil=datestr.substr(6,4);;
     var ay  =datestr.substr(0,2);
     var gun=datestr.substr(3,2);
     return(gun+"."+ay+"."+yil);
 }    
 return null;
}


function dateparse2(datestr){
 if((datestr==null) || (datestr=='undefined')){ return null;}
 if(datestr.length > 0){
     var yil=Number(datestr.substr(6,4));
     var ay  =Number(datestr.substr(3,2));
     var gun=Number(datestr.substr(0,2));
     var date1=new Date(yil,ay-1,gun,0,0,0,0);
     return(date1);
 }    
 return null;
}
function dateparse2t(datestr){
 if((datestr==null) || (datestr=='undefined')){ return null;}
 if(datestr.length > 0){
     var yil=Number(datestr.substr(6,4));
     var ay  =Number(datestr.substr(3,2));
     var gun=Number(datestr.substr(0,2));
     var saat=Number(datestr.substr(12,2));
     var dak=Number(datestr.substr(15,2));
     var date1=new Date(yil,ay-1,gun,saat,dak,0,0);
     return(date1);
 }    
 return null;
}



function dateparse3(datestr){
 if((datestr==null) || (datestr=='undefined')){ return null;}
 var oldgunx='';
 var oldayx='';
 var curayx='';
 var curgunx='';
 var curtar=0;
 var yil=null;
 var ay=null;
 var gun=null;
 var date1=null;
 var now=new Date();
 var hh= now.getHours();
 var mm=now.getMinutes();
 var ss=now.getSeconds();
 var curay=now.getMonth()+1;
 var curgun=now.getDate();
 var ekle=false;
 var curayx=curay.toString();
 var curgunx=curgun.toString();
 if(curay < 10){curayx='0'+curay.toString();}
 if(curgun < 10){curgunx='0'+curgun.toString();}
 var curtar=curayx+curgunx;
 ////////
 var curtar=Number(curtar);
 var oldtar=0;
 if(datestr.length > 0){
    yil=datestr.substr(6,4);;
    ay =datestr.substr(3,2);
    gun=datestr.substr(0,2);
    ///
    oldgunx=gun.toString();
    if(gun < 10){oldgunx='0'+gun.toString();}
    oldayx=ay.toString();
    if(ay < 10){oldayx='0'+ay.toString();}
    oldtar=oldayx+oldgunx;
    oldtar=Number(oldtar);
    if(oldtar < curtar && ay < 11 && gun <29){ekle=true;}
    date1=new Date(yil,ay-1,gun,0,0,0,0);
    ///if(ekle){date1=new Date(yil,ay-1,gun,1,0,0,0);}
    
 }   

  return(date1);
}




function date_get(date1)
{
    var tarihx="";
    if(date1 !=null)
    {
        var gun=date1.getDate();
	    var ay=date1.getMonth()+1;
	    var yil=date1.getFullYear();
	    if (yil < 1000){ yil =yil + 1900;}
	    var gunx=String(gun);
	    var ayx=String(ay);
	    var yilx=String(yil);
	    ////
 	    if(gun < 10){gunx="0"+gunx;}
 	    if(ay < 10) {ayx="0"+ayx;}
        tarihx=gunx+"."+ayx+"."+yilx;
      }
	 return tarihx;
} 


function datetime_get(date1)
{
    var tarihx="";
    if(date1 !=null)
    {
        var gun=date1.getDate();
	    var ay=date1.getMonth()+1;
	    var yil=date1.getFullYear();
	    if (yil < 1000){ yil =yil + 1900;}
	    var gunx=String(gun);
	    var ayx=String(ay);
	    var yilx=String(yil);
	    ////
 	    if(gun < 10){gunx="0"+gunx;}
 	    if(ay < 10) {ayx="0"+ayx;}
        ///
    	var saat=date1.getHours();
	    var dakika=date1.getMinutes();
	    var salise=date1.getSeconds();
	    var saatx=String(saat);
	    var dakx=String(dakika);
	    var salx=String(salise);
	    if(saat < 10){ saatx="0"+saatx; }
	    if(dakika < 10){dakx="0"+dakx;}
	    if(salise < 10){salx="0"+salx;}

        tarihx=gunx+"."+ayx+"."+yilx+" "+saatx+":"+dakx+":"+salx;
	   
	   } 
    return tarihx;
}


function Trim(s){
    
   if(s=='null'){s="";} 
   if(s==null){s="";}
   if(s=="undefined"){s="";} 
   s=String(s);
   var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);
   return (m == null) ? "" : m[1];
}

function NumberStr(nStr)
{
    nStr=Trim(nStr);
	nStr += '';
	if(nStr.length < 1 ){return "";}
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? ',' + x[1] : '';
	switch(x2.length){
	    case 0:
	    case 1:
	        x2=',00 ';
	        break;
	    case 2:
	        x2=','+x[1]+'0 ';
	        break;    
	}
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + '.' + '$2');
	}
	return x1 + x2;
}

function NumberRound(sayi,des){
    var result = Math.round(sayi*Math.pow(10,des))/Math.pow(10,des);
	return result;
}

///////
 function grid_siraver(gridname){
  var max1=gridname.getRowsNum();
    for(var i=0;i<max1;i++){
        var sno=i+1;
       gridname.setRowId(i,sno)
       gridname.cells(sno,0).setValue(sno); 
    }
 }

function idname_get(idname){
  var max=0;
  var idx=idname;
  var idname_id=document.getElementById(idx);
  //
  if(idname_id==null && tabvar){
   while (max<=10){
       idx="sayfa"+max+"_"+idname;
       idname_id=document.getElementById(idx);
       if(idname_id !=null){break;}
       max +=1;
   }
 }
  return idname_id;
}

function tagname_get(idname,tagname){
  var max=0;
  var idx=null;
  var tagname_id=null
  tagname_id=idname.getElementsByTagName(tagname);
  if(tagname_id==null && tabvar){
    while (max<=10){
       idx="sayfa"+max+"_"+tagname;
       idname_id=document.getElementById(idx);
       if(idname_id !=null){break;}
       max +=1;
   }
  }
  return tagname_id;
}

function idvalue_get(idname){
  var max=0;
  var idx=idname;
  var idvalue=null;
  var nodex=null;
  nodex=document.getElementById(idx);
  if(nodex==null && tabvar){
   while (max<=10){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
 }
 return nodex.value.toString();
}

function idvaluen_get(idname){
  var max=0;
  var idx=idname;
  var idvalue=null;
  var nodex=null;
  nodex=document.getElementById(idx);
  if(nodex==null && tabvar){
   while (max<=10){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
 }
 return Number(nodex.value.toString());
}


function idinner_get(idname){
  var max=0;
  var idx=null;
  var nodex=null;
  var idvalue=null; 
  nodex=document.getElementById(idname);
  if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
 }
 // 
 if(nodex==null){ alert(idname+" Nesne Değil veya Yok...");}
 var pos1=nodex.selectedIndex;
 if(pos1 !=-1){
    idvalue=Trim(nodex.options[pos1].text.toString());
 }   
 return idvalue;
}

function idvalue_set(idname,value){
 var max=0;
 var idx=null;
 var nodex=null;
 nodex=document.getElementById(idname);
 if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
 }
 // 
 if(nodex==null){ alert(idname+" Nesne Değil veya Yok...");}
 nodex.value=Trim(value);
}

function idvalued_set(idname,value){
 var max=0;
 var idx=null;
 var nodex=null;
 nodex=document.getElementById(idname);
 if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
 }
 // 
 if(nodex==null){ alert(idname+" Nesne Değil veya Yok...");}
 nodex.value=date_get(value);
}
//
function idvaluez_set(idname,value){
 var max=0;
 var idx=null;
 var nodex=null;
 nodex=document.getElementById(idname);
 if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
 }
 // 
 if(nodex==null){ alert(idname+" Nesne Değil veya Yok...");}
 var value2=datetime_get(value);
 nodex.value=value2.substr(0,16);
}
//





function idvalue_setn(idname,value){
 var max=0;
 var idx=null;
 var nodex=null;
 nodex=document.getElementById(idname);
 if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
 }
 // 
 if(nodex==null){ alert(idname+" Nesne Değil veya Yok...");}
 nodex.value=NumberStr(value);
}

function inner_set(idname,value){
 var max=0;
 var idx=null;
 var nodex=null;
 nodex=document.getElementById(idname);
 if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
 }
 // 
 if(nodex==null){ alert(idname+" Nesne Değil veya Yok...");}
 var index1=nodex.selectedIndex;
  nodex.innerText=Trim(value);
}

function idinner_set(idname,value){
 var max=0;
 var idx=null;
 var nodex=null;
 nodex=document.getElementById(idname);
 if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
 }
 // 
 if(nodex==null){ alert(idname+" Nesne Değil veya Yok...");}
 var index1=nodex.selectedIndex;
  nodex.options[index1].innerText=Trim(value);
}

function idinner1_set(idname,value){
 var max=0;
 var idx=null;
 var nodex=null;
 nodex=document.getElementById(idname);
 if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
 }
 // 
 if(nodex==null){ alert(idname+" Nesne Değil veya Yok...");}
 nodex.innerText=Trim(value);
}

function idindex_get(idname){
 var index=-1;
 var max=0;
 var idx=null;
 var nodex=null;
 nodex=document.getElementById(idname);
 if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
 }
 // 
  if(nodex==null){ alert(idname+" Nesne Değil veya Yok...");}
  else if(typeof(nodex) !='object'){ alert(idname+" Nesnesi Tanımlanmamış...");}
  index=nodex.selectedIndex;
  return Number(index);
}

function idindex_set(idname,index1){
  var index=Number(index1);
   var max=0;
 var idx=null;
 var nodex=null;
 nodex=document.getElementById(idname);
 if(nodex==null && tabvar){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
 }
 // 
 if(nodex==null){ alert(idname+" Nesne Değil veya Yok...");}
  nodex.selectedIndex=index;
}



function StrNumber(str1){
 
 var value1=0;
 var str2="";
 if((str1==null) || (str1=="undefined")){return 0;}
 var len1=str1.length;
  for(var i=0;i<str1.length;i++){
    var byte1=str1.substr(i,1);
    if((byte1=='0') || (byte1=='1') || (byte1=='2')|| (byte1=='3')|| (byte1=='4')|| (byte1=='5')){ str2 +=byte1;}
    if((byte1=='6') || (byte1=='7') || (byte1=='8')|| (byte1=='9')){ str2 +=byte1;}
    if(byte1==','){ str2 +=".";}  
 }
 if(str2.length > 0){value1=Number(str2);}
 
 return value1;
}

//
function getTop(idname) 
{
 var max=0;
 var idx=null;
 var nodex=null;
 nodex=document.getElementById(idname);
 if(nodex==null){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
 }
 // 
 if(nodex==null){ alert(idname+" Nesne Değil veya Yok...");}
 else if(typeof(nodex) !='object'){ alert(idname+" Nesnesi Tanımlanmamış...");}
 var iTop = 0;
 iTop+=nodex.offsetHeight;
    while(nodex !=null && nodex.tagName != 'BODY') {
        iTop += nodex.offsetTop;
        nodex = nodex.offsetParent;
   }
   return iTop;
}
function getLeft(idname){

 var max=0;
 var idx=null;
 var nodex=null;
 nodex=document.getElementById(idname);
 if(nodex==null){
   while (max<=20){
       idx="sayfa"+max+"_"+idname;
       nodex=document.getElementById(idx);
       if(nodex !=null){break;}
       max +=1;
   }
 }
 // 
 if(nodex==null){ alert(idname+" Nesne Değil veya Yok...");}
 else if(typeof(nodex) !='object'){ alert(idname+" Nesnesi Tanımlanmamış...");}
 var iLeft = 0;
    while(nodex !=null && nodex.tagName != 'BODY') {
        iLeft += nodex.offsetLeft;
        nodex = nodex.offsetParent;        
    }
    return iLeft;
}

function takvim(idname){
 
 var left=getLeft(idname);
 var top=getTop(idname);
 var left1=window.screenLeft;
 var top1=window.screenTop;
 top=top+top1;
 left=left+left1;
 /////
 var posx=left;
 var posy=top;
 if((posy+170) > window.screen.height){posy=top -190;} 
 if((posx+150) > window.screen.width){posx=window.screen.height-150;} 
  
 var possrc='resizable:0;Edge:Sunken;help:0;scroll:0;status:0;dialogWidth:150px;dialogHeight:170px;dialogLeft='+posx+'px;dialogTop='+posy+'px;';
 var par1=new Object();
 var date=new Date();
 par1.top=top;
 par1.left=left;
 par1.tarihi=date_get(date);
 var tarihi=dateparse3(idvalue_get(idname));
 tarihi=date_get(tarihi);
 if(tarihi.length > 7){
    par1.tarihi=tarihi;
 }   
 var sonuc=window.showModalDialog('../calendar/calendar.aspx',par1,possrc);
 if(sonuc !=null){idvalue_set(idname,sonuc);}
}
///
function takvimzaman(idname){
 
 var left=getLeft(idname);
 var top=getTop(idname);
 var left1=window.screenLeft;
 var top1=window.screenTop;
 top=top+top1;
 left=left+left1;
 /////
 var posx=left;
 var posy=top;
 if((posy+170) > window.screen.height){posy=top -190;} 
 if((posx+150) > window.screen.width){posx=window.screen.height-150;} 
  
 var possrc='resizable:0;Edge:Sunken;help:0;scroll:0;status:0;dialogWidth:150px;dialogHeight:170px;dialogLeft='+posx+'px;dialogTop='+posy+'px;';
 var par1=new Object();
 var date=new Date();
 par1.top=top;
 par1.left=left;
 par1.tarihi=date_get(date);
 var tarihi=dateparse3(idvalue_get(idname));
 tarihi=date_get(tarihi);
 if(tarihi.length > 7){
    par1.tarihi=tarihi;
 }   
 var sonuc=window.showModalDialog('../calendarzaman/calendarzaman.aspx',par1,possrc);
 if(sonuc !=null){idvalue_set(idname,sonuc);}
 
}

////
function LTrim(str){
    if (str==null){return null;}
	for(var i=0;str.charAt(i)==" ";i++);
	return str.substring(i,str.length);
}

function RTrim(str){
	if (str==null){return null;}
	for(var i=str.length-1;str.charAt(i)==" ";i--);
	return str.substring(0,i+1);
}
function Trim1(str){return LTrim(RTrim(str));}

function LTrimAll(str) {
	if (str==null){return str;}
	for (var i=0; str.charAt(i)==" " || str.charAt(i)=="\n" || str.charAt(i)=="\t"; i++);
	return str.substring(i,str.length);
	}
function RTrimAll(str) {
	if (str==null){return str;}
	for (var i=str.length-1; str.charAt(i)==" " || str.charAt(i)=="\n" || str.charAt(i)=="\t"; i--);
	return str.substring(0,i+1);
	}
function TrimAll(str) {
	return LTrimAll(RTrimAll(str));
	}
//-------------------------------------------------------------------
// isNull(value)
//   Returns true if value is null
//-------------------------------------------------------------------
function isNull(val){return(val==null);}

//-------------------------------------------------------------------
// isBlank(value)
//   Returns true if value only contains spaces
//-------------------------------------------------------------------
function isBlank(val){
	if(val==null){return true;}
	for(var i=0;i<val.length;i++) {
		if ((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}
		}
	return true;
	}

//-------------------------------------------------------------------
// isInteger(value)
//   Returns true if value contains all digits
//-------------------------------------------------------------------
function isInteger(val){
	if (isBlank(val)){return false;}
	for(var i=0;i<val.length;i++){
		if(!isDigit(val.charAt(i))){return false;}
		}
	return true;
	}

//-------------------------------------------------------------------
// isNumeric(value)
//   Returns true if value contains a positive float value
//-------------------------------------------------------------------
function isNumeric(val){return(parseFloat(val,10)==(val*1));}

//-------------------------------------------------------------------
// isArray(obj)
// Returns true if the object is an array, else false
//-------------------------------------------------------------------
function isArray(obj){return(typeof(obj.length)=="undefined")?false:true;}

//-------------------------------------------------------------------
// isDigit(value)
//   Returns true if value is a 1-character digit
//-------------------------------------------------------------------
function isDigit(num) {
	if (num.length>1){return false;}
	var string="1234567890";
	if (string.indexOf(num)!=-1){return true;}
	return false;
}
//-------------------------------------------------------------------
// setNullIfBlank(input_object)
//   Sets a form field to "" if it isBlank()
//-------------------------------------------------------------------
function setNullIfBlank(obj){if(isBlank(obj.value)){obj.value="";}}

//-------------------------------------------------------------------
// setFieldsToUpperCase(input_object)
//   Sets value of form field toUpperCase() for all fields passed
//-------------------------------------------------------------------
function setFieldsToUpperCase(){
	for(var i=0;i<arguments.length;i++) {
		arguments[i].value = arguments[i].value.toUpperCase();
		}
	}

//-------------------------------------------------------------------
// disallowBlank(input_object[,message[,true]])
//   Checks a form field for a blank value. Optionally alerts if 
//   blank and focuses
//-------------------------------------------------------------------
function disallowBlank(obj){
	var msg=(arguments.length>1)?arguments[1]:"";
	var dofocus=(arguments.length>2)?arguments[2]:false;
	if (isBlank(getInputValue(obj))){
		if(!isBlank(msg)){alert(msg);}
		if(dofocus){
			if (isArray(obj) && (typeof(obj.type)=="undefined")) {obj=obj[0];}
			if(obj.type=="text"||obj.type=="textarea"||obj.type=="password") { obj.select(); }
			obj.focus();
			}
		return true;
		}
	return false;
	}

//-------------------------------------------------------------------
// disallowModify(input_object[,message[,true]])
//   Checks a form field for a value different than defaultValue. 
//   Optionally alerts and focuses
//-------------------------------------------------------------------
function disallowModify(obj){
	var msg=(arguments.length>1)?arguments[1]:"";
	var dofocus=(arguments.length>2)?arguments[2]:false;
	if (getInputValue(obj)!=getInputDefaultValue(obj)){
		if(!isBlank(msg)){alert(msg);}
		if(dofocus){
			if (isArray(obj) && (typeof(obj.type)=="undefined")) {obj=obj[0];}
			if(obj.type=="text"||obj.type=="textarea"||obj.type=="password") { obj.select(); }
			obj.focus();
			}
		setInputValue(obj,getInputDefaultValue(obj));
		return true;
		}
	return false;
	}

//-------------------------------------------------------------------
// commifyArray(array[,delimiter])
//   Take an array of values and turn it into a comma-separated string
//   Pass an optional second argument to specify a delimiter other than
//   comma.
//-------------------------------------------------------------------
function commifyArray(obj,delimiter){
	if (typeof(delimiter)=="undefined" || delimiter==null) {
		delimiter = ",";
		}
	var s="";
	if(obj==null||obj.length<=0){return s;}
	for(var i=0;i<obj.length;i++){
		s=s+((s=="")?"":delimiter)+obj[i].toString();
		}
	return s;
	}

//-------------------------------------------------------------------
// getSingleInputValue(input_object,use_default,delimiter)
//   Utility function used by others
//-------------------------------------------------------------------
function getSingleInputValue(obj,use_default,delimiter) {
	switch(obj.type){
		case 'radio': case 'checkbox': return(((use_default)?obj.defaultChecked:obj.checked)?obj.value:null);
		case 'text': case 'hidden': case 'textarea': return(use_default)?obj.defaultValue:obj.value;
		case 'password': return((use_default)?null:obj.value);
		case 'select-one':
			if (obj.options==null) { return null; }
			if(use_default){
				var o=obj.options;
				for(var i=0;i<o.length;i++){if(o[i].defaultSelected){return o[i].value;}}
				return o[0].value;
				}
			if (obj.selectedIndex<0){return null;}
			return(obj.options.length>0)?obj.options[obj.selectedIndex].value:null;
		case 'select-multiple': 
			if (obj.options==null) { return null; }
			var values=new Array();
			for(var i=0;i<obj.options.length;i++) {
				if((use_default&&obj.options[i].defaultSelected)||(!use_default&&obj.options[i].selected)) {
					values[values.length]=obj.options[i].value;
					}
				}
			return (values.length==0)?null:commifyArray(values,delimiter);
		}
	alert("FATAL ERROR: Field type "+obj.type+" is not supported for this function");
	return null;
	}

//-------------------------------------------------------------------
// getSingleInputText(input_object,use_default,delimiter)
//   Utility function used by others
//-------------------------------------------------------------------
function getSingleInputText(obj,use_default,delimiter) {
	switch(obj.type){
		case 'radio': case 'checkbox': 	return "";
		case 'text': case 'hidden': case 'textarea': return(use_default)?obj.defaultValue:obj.value;
		case 'password': return((use_default)?null:obj.value);
		case 'select-one':
			if (obj.options==null) { return null; }
			if(use_default){
				var o=obj.options;
				for(var i=0;i<o.length;i++){if(o[i].defaultSelected){return o[i].text;}}
				return o[0].text;
				}
			if (obj.selectedIndex<0){return null;}
			return(obj.options.length>0)?obj.options[obj.selectedIndex].text:null;
		case 'select-multiple': 
			if (obj.options==null) { return null; }
			var values=new Array();
			for(var i=0;i<obj.options.length;i++) {
				if((use_default&&obj.options[i].defaultSelected)||(!use_default&&obj.options[i].selected)) {
					values[values.length]=obj.options[i].text;
					}
				}
			return (values.length==0)?null:commifyArray(values,delimiter);
		}
	alert("FATAL ERROR: Field type "+obj.type+" is not supported for this function");
	return null;
	}

//-------------------------------------------------------------------
// setSingleInputValue(input_object,value)
//   Utility function used by others
//-------------------------------------------------------------------
function setSingleInputValue(obj,value) {
	switch(obj.type){
		case 'radio': case 'checkbox': if(obj.value==value){obj.checked=true;return true;}else{obj.checked=false;return false;}
		case 'text': case 'hidden': case 'textarea': case 'password': obj.value=value;return true;
		case 'select-one': case 'select-multiple': 
			var o=obj.options;
			for(var i=0;i<o.length;i++){
				if(o[i].value==value){o[i].selected=true;}
				else{o[i].selected=false;}
				}
			return true;
		}
	alert("FATAL ERROR: Field type "+obj.type+" is not supported for this function");
	return false;
	}

//-------------------------------------------------------------------
// getInputValue(input_object[,delimiter])
//   Get the value of any form input field
//   Multiple-select fields are returned as comma-separated values, or
//   delmited by the optional second argument
//   (Doesn't support input types: button,file,reset,submit)
//-------------------------------------------------------------------
function getInputValue(obj,delimiter) {
	var use_default=(arguments.length>2)?arguments[2]:false;
	if (isArray(obj) && (typeof(obj.type)=="undefined")) {
		var values=new Array();
		for(var i=0;i<obj.length;i++){
			var v=getSingleInputValue(obj[i],use_default,delimiter);
			if(v!=null){values[values.length]=v;}
			}
		return commifyArray(values,delimiter);
		}
	return getSingleInputValue(obj,use_default,delimiter);
	}

//-------------------------------------------------------------------
// getInputText(input_object[,delimiter])
//   Get the displayed text of any form input field
//   Multiple-select fields are returned as comma-separated values, or
//   delmited by the optional second argument
//   (Doesn't support input types: button,file,reset,submit)
//-------------------------------------------------------------------
function getInputText(obj,delimiter) {
	var use_default=(arguments.length>2)?arguments[2]:false;
	if (isArray(obj) && (typeof(obj.type)=="undefined")) {
		var values=new Array();
		for(var i=0;i<obj.length;i++){
			var v=getSingleInputText(obj[i],use_default,delimiter);
			if(v!=null){values[values.length]=v;}
			}
		return commifyArray(values,delimiter);
		}
	return getSingleInputText(obj,use_default,delimiter);
	}

//-------------------------------------------------------------------
// getInputDefaultValue(input_object[,delimiter])
//   Get the default value of any form input field when it was created
//   Multiple-select fields are returned as comma-separated values, or
//   delmited by the optional second argument
//   (Doesn't support input types: button,file,password,reset,submit)
//-------------------------------------------------------------------
function getInputDefaultValue(obj,delimiter){return getInputValue(obj,delimiter,true);}

//-------------------------------------------------------------------
// isChanged(input_object)
//   Returns true if input object's value has changed since it was
//   created.
//-------------------------------------------------------------------
function isChanged(obj){return(getInputValue(obj)!=getInputDefaultValue(obj));}

//-------------------------------------------------------------------
// setInputValue(obj,value)
//   Set the value of any form field. In cases where no matching value
//   is available (select, radio, etc) then no option will be selected
//   (Doesn't support input types: button,file,password,reset,submit)
//-------------------------------------------------------------------
function setInputValue(obj,value) {
	var use_default=(arguments.length>1)?arguments[1]:false;
	if(isArray(obj)&&(typeof(obj.type)=="undefined")){
		for(var i=0;i<obj.length;i++){setSingleInputValue(obj[i],value);}
		}
	else{setSingleInputValue(obj,value);}
	}
	
//-------------------------------------------------------------------
// isFormModified(form_object,hidden_fields,ignore_fields)
//   Check to see if anything in a form has been changed. By default
//   it will check all visible form elements and ignore all hidden 
//   fields. 
//   You can pass a comma-separated list of field names to check in
//   addition to visible fields (for hiddens, etc).
//   You can also pass a comma-separated list of field names to be
//   ignored in the check.
//-------------------------------------------------------------------
function isFormModified(theform,hidden_fields,ignore_fields){
	if(hidden_fields==null){hidden_fields="";}
	if(ignore_fields==null){ignore_fields="";}
	var hiddenFields=new Object();
	var ignoreFields=new Object();
	var i,field;
	var hidden_fields_array=hidden_fields.split(',');
	for (i=0;i<hidden_fields_array.length;i++) {
		hiddenFields[Trim(hidden_fields_array[i])]=true;
		}
	var ignore_fields_array=ignore_fields.split(',');
	for (i=0;i<ignore_fields_array.length;i++) {
		ignoreFields[Trim(ignore_fields_array[i])]=true;
		}
	for (i=0;i<theform.elements.length;i++) {
		var changed=false;
		var name=theform.elements[i].name;
		if(!isBlank(name)){
			var type=theform.elements[i].type;
			if(!ignoreFields[name]){
				if(type=="hidden" && hiddenFields[name]){changed=isChanged(theform[name]);}
				else if(type=="hidden"){changed=false;}
				else {changed=isChanged(theform[name]);}
				}
			}
		if(changed){return true;}
		}
		return false;
	}

function egeposta_get(row1,alandt){ 

    var a_adi=null;
    var a_tipi=null;
    var a_uzunluk=null;
    var a_nokta=null;
    var a_nulmu=null;
    var tagname=null;
    var value=null;
    var idname=null;
    var idx=null;
    var alan_row=null;
    var n_tipi=null;
    for(var i=0;i<alandt.Rows.length;i++){ 
       idname=idname_get(alandt.Rows[i].adi);
       if(idname !=null){
       alan_row=alandt.Rows[i];
       a_adi=Trim(alan_row["adi"]);
       a_tipi=Trim(alan_row["tipi"]);
       a_uzunluk=Trim(alan_row["uzunluk"]);
       a_nokta=Trim(alan_row["nokta"]);
       a_nulmu=Trim(alan_row["nulmu"]);
       n_tipi=nesne_tipi(a_adi);
       tagname=null;
       if((idname !=null) && ((n_tipi !=null) && (n_tipi !=undefined))){
            idx=idname.id;
            switch(a_tipi){
                case 'int':
                    idvalue_set(idx,row1[a_adi]);
                    break;
                case 'bigint':
                    idvalue_set(idx,row1[a_adi]);
                    break;
                case 'decimal':
                    idvalue_set(idx,row1[a_adi]);  
                    var val1=Trim(row1[a_adi]);
                    var index1=val1.indexOf(".");
                    if(index1 !=-1){idvalue_set(idx,NumberStr(val1));}  
                case 'varchar':
                case 'text':
                case 'ntext':
                    idvalue_set(idx,Trim(row1[a_adi]));
                    break;
                case 'char':
                    idvalue_set(idx,row1[a_adi]);
                    break;     
                 case 'smalldatetime':
                    if(n_tipi !='devdate'){
                        idvalue_set(idx,date_get(row1[a_adi]));
                    }
                   if(n_tipi=='devdate'){
                        value=row1[a_adi]; 
                        if(value==null){ value='';}
                        GetEditorCollection().Get(idx).SetDate(value); 
                   }    
                   break;      
               case 'datetime':
                   if(n_tipi !='devdate'){
                        idvaluez_set(idx,row1[a_adi]);
                    }
                    if(n_tipi=='devdate'){
                        value=row1[a_adi]; 
                        if(value==null){ value='';}
                        GetEditorCollection().Get(idx).SetDate(value); 
                    }    
                   break; 
             default:
               break; 
           }
        }
     }
   }
}   

//////
function egeposta_set(row1,alandt){ 

    var a_adi=null;
    var a_tipi=null;
    var a_uzunluk=null;
    var a_nokta=null;
    var a_nulmu=null;
    var tagname=null;
    var value=null;
    var idname=null;
    var alan_row=null;
    var len1=null;
    var n_tipi=null;
    var idx=null;
    //////  
    for(var i=0;i<alandt.Rows.length;i++){ 
       alan_row=alandt.Rows[i];
       a_adi=Trim(alan_row["adi"]);
       a_tipi=Trim(alan_row["tipi"]);
       a_uzunluk=Trim(alan_row["uzunluk"]);
       a_nokta=Trim(alan_row["nokta"]);
       a_nulmu=Trim(alan_row["nulmu"]);
       idname=idname_get(a_adi);
       n_tipi=nesne_tipi(a_adi);
       value=null;
       tagname=null;
       len1=Number(a_uzunluk);
       if((idname !=null) && ((n_tipi !=null) && (n_tipi !=undefined))){
           idx=idname.id;
           switch(a_tipi){
                case 'int':
                  switch(n_tipi){
                        case 'input':
                            value=Number(idname.value);
                            break;
                         case 'text':
                            value=Number(idname.value);
                            break;
                        case 'select-one':
                           value=Number(idname.value);   
                            break;
                        case 'checkbox':  
                            value=Number(cekbox_get(idx)); 
                            break;
                        case 'radio':
                            value=Number(radio_get(idx));
                            break;
                        default:  
                          value=Number(idname.value);     
                            break;
                    }
                    break;
                case 'bigint':
                    value=Number(idname.value);         
                    break;
                case 'decimal':
                    value=StrNumber(idname.value);
                    break;
                case 'varchar':
                     value=idname.value.toString();         
                     if(value.length > len1){value=value.substr(0,len1);}
                     break;
                case 'text':
                case 'ntext':
                     value=idname.value.toString();
                    break;
               case 'char':
                    value=idname.value.toString();
                    if(value.length > len1){value=value.substr(0,len1);}         
                    break;     
               case 'bit':
                    switch(idname.type){
                        case 'input':
                            value=Number(idname.value);
                            break;
                        case 'select-one':
                           value=Number(idname.value);   
                            break;
                        case 'checkbox':  
                            value=Number(cekbox_get(idx)); 
                            break;
                        case 'radio':
                            value=Number(radio_get(idx));
                            break;
                        default:  
                          value=idname.value.toString();
                            break;
                    }
                    break;     
              case 'smalldatetime':
                    if(n_tipi=='devdate'){
                        value=GetEditorCollection().Get(a_adi).GetDate();
                        var value1=date_get(value);
                        value=dateparse3(value1);
                    }
                    else {
                           value=idvalued_get(idx);
                    }
                    break;      
             case 'datetime':
                   if(n_tipi=='devdate'){
                        value=GetEditorCollection().Get(a_adi).GetDate();
                        var value1=date_get(value);
                        value=dateparse3(value1);
                    }
                    else {
                           value=idvaluez_get(idx); 
                    }
                    break; 
             default:
                break;
             }
           }              
            if(value==null){
                if(a_nulmu=='false'){
                        switch(a_tipi){
                            case 'int':
                            case 'bigint':
                            case 'decimal':
                                value=0;
                                break;
                            case 'smalldatetime':
                            case 'datetime':
                                value=null;
                                break;
                        } 
                    }
             }
         row1[a_adi]=value;
    }
    return row1;
}
///
function egeposta_set1(row1,alandt,sayfano){ 

    var a_adi=null;
    var a_tipi=null;
    var a_uzunluk=null;
    var a_nokta=null;
    var a_nulmu=null;
    var tagname=null;
    var value=null;
    var idname=null;
    var alan_row=null;
    var len1=null;
    var n_tipi=null;
    //////  
    for(var i=0;i<alandt.Rows.length;i++){ 
       alan_row=alandt.Rows[i];
       a_adi=Trim(alan_row["adi"]);
       a_tipi=Trim(alan_row["tipi"]);
       a_uzunluk=Trim(alan_row["uzunluk"]);
       a_nokta=Trim(alan_row["nokta"]);
       a_nulmu=Trim(alan_row["nulmu"]);
       idname=idname_get(a_adi);
       n_tipi=nesne_tipi(idname);
       value=null;
       tagname=null;
       len1=Number(a_uzunluk);
       if((idname !=null) && ((n_tipi !=null) && (n_tipi !=undefined))){
            switch(a_tipi){
                case 'int':
                  switch(n_tipi){
                        case 'input':
                            value=Number(idvalue_get(idname));
                            break;
                         case 'text':
                            value=Number(idvalue_get(idname));
                            break;
                        case 'select-one':
                           value=Number(idvalue_get(idname));   
                            break;
                        case 'checkbox':  
                            value=Number(cekbox_get(idname)); 
                            break;
                        case 'radio':
                            value=Number(radio_get(idname));
                            break;
                        default:  
                          value=Number(idvalue_get(idname));     
                            break;
                    }
                    break;
                case 'bigint':
                    value=Number(idvalue_get(idname));         
                    break;
                case 'decimal':
                    value=StrNumber(idvalue_get(idname));
                    break;
                case 'varchar':
                     value=idvalue_get(a_adi);         
                     if(value.length > len1){value=value.substr(0,len1);}
                     break;
                case 'text':
                case 'ntext':
                     value=idvalue_get(idname);         
                    break;
               case 'char':
                    value=idvalue_get(a_adi);
                    if(value.length > len1){value=value.substr(0,len1);}         
                    break;     
               case 'bit':
                    switch(idname.type){
                        case 'input':
                            value=Number(idvalue_get(idname));
                            break;
                        case 'select-one':
                           value=Number(idvalue_get(idname));   
                            break;
                        case 'checkbox':  
                            value=Number(cekbox_get(idname)); 
                            break;
                        case 'radio':
                            value=Number(radio_get(idname));
                            break;
                        default:  
                          value=value_get(idname);     
                            break;
                    }
                    break;     
              case 'smalldatetime':
                    if(n_tipi=='devdate'){
                        value=GetEditorCollection().Get(idname).GetDate();
                        var value1=date_get(value);
                        value=dateparse3(value1);
                    }
                    else {
                           value=idvaluez_get(idname);
                    }
                    break;      
             case 'datetime':
                   if(n_tipi=='devdate'){
                        value=GetEditorCollection().Get(idname).GetDate();
                        var value1=date_get(value);
                        value=dateparse3(value1);
                    }
                    else {
                           value=dateparse3(idvalue_get(idname));
                    }
                    break; 
             default:
                break;
             }
           }              
            if(value==null){
                if(a_nulmu=='false'){
                        switch(a_tipi){
                            case 'int':
                            case 'bigint':
                            case 'decimal':
                                value=0;
                                break;
                            case 'smalldatetime':
                            case 'datetime':
                                value=null;
                                break;
                        } 
                    }
             }
         row1[a_adi]=value;
    }
    return row1;
}




///Obje Oluşturma ///
function egenesne_get(alandt){ 
    var a_adi=null;
    var a_tipi=null;
    var a_uzunluk=null;
    var a_nokta=null;
    var a_nulmu=null;
    var tagname=null;
    var value=null;
    var idname=null;
    var alan_row=null;
    var len1=null;
    var n_tipi=null;
    var kayit=new Object();
    //////  
    for(var i=0;i<alandt.Rows.length;i++){ 
       alan_row=alandt.Rows[i];
       a_adi=Trim(alan_row["adi"]);
       a_tipi=Trim(alan_row["tipi"]);
       a_uzunluk=Trim(alan_row["uzunluk"]);
       a_nokta=Trim(alan_row["nokta"]);
       a_nulmu=Trim(alan_row["nulmu"]);
       idname=idname_get(a_adi);
       value=null;
       tagname=null;
       len1=Number(a_uzunluk);
       n_tipi=nesne_tipi(a_adi);
       if((idname !=null) && ((n_tipi !=null) && (n_tipi !=undefined))){
            switch(a_tipi){
                case 'int':
                  switch(n_tipi){
                        case 'input':
                        case 'text':
                            value=Number(idvalue_get(a_adi));
                            break;
                        case 'select-multi':    
                        case 'select-one':
                           value=Number(idvalue_get(a_adi));   
                            break;
                        case 'checkbox':  
                            value=Number(cekbox_get(a_adi)); 
                            break;
                        case 'radio':
                            value=Number(radio_get(a_adi));
                            break;
                        default:  
                          value=idvalue_get(a_adi);     
                            break;
                    }
                    break;
                case 'bigint':
                    value=Number(idvalue_get(a_adi));         
                    break;
                case 'decimal':
                    value=StrNumber(idvalue_get(a_adi));
                    break;
                case 'varchar':
                case 'text':
                case 'ntext':
                     value=idvalue_get(a_adi);         
                     if(value.length > len1){value=value.substr(0,len1);}
                    break;
               case 'char':
                    value=idvalue_get(a_adi);
                    if(value.length > len1){value=value.substr(0,len1);}         
                    break;     
               case 'bit':
                    switch(n_tipi){
                        case 'input':
                            value=Number(idvalue_get(a_adi));
                            break;
                        case 'select-one':
                           value=Number(idvalue_get(a_adi));   
                            break;
                        case 'checkbox':  
                            value=Number(cekbox_get(a_adi)); 
                            break;
                        case 'radio':
                            value=Number(radio_get(a_adi));
                            break;
                        default:  
                          value=value_get(a_adi);     
                            break;
                    }
                    break;     
              case 'smalldatetime':
                   if(n_tipi=='devdate'){
                        value=GetEditorCollection().Get(a_adi).GetDate();
                        //value=dateparse3(value);
                    }
                    else {
                        value=dateparse3(idvalue_get(a_adi));
                    }
                    break;      
             case 'datetime':
                   if(n_tipi=='devdate'){
                        value=GetEditorCollection().Get(a_adi).GetDate();
                        //value=dateparse3(value);
                    }
                    else {
                           value=idvaluez_get(a_adi);
                          
                    }
                    break; 
             default:
                break;
             }
           }              
            if(value==null){
                if(a_nulmu=='false'){
                        switch(a_tipi){
                            case 'int':
                            case 'bigint':
                            case 'decimal':
                                value=0;
                                break;
                            case 'smalldatetime':
                            case 'datetime':
                                value=null;
                                break;
                        } 
                    }
             }
         kayit[a_adi]=value;    
    }
    return kayit;
}

function nesne_tipi(idname){
  
  var tipi=undefined;  
  /////////Dev Date Kontrol /////
  var devdate1=idname_get(idname+'VisibleDate');
  if((devdate1 !=null) && (devdate1 !=undefined)){
    if(devdate1.type=='hidden'){ return 'devdate';}
  }
  var idname1=idname_get(idname);
  if(idname1==null){ return tipi;}
  var tagname=idname1.tagName;
  tipi=idname1.type;
 
  
  if(typeof(tipi) !='undefined'){ return tipi; }
  var elem1=idname1.getElementsByTagName('INPUT');
  for(var i=0;i < elem1.length;i++){
     tipi=elem1[i].type;
     if(typeof(tipi) !='undefined'){ break; }
  }
  ////
  return tipi;
}

function yetki_get(modul){
 yetkiler=new Object();
 var func1=egeajax.useryetki_get(modul);
 if(func1.value==null){return null;}
 yetkiler=func1.value;
 yetkiler.modul=modul;
 yetkiler.admin=0;
 yetkiler.curdate=new Date();
 yetkiler.sysdate=null;
 func1=null;
 // 
 if(yetkiler.useryet1==1){ yetkiler.admin=true;}
 var func1=egeajax.sysdate_get();
 if(func1.value !=null){yetkiler.sysdate=func1.value;}

 return yetkiler;

}

function sysdate_get(){
 
 var sysdate=null;
 var func1=egeajax.sysdate_get();
 if(func1.value !=null){sysdate=func1.value;}
 return sysdate;

}

function hekimkayno_get(birimkod)
{
   var kayno=0;
   func1=egeajax.hekimkayno_get(birimkod);
   if(func1.value !=null){kayno=func1.value;}
   return kayno;
}


function gecensure(tarihi){
  var sure=0;
  var func1=egeajax.gecensure(tarihi);
  if(func1.value !=null){
    sure=Number(func1.value);
  }
  return sure;
}

function aylar_get(ayi){
  
 var arr1=new Array(13);
 arr1[1]='Ocak';
 arr1[2]='Şubat';
 arr1[3]='Mart';
 arr1[4]='Nisan';
 arr1[5]='Mayıs';
 arr1[6]='Haziran';
 arr1[7]='Temmuz';
 arr1[8]='Ağustos';
 arr1[9]='Eylül';
 arr1[10]='Ekim';
 arr1[11]='Kasım';
 arr1[12]='Aralık';
 if(ayi < 1){return ""; }
 if(ayi > 12){return "";}
 return arr1[ayi].toString();

}

function mesaj_show(msg1){
  var sorc2="center:yes;resizable:no;Edge:Sunken;status:no;dialogWidth:550px;dialogHeight:300px;scroll:yez;";
  var par1=new Object();
  par1.msg1=msg1;
  var sonuc2=window.showModalDialog('../tanimlar/egemesajfrm.aspx',par1,sorc2);
}  

function Ajax_Load(){
   document.getElementById('loading').style.visibility = "hidden"; 
   if(typeof AjaxPro != "undefined" && AjaxPro !== null){ 
            AjaxPro.noUtcTime=true;
            AjaxPro.timeoutPeriod =15000000; 
            AjaxPro.onTimeout = function(b,res){ 
                    alert('İşlem Zaman Aşımına Uğradı'); 
            } 
            AjaxPro.onLoading = function(b){ 
                if(b){
                   document.getElementById('loading').style.visibility = "visible";
                }
                else{
                    document.getElementById('loading').style.visibility = "hidden";
                }
            } 
            AjaxPro.onError = function(res){ 
                    alert('İşlem Hatası:'+res.Message); 
            } 
 }

}


function data_toxmlrow(sira,r,arralan) {
    var xmlrow = "";
    var colname = "";
    //var sira = 0;
    xmlrow = "<row id='" + sira + "'>";
    xmlrow += "<cell>" + sira + "</cell>";
    for (var j = 0; j < arralan.length; j++) {
       colname = arralan[j];
       xmlrow += "<cell>" + Trim(r[colname]) + "</cell>";
    }
    xmlrow += "</row>";
    return xmlrow;
}

function data_tojson(dt, grid) {
     var sira = 0;
     var xmlsatir = "";
     var xmlstr = "{rows:[";
     for (var i = 0; i < dt.Rows.length; i++) {
         var row = dt.Rows[i];
         sira += 1;
         xmlsatir = "{id:" + sira + ",data:[";
         xmlsatir += sira + "";
         for (var j = 0; j < grid.colname.length; j++) {
             var colname = grid.colname[j];
             var type = coltype_get(dt, colname);
             var ctype = grid.cellType[j + 1];
             var value = row[colname];
             if (value == null) { value = ""; }
             if (type != null && type == "System.DateTime" && (ctype == "ro" || ctype == "ed") && value != null) {
                 value = date_get(value);
             }
             if (type != null && (type == "System.Decimal" || type == "System.Int32" || type == "System.Int64")) {
                 value = value.toString();
                 value = value.replace('.', ',');
             }
             if (type != null && type == "System.String") {
                 value = value.replace("'"," ");
             }
             xmlsatir += ",'" + value + "'";
         }
         xmlsatir += "]}";
         if (sira < dt.Rows.length) { xmlsatir += ","; }
         xmlstr += xmlsatir;
         xmlsatir = "";
     }
     xmlstr += "]}";
     grid.clearAll();
     var data = eval('(' + xmlstr + ')');
     grid.parse(data, "json");

 }

 function coltype_get(dt, colname) {
     var tipi = null;
     for (var i = 0; i < dt.Columns.length; i++) {
         var colname1 = dt.Columns[i].Name;
         if (colname1 == colname) { tipi = dt.Columns[i].__type; break; }
     }
     return tipi;
 }

function tckimlik_mantiksalkontrol(tckimlik) {

    var toplam = 0;
    for (var i = 0; i < tckimlik.length - 1; i++) {

        toplam += Number(tckimlik.substring(i, i + 1));

    }


    if (String(toplam).substring(1, 2) != tckimlik.substring(10, 11)) { return false; }

    return true;

}
