function filterArray(str,array){ //This function is a filter array Duplicate elements in and do not allow to insert null values, the function returns the array
var isnull = false;
if(str == "" || str == null || str == 'undefined'){
isnull = true;
}
var newnum = 0;
var newarray = [];
var num = array.length;
if(num == 0){
if(!isnull){
newarray[num] = str;
}
}else{
for(var m=0;m < num;m ){
if( str == array[m]){
break;
}else{
newarray[newnum] = array[m];
}
}
if(!isnull){
newarray[newnum] = str;
}
}
return newarray;
}
Reposted from:
http://www.52blogger. com/archives/588