function metinKutusuFocus(eleman,metin){
	if(eleman.value==metin){
		eleman.value='';
	}
}
function metinKutusuBlur(eleman,metin){
	if(eleman.value==''){
		eleman.value=metin;
	}
}
function post(post, to){
	var myForm = document.createElement("form");
	myForm.method="post" ;
	
	if (typeof(to)!='undefined')
	myForm.action = to ;
	
	for (var k in post) {
		var myInput = document.createElement("input") ;
		myInput.setAttribute("name", k) ;
		myInput.setAttribute("value", post[k]);
		myForm.appendChild(myInput) ;
	}
	
	document.body.appendChild(myForm) ;
	myForm.submit() ;
	document.body.removeChild(myForm) ;
}
function gizleAc(oge){
	if(document.getElementById(oge).style.display=='none'){
		document.getElementById(oge).style.display='block';
	}else{
		document.getElementById(oge).style.display='none';
	}
}
function kontrolsuzGizleAc(oge,yeniDurum){
	document.getElementById(oge).style.display=yeniDurum;
}
function ozelYetkiGosterimi(oge){
	if(oge.checked==false){
		document.getElementById('ozelYetkiler').style.display='none';
		document.getElementById('ozelYetkiler').style.visibility='hidden';
	}else{
		document.getElementById('ozelYetkiler').style.display='block';
		document.getElementById('ozelYetkiler').style.visibility='visible';
	}
}
function formElemanAc(formElemani,eleman,islemYapilanEleman){
	if(formElemani.value==eleman){
		document.getElementById(islemYapilanEleman).style.display='block';
	}
}
function formElemanKapat(formElemani,eleman,islemYapilanEleman){
	if(formElemani.value==eleman){
		document.getElementById(islemYapilanEleman).style.display='none';
	}
}
function sonrakiKutucuk(eleman,sonrakiEleman,limit){
	elemanIcerikSay=eleman.value.length;
	
	//document.write(elemanIcerikSay);
	
	if(elemanIcerikSay == limit){
		document.getElementById(sonrakiEleman).focus();
	}
}
function kucuktenBuyuge(eleman) {
	var elemanVal=eleman.value;
    eleman.value=(elemanVal+'').toUpperCase();
}
function metinKutusu(eleman,metin){
	if(eleman.value==metin){
		eleman.value='';
	}else{
		eleman.value=metin;
	}
}
function FindComma(value){
	var len=value.length-1;
	
	for (i=len;i>=0;i--){
		if(value.charAt(i)== ",") { return i;}
	}
	return 0;
}
function yeniTurkLirasi(obj) {

var value=obj.value;
var len=obj.value.length-1;

var fstr="";
var fstr_comma="";

var zerocount=4; // numbers before comma as 111,xxxx

var tmp="";
var comma=0;
var intlen=0;
var upperlimit=0;

comma=FindComma(value); // finds comma position

for (i=0;i<=len;i++){
(
(
value.charAt(i).match(/^([0-9])$/) 
|| (value.charAt(i)== "," && (comma && comma==i))
)
&& value.charAt(i)!= "."
) ? tmp=tmp+value.charAt(i) : NaN;
}
comma=FindComma(tmp); 

if(comma>0) { intlen=comma-1; }
else { intlen = tmp.length-1; }

j=0
for (i=intlen;i>=0;i--){
j++;
if ((j % 3)==0 && i>0){
fstr="." + tmp.charAt(i) + fstr;
j=0;
} 
else
fstr=tmp.charAt(i) + fstr;
}

if (comma>0) {
upperlimit = comma+zerocount // upperlimit = len 

for (i=upperlimit;i>=comma;i--){
fstr_comma=tmp.charAt(i) + fstr_comma;
}
}
return fstr+fstr_comma;
}
function sayiMi() 
{
	var N=event.keyCode;
	if ((((N==9) || (N==8)) || ((N==46) || (N==111))) || (((N>95&&N<106) || (N>47&&N<58)) || ((N>95&&N<106) || (N>32&&N<40))))
	{
		event.returnValue=true; 
	}
	else
		event.returnValue=false;	
}
function formatLa(deger, ayrac, hedef){
	var retVal = "";	var T = "";
	var x = deger.split(ayrac)
	for (i = 0; i < x.length ; i++) { T += String(x[i]); }
	for (i = T.length; i > 0 ; i--) {
		if (((T.length - i) % 3 == 0) && (i < T.length)) { retVal = T.substring(i-1,i) + ayrac + retVal ; }
		else { retVal = T.substring(i-1,i) + retVal }
	}	
	if (hedef == null)
		event.srcElement.value = retVal ;
	else
		hedef.value = retVal;
}
function yeniPencere600400(myform, windowname){
	if (! window.focus)return true;
	window.open('', windowname, 'height=400,width=600,scrollbars=yes');
	myform.target=windowname;
	return true;
}
function yeniPencere800500(myform, windowname){
	if (! window.focus)return true;
	window.open('', windowname, 'height=500,width=800,scrollbars=yes');
	myform.target=windowname;
	return true;
}
function yeniPencereUrl(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=360,left = 440,top = 250');");
}
function yeniPencere(URL,genislik,yukseklik) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+genislik+",height="+yukseklik+",left = 250,top = 200,right = auto,bottom = auto');");
}

