function chkcount(cid)
{
var car=new Array();
var chkStatus=document.getElementById(cid).checked;
if(chkStatus == true)
{
//car.push(cid);
alert(chkStatus);
}
else
{
if (car.lastIndexOf(cid)!=-1)
{
car.splice(car.lastIndexOf(cid), 1);
alert(' ' + car.lastIndexOf(cid));
}
}
alert(' ' + car);
}

What is the error in this function block.....
I am getting an error in else block at lastIndexOf().....
The cid value will be like chk1, chk2, chk3....