7 callback.init = function() {
9 callback.type = 'browser';
11 callback.type = 'iphone';
15 String.prototype.replaceAll = function(stringToFind,stringToReplace) {
17 var index = temp.indexOf(stringToFind);
19 temp = temp.replace(stringToFind,stringToReplace);
20 index = temp.indexOf(stringToFind);
25 callback.send = function()
27 var args = [].splice.call(arguments,0);
28 for (var i = 0; i < args.length; i++) {
30 args[i] = args[i].replaceAll(':','_');
32 alert("args was null: " + i);
34 var message = "myapp:" + args.join(":");
35 if (this.type == 'iphone')
36 document.location = message;
38 // Debug communication with Web View
39 // document.getElementById("log").innerHTML = message;
44 function search(message) {
45 document.search.query.value = message;
46 onFormSubmitEventHandler();
54 function onFormSubmit() {
55 return search(document.search.query.value);