

//var l=document.frm.passyr.indexOf("Y");
function date(searchCondition){
        if ((event.keyCode>47) && (event.keyCode<58))
        {
            s(searchCondition);
            filterRecord(searchCondition);
        }
        else
        {
            return false;
        }
}
var cur;
function filterRecord(searchCondition)
{
	var search = searchCondition.value;
	cur=1;
	for(var i=0;i<cur;i++)
	{
            var temp =  searchCondition.value.substring(0,3);
            cur=search.length;
            if(cur==null)
            {
                System.out.println("value is null in txtbox");
            }
            cur--;
            if((l=="-1") || (l=="4"))
            {
            }
            else
            {
		document.frm.passyr.value=temp;	
		var range = document.frm.passyr.createTextRange(); 
                range.move("character", l); 
                range.select();
            }
	}
	cur++;
        return true;
}

function s(el)
{
    var sel, rng, r2, i=-1;
    if(typeof el.selectionStart=="number")
    {
        i=el.selectionStart;
    }
    else if(document.selection && el.createTextRange) 
    {
        sel=document.selection;
        if(sel)
        {
            r2=sel.createRange();
            rng=el.createTextRange();
            rng.setEndPoint("EndToStart", r2);
            i=rng.text.length;
        }
    }
    else 
    {
        el.onkeyup=null;
        el.onclick=null;
    }
    l=i;
}

//////////////////////////////////////end of date YYYY//////////////////////////////////////////////////////
function checknum(abc)
{
   var num = abc.value;
   if(isNaN(num))
   {
       alert("You can enter only numeric values.")
       abc.select();
       abc.focus();
   }
}

function checkloc()
{
    var count=0;
    for(var i=0; i<document.frm.preflocation.length; i++)
    {      
        if(document.frm.preflocation.options[i].selected)
        {
            count++;
            if(count>3)
            {
                alert("You cannot select more than three locations!");
                document.frm.preflocation.options[i].selected=false;
                count=0;
                return false;
            }
        }
    }    
}

/*function deselect()
{
    for(var i=0; i<document.frm.preflocation.length; i++)
    {
        if(document.frm.preflocation.options[i].selected)
        {
            document.frm.preflocation.options[i].selected=false;
        }
    }
}*/







