// JavaScript Document
function checkInteger_2( evt )
{
   
    var ch;             // the character to process
    
    var keyOK = false;  // presume it's bad

    var isSpecial;      // non-printing character?
    
    var source;         // the event source
    
    var intPattern = /^[0-9]{0,11}$/;

    if (!evt)
    {
        evt = window.event;
    }

    ch = evt.charCode;
	//alert(ch);
    if (!ch)
    {
        ch = evt.keyCode;
    }

    isSpecial = ( ch == evt.DOM_VK_TAB || ch == evt.DOM_VK_BACK_SPACE || ch == evt.DOM_VK_LEFT || ch == evt.DOM_VK_RIGHT);

    if (isSpecial)
    {
        keyOK = true;
    }
    else
    {
        ch = String.fromCharCode( ch );
		
        if (evt.target) 
        {
            source = evt.target;
        }
        else
        {
            source = evt.srcElement;
        }
		var str=source.value+'';
		
		if((str.length == 3) || (str.length == 7))
		{
			if(ch != '-')
			{
				source.value=source.value;
			}
		}
		else
		{
			if(ch == '-')
			{
				ch = 'Q';
			}

		}

        keyOK = intPattern.test( source.value + ch );
    }
    return keyOK;
}
