From what I read of your code, your are inviting the user's browser to identify itself.
The for xx in search_strings is a way of finding a fragment of a phrase that describe the browser.
I was suggesting you set up an array for a third set of search strings using the Mobile Browsers list at the given URL, where you have a loop for (k in search_strings) { ...} coupled with if (detect()) window.location = "http://yourwebsite.com/tablet/";.

You could also point any tablet you have to
http://whatsmyuseragent.com/ and examine the userAgent string that returns.
Perhaps we should all contribute our device's userAgents here?
As I'm on a computer, using Chrome, I'm showing
Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.102 Safari/537.36
Acorn