I'm not sure I have followed you here but i'd do it a little more like this....
Code:
<script>
function changeCcls(id)
{
var cls = document.getElementById(id).className;
if(cls == 'unactive'){
document.getElementById(id).className= 'active';
}else{
document.getElementById(id).className= 'unactive';
}
}
</script>
<style>
.active{color:red;}
.unactive{color:blue;}
</style>
<div id='1' class='unactive' onmouseover='changeCcls("1")' onmouseout='changeCcls("1")'>123</div>
<div id='2' class='unactive' onmouseover='changeCcls("2")' onmouseout='changeCcls("2")'>123</div>
<div id='3' class='unactive' onmouseover='changeCcls("3")' onmouseout='changeCcls("3")'>123</div>
But yes you could just use an array and run through that see if it has the id you want to accept then run the code... all up to you really.
I hope that helps.
edit//
I should have mentioned if you just want this as a class change you could do it with css only.
Code:
<style>
div{padding:10px}
div:hover{color:white; background-color:#444;}
</style>
<div>123</div>
<div>123</div>
<div>123</div>
just add a class and change div to .classname and saves lots of lines.