var BekletD,BekletI;
 
 
function Gizle(e) { $('div#'+e).fadeOut('normal');}
function Goster(e) {$('div#'+e).fadeIn('normal'); }
function Seffaf(e, k) { $('div#'+e).fadeTo('normal', k); }


function IdBul(e){ return document.getElementById(e); }
function Zamanla(e , i){ window.setTimeout(e , i); }

function fiId(e){ return document.getElementById(e); }
function fiZamanla(e , i){ window.setTimeout(e , i); }

var FontSize =10;

var FntSz=10;
function BuyutKucult(e){
   if(e)FntSz = (FntSz-2);   else FntSz = FntSz+2;
   if(FntSz>=20)FntSz = 20;
   if(FntSz<=8)FntSz = 8;
   PopDivObj=document.getElementById('IcerikDiv');
   PopDivObj.className = 'f'+ FntSz;
   //alert(FntSz);
}

function DivAcKapa(ID){ //Status
   if(document.getElementById(ID).style.display=='' || document.getElementById(ID).style.display=='block' ){
      document.getElementById(ID).style.display='none'
   }else{
      document.getElementById(ID).style.display='block'
   }
}

function UyariAc(){
   PopDivObj=document.getElementById('UyariDiv');
   PopDivObj.style.position = 'absolute';
   PopDivObj.style.width="70%";
   PopDivObj.style.top=30 +"%";
   PopDivObj.style.left=15+"%";
   BekletD = window.setTimeout("PopDivObj.style.display='block'",1000) ;
   //window.status = getDivSize(PopDivObj);
   window.scrollTo(0,0);
}
function PP(Ed , B , Val, w, h){
//   alert(Val)
   if(fiId('popTamam')){
      fiId('popTamam').disabled=false;
      fiZamanla("fiId('popIKpt').focus();",190);
      fiZamanla("fiId('popTamam').focus();",200);
   }
   var windowX = (screen.width/2);
   var windowY = (screen.height/4);
   PopDivObj = fiId( "popTable");

   PopDivObj.style.position = 'absolute';
   PopDivObj.style.width= windowX +"px";// (w ? w : (windowX+"px")) ;
   //PopDivObj.style.height= (h ? h : "") ;
   //var top = getTop(Ed);
   //(getTop(fiId(Ed)))+ fiId(Ed).offsetHeight
   PopDivObj.style.top=  windowY + "px"
   PopDivObj.style.left=25+"%";
   Goster('popTable');
   //BekletD = window.setTimeout("PopDivObj.style.display='block'",100) ;
   if(B){ fiId( "popBaslik").innerHTML =B;}
   if(Val){ fiId( "popGovde").innerHTML =Val;}

   //window.status = document.body.offsetWidth + "-" +document.body.offsetHeight + " - " + windowX + "x" + windowY + "-->" + dd.offsetTop;
   //window.scrollTo(0,0);
}

getLeft=function(element){
   return element.getBoundingClientRect().left;
};
getTop=function(element){
   return element.getBoundingClientRect().top;
};

function PPKpt(Ed){
   PopDivObj = fiId( Ed ? Ed : "popTable");
   Gizle('popTable');
   //BekletD = window.setTimeout("PopDivObj.style.display='none';",100) ;
}
function ABekle(s , v){
   PP('UyariDiv', (s==1?':: Arama Yapılıyor ':' :: Uyarı') , '<img src="images/w.gif" border="0">  Lütfen Bekleyin'+ (s==1?' Arama İşleminiz Tamamlanıyor':'') +(v?" <b>("+v+" )</b>":"") +'...');
   //document.getElementById('GnlAraDiv').innerHTML='<br><br><center><img src="images/w.gif" border="0"> Lütfen Bekleyin ...</center><br>';
}
var tus;
function EventOgren(e) {
   if(e){ tus = e;} else{ return tus = tus || event;  }
    if(window.event){ return window.event.keyCode; }else if(tus.which){   return tus.which;}
}
function shiftKeyOgren(e) {
   if(e){ tus = e;} else{ return tus = tus || event;  }
    if(window.event){ return window.event.shiftKey; }else if(tus.which.shiftKey){   return tus.which.shiftKey;}
}


function dinle(Key, ed) {
    var K;
    K = EventOgren(Key);
    if((K==13) ){
      document.getElementById(ed).onclick();
    }
}
function sfac(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function bekleK(){
   if(BekletD)clearTimeout(BekletD);
   if(BekletI)clearTimeout(BekletI);
   if(document.getElementById('DisDiv'))document.getElementById('DisDiv').style.display='none';
   if(document.getElementById('IcDiv'))document.getElementById('IcDiv').style.display='none';
}
function bekle(){
   var Kalan =(screen.width-600)/2
   var Leftt = ((Kalan*100)/screen.width);
   PopDivObj = fiId( "IcDiv");
   PopDivObj.style.position = 'absolute';
   PopDivObj.style.width="600px";// (w ? w : (windowX+"px")) ;
   //PopDivObj.style.height='400px' ;
   PopDivObj.style.top="20%"
   PopDivObj.style.left=(Leftt-5)+"%";
   document.getElementById('DisDiv').style.width='100%';
   document.getElementById('DisDiv').style.height=screen.height+'px';
   BekletD = window.setTimeout("document.getElementById('DisDiv').style.display='block'",1000) ;
   BekletI = window.setTimeout("document.getElementById('IcDiv').style.display='block'",2000) ;
   window.scrollTo(0,0);
}

  function getFile(filename) {
    oxmlhttp = null;
    try {
      oxmlhttp = new XMLHttpRequest();
      oxmlhttp.overrideMimeType("text/xml");
    }
    catch(e) {
      try { oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
      catch(e) { return null; }
    }
    if(!oxmlhttp) return null;
    try {
      oxmlhttp.open("GET",filename,false);
      oxmlhttp.send(null);
    }
    catch(e) { return null; }
    return oxmlhttp.responseText;
  }
  
  getLeft=function(element){
   return element.getBoundingClientRect().left;
};
getTop=function(element){
   return element.getBoundingClientRect().top;
};



//onkeyup='return SadeceEmail(this,event)
//onkeypress='return SadeceNumara(event)'
//onkeypress='return SadeceHarf(event)
//onkeyup='return ParaFormati(this)
 
 
 
function SadeceHarf(e) {
	var K = EventOgren(e)
	//var whichCode = (window.Event) ? e.which : e.keyCode;
	if (K == 13) return true;  // Enter
	if (K == 44) return true;  // Comma
	if (K > 47 && K < 58){ return false;}
}

function SadeceNumara(e) {
	//var whichCode = (window.Event) ? e.which : e.keyCode;
	var K = EventOgren(e)
	//alert(whichCode);
	if (K == 13) return true;  // Enter
	//if (whichCode == 44) return true;  // Comma
	if (K > 57 ){
		return false;
	}
	if (K < 48 && K > 13){
		return false;
	}
}


function SadeceNumara2(e) {
	//var whichCode = (window.Event) ? e.which : e.keyCode;
	var K = EventOgren(e)
	//alert(whichCode);
	if (K == 13) return true;  // Enter
	//if (whichCode == 44) return true;  // Comma
	 
	
	if (K > 57 ){
		return false;
	}
	if (K < 46 && K > 13){
		return false;
	}
}

function ParaFormati(thisis) {
	//alert(thisis.value);
	var tempstr,newstr,str,i,str2 ;
	var commapos,aftercomma,commacount;
	i=0;
	str = thisis.value;
	
	if (str.indexOf(",")<0){// çalışma
	//alert(str);
	//str = str.replace(\".\",\"\");
	//alert(str);

	while ( 15 > i) {
		str = str.replace(".","");
		i=i+1;
		}
	commacount=0;
	commapos=str.indexOf(";");

	if (commapos>=0)
	{
		aftercomma=str.substr(commapos);
		str=str.substr(0,commapos);
	}
	else
		aftercomma="";

	if (str.length > 3)
	{
		tempstr=str;
		newstr="";
		while (tempstr.length>3)
		{
			newstr="."+tempstr.substr(tempstr.length-3)+newstr;
			tempstr=tempstr.substr(0,tempstr.length-3);
		}
		thisis.value = tempstr+newstr+aftercomma;
	}
	}//indexOf
	return true;
}

function SadeceEmail(thisis,e) {
         var str,i,isay;
         var gecersiz = "üÜğĞışŞİçÇöÖ!#/^\\'*\\\"{[()]}%&\\<>|é?+,;:æß ";
         var gecerli  = "uUgGisSIcCoO                                  ";
		 K =EventOgren(e);
		 //alert(K);
		 if(K==37)return;
         if ( (K == 35) || (K == 36) || (K == 46) || (K == 39) || (K == 37) || (K == 8)){
			return;			  
         }else{
           str = thisis.value;
           for (isay=0; isay<gecersiz.length; isay++){
             str = str.replace(gecersiz.charAt(isay),gecerli.charAt(isay));
             thisis.value = str;
           }
         }
         return true;
}

function ChkEMail(TmpStr) {
	var i, atPos, atPos2, atPos3, InvalidChars=" üÜğĞışŞİçÇöÖ!#/*{[()]}";
	for (i=0; i<InvalidChars.length; i++)
		if (TmpStr.indexOf(InvalidChars.charAt(i)) != -1) {
			return false;
		}
	atPos = TmpStr.indexOf("@");
	atPos2 = TmpStr.indexOf("@", atPos+1);
        atPos3 = TmpStr.indexOf(".", atPos+1);
	if ((atPos < 1) || (atPos2 != -1) || (atPos3 < atPos)) {
		return false;
	}
 }
 
 


function YeniCookie(ad, deger, gun) {
   if (gun) {
		var date = new Date();
		date.setTime(date.getTime()+(gun*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}else{
      var expires = "";
   }
   //alert(ad+"="+deger+expires+"; path=/" );
   document.cookie = ad+"="+deger+expires+"; path=/";
}

function OkuCookie(ad) {
	var adEQ = ad + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(adEQ) == 0) return c.substring(adEQ.length,c.length);
	}
	return false;
}

function SilCookie(ad) {
	YeniCookie(ad,"",-1);
}

function KontrolEt(btn, kuladi){
   IdBul(btn).disabled=true;
   IdBul(btn).value='Kontrol Ediliyor ...';
   gbtx_KulaniciAdiKontrol(kuladi);
}

function TumunuSec(f, d , j , _Tik){
    //f tumsec kutus
    //d id basları
    //j formelemanları   document.j.elements
    var jj = j ? j : document.GenelForm.elements;
    for (var i=0;i<jj.length;i++){
      var e=jj[i];
      if(e.id){
         if(e.id.substr(0,4)== d ){
            e.checked=document.getElementById(f).checked;
            if(_Tik) e.onclick();
         }
      }
    }
}



function PopSM(DosyaAdi, SayfaAdi, Komut, BoyutW, BoyutH) {
  var wKomut = '';
  wKomut = 'scroll:yes; help:no; center:yes; resizable:no; menubar:yes;;scrollbars:no;status:yes; dialogwidth:'+BoyutW+'px; dialogheight:'+BoyutH+'px;' + Komut;
  showModalDialog(DosyaAdi,SayfaAdi, wKomut);
};



function StrToFloat(SData){
   var T = "";
   var S = Array();
   var ii=0;
   var SS = "";

   D = SData.replace(/[^\d\.]/g, "|").replace(/[^\d\,]/g, "|");
   K = D.split("|");

   for (var i = 0; i < K.length; i++){
      T = K[i];
      if (T!='') {
         S[ii]=K[i];
         ii = ii + 1;
      }
   }

   if (S.length == 1){
      return SData;
   }

   for (var i = 0; i < S.length; i++){
       T = S[i];
       if ((S.length-1)==i) {
         SS = SS+"."+T
       }else{
         SS = SS+T
       }

   }
   return SS
}
function parseCurrency(obj){
       userVal=(obj.replace(/[^\d\.]/g, "")*1).toFixed(2).replace(".", ",");   //4-2
       for(i=userVal.length-6;i>0;i-=3)                                        //8-6
       userVal = userVal.substr(0,i)+"."+userVal.substr(i)
       return userVal;
}



function getFile(filename) {
    oxmlhttp = null;
    try {
      oxmlhttp = new XMLHttpRequest();
      oxmlhttp.overrideMimeType("text/xml");
    }
    catch(e) {
      try { oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
      catch(e) { return null; }
    }
    if(!oxmlhttp) return null;
    try {
      oxmlhttp.open("GET",filename,false);
      oxmlhttp.send(null);
    }
    catch(e) { return null; }
    return oxmlhttp.responseText;
  }


  function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1)
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }



function GridYazdir(DATA,TITLE){
	//alert(DATA);
	var AutoClose = false;
	if (parseInt(navigator.appVersion.charAt(0))>=4){
	var xisNN=(navigator.appName=="Netscape")?1:0;
	var xisIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
	var xoptNN='scrollbars=no,width=800,height=500,left=100,top=100';
	var xoptIE='scrollbars=no,width=800,height=500,left=100,top=100';

   if (xisNN){ximgWin=window.open('about:blank','',xoptNN);}
   if (xisIE){ximgWin=window.open('about:blank','',xoptIE);}
   with (ximgWin.document){
	   
   writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
   writeln('<link href="css/css.css" rel="stylesheet" type="text/css" />'); 
   
   writeln('<sc'+'ript>');
   writeln('window.setTimeout(function(){window.print();} , 2000); ');
   writeln('var xisNN,xisIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
   writeln('xisNN=(navigator.appName=="Netscape")?1:0;');writeln('xisIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
   writeln('function reSizeToImage(){');writeln('if (xisIE){');writeln('window.resizeTo(100,100);');
   writeln('width=100-(document.body.clientWidth-document.images[0].width);');
   writeln('height=100-(document.body.clientHeight-document.images[0].height);');
   writeln('window.resizeTo(width,height);}');writeln('if (xisNN){');
   writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
   writeln('function doTitle(){document.title="'+TITLE+'";}');
   writeln('</sc'+'ript>');
   
   if (!AutoClose) writeln('</head><body scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
   else writeln('</head><body   scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');

  
   if(TITLE)writeln('<div class="pd10 c f16 k">'+TITLE+'</div>'); 
   writeln(DATA);
   writeln('</body></html>');
      
   close();
   }
}

