//Java script to handle 1000 separators
function Prb()
{
}

function Separators(inp)
{
	a='';
	ertek=inp.value;
	j=0;
	for(i=ertek.length-1;i>=0;i--)
	{
		if ((ertek.charAt(i)>='0' && ertek.charAt(i)<='9') | (ertek.charAt(i)==','))
		{
			a=ertek.charAt(i)+a;
			//csak ha a vesszőt elhagytuk már! vagy ha nincs vessző
			if (ertek.indexOf(',')>i | ertek.indexOf(',')==-1)
				j++;
		}
		if(j==3 & i>0)
		{
			j=0;
			a='.'+a;
		}
	}
	inp.value=a;
}


// Java Script to Handle AutoSearch
function selectKeyDown()
{
    // Delete Key resets previous search keys
    if(window.event.keyCode == 46)
        clr();
    if(window.event.keyCode == 8){
        clr();
		window.event.keyCode=0;
	}
}

function selectKeyPress()
{
    // Notes:
    //    1) previous keys are cleared onBlur/onFocus and with Delete key
    //    2) if the search doesn't find a match, this returns to normal 1 key search
    //        setting returnValue = false below for ALL cases will prevent
    //        default behavior
    
    //TODO:
    //    1) add Netscape handling
    

    var sndr = window.event.srcElement;
    var pre = this.document.all["keys"].value;
    var key = window.event.keyCode;
    var char = String.fromCharCode(key);
    var re = new RegExp("^" + pre + char, "i"); // "i" -> ignoreCase
    for(var i=0; i<sndr.options.length; i++)
    {
        if(re.test(sndr.options[i].text))
        {
            sndr.options[i].selected=true;
            document.all["keys"].value += char;
            window.event.returnValue = false;
			//sndr.onchange();
            break;
        }
    }
}
function clr()
{
    document.all["keys"].value = "";
}


