﻿function Amount_OnKeyUp(sender)
{
    var value = sender.value.replace(/,/g, "");
	var result = "";
	var index = 1;
	for (var iLoop = value.length; iLoop >= 0; iLoop--)
	{
		if (result.length == index * 4 - 1)
		{
			index++;
			result = "," + result;
		}
		result = value.substr(iLoop, 1) + result;
	}
	sender.value = result;
}

function Only_Numeric(e)
{
	var whichCode = (window.Event) ? e.which : e.keyCode;

    //window.status = whichCode;

	if (whichCode == 13) return true;
	if (whichCode == 8) return true;
	if (whichCode == 46) return true;
	if (whichCode >= 96 && whichCode <= 105) return true;
	if (whichCode > 57) return false;
	if (whichCode < 48 && whichCode > 13) return false;
}

function Only_Letter(e)
{
    var whichCode = (window.Event) ? e.which : e.keyCode;
	if (whichCode == 13) return true;
	if (whichCode == 0) return true;
	if (whichCode == 8) return true;

	if ((whichCode >= 97 && whichCode <= 122) || (whichCode <= 90 && whichCode >= 65))
	    return true;

	var validChars = "üÜğĞşŞıİçÇöÖ ";
	for (i = 0; i < validChars.length; i++)
		if (whichCode == validChars.charCodeAt(i))
			return true;
	return false;
}

function Only_English_Letter(e)
{
	var whichCode = (window.Event) ? e.which : e.keyCode;
	var validChars = "üÜğĞşŞıİçÇöÖ";
	for (i = 0; i < validChars.length; i++)
		if (whichCode == validChars.charCodeAt(i))
            return false;
    return true;
}