CWolves, that is one of the better solutions I've seen. Hard to get at without using a packet sniffer.
As, LordShryku has shown you can't get 100% because the user can always sniff the javascript, but I know I can't achieve 100% protection with javascript. That's just not realistic. I think a solution like yours or maybe like the one I mentioned (which I still haven't gotten around to - it's a side project) will keep it from many a web developer's eyes.
Used in combination with a javascript obfuscator could cause it to be to time consuming for many to bother (as well as throwing in some useless functions that never get called as a means of bloating the code a little)
Thanks for all the replies. If I'm able to come up with a re-usable "solution", I will post it.