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>';
}
function EventOgren(e) {
   if(e){ tus = e;} else{ tus = tus || event; }
    if(window.event){ return window.event.keyCode; }else if(tus.which){   return tus.which;}
}
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 whichCode = (window.Event) ? e.which : e.keyCode;

	if (whichCode == 13) return true;  // Enter
	if (whichCode == 44) return true;  // Comma
	if (whichCode > 47 && whichCode < 58){
	return false;}
}

function SadeceNumara(e) {
	//alert(window.event.srcElement.value);
	var whichCode = (window.Event) ? e.which : e.keyCode;

	if (whichCode == 13) return true;  // Enter
	if (whichCode == 44) return true;  // Comma
	if (whichCode > 57 ){
	return false;}
	if (whichCode < 48 && whichCode > 13){
	return false;}
}

function 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          ";
         var whichCode = (window.Event) ? e.which : e.keyCode;
         if ((whichCode == 46) || (whichCode == 39) || (whichCode == 37) || (whichCode == 8)){
         }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;
	}
 }
