It appears you're counting is wrong. You're retrieving the first 8 characters from Message and then you compare that to "apply" which is only 5 characters in length. Same happens for your "applyver" check.
js code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind){
>>> if(Message.substr(0,5).toLowerCase()=="apply"){<<<
var i = Math.floor((Math.random()*(sArray.length-1)));
return "[b][i][c=red]"+sArray[i]+"[/c][/i][/b]";
}
>>> if(Message.substr(0,8).toLowerCase()=="applyver"){<<<
var h = Math.floor((Math.random()*(dArray.length-1)));
return "[b][i][c=blue]"+dArray[h]+"[/c][/i][/b]";
}
}
Fix that and see if it works better now?