function AllPhoneSearchTwo(form, root_path) { this.append = 'mobile-phone-finder'; this.form = form; this.root_path = root_path; this.network_field = (this.form.network) ? this.form.network : ''; this.phone_field = this.form.phone; this.data = new Array(); this.handsets = new Array(); this.InitHandsets(); } AllPhoneSearchTwo.prototype.ChangeHandset = function(handset) { for (i = this.network_field.options.length; i >= 0; i--) { this.network_field.options[i] = null; } // Add the option to select the handset/network this.network_field.options[0] = new Option(((handset != "") ? "Now choose Network..." : "...then choose Network"), ""); // If a network is selected, add the options if (handset != "" && this.data[handset]) { // this.network_field.options[this.network_field.options.length] = new Option('all', 'all'); for (i = 0; i < this.data[handset].length; i++) { this.network_field.options[this.network_field.options.length] = new Option(this.data[handset][i][0], this.data[handset][i][1]); } if (this.previously_selected > 0) this.network_field.selectedIndex = this.previously_selected; if (this.phone_field != '') { this.phone_field.value = handset; } } } AllPhoneSearchTwo.prototype.ChangeNetwork = function(network) { var i; // Remove all the options out of the phone field for (i = this.phone_field.options.length; i >= 0; i--) { this.phone_field.options[i] = null; } // Add the option to select the handset/network this.phone_field.options[0] = new Option(((network != "") ? "Choose Handset first..." : "...then choose Network"), ""); // If a network is selected, add the options if (network != "" && this.data[network]) { for (i = 0; i < this.data[network].length; i++) { this.phone_field.options[this.phone_field.options.length] = new Option(this.data[network][i][0], this.data[network][i][1]); } if (this.previously_selected > 0) this.phone_field.selectedIndex = this.previously_selected; if (this.network_field != '') { this.network_field.value = Network; } } } AllPhoneSearchTwo.prototype.InitHandsets = function() { for (i = this.phone_field.options.length; i >= 0; i--) { this.phone_field.options[i] = null; } // Add the option to select the handset/network this.phone_field.options[0] = new Option("Choose Handset first...", ""); for (i = 0; i < this.handsets.length; i++) { this.phone_field.options[this.phone_field.options.length] = new Option(this.handsets[i][0], this.handsets[i][1]); } } AllPhoneSearchTwo.prototype.GoTo = function(url) { if (url != "") { document.location.href = url; } }