// ==UserScript==
// @name Save searches using wand
// @author Shoust 
// @namespace http://opera.oslocity.org/shoust/ 
// @version 1.1
// @description  Saves searches using he wand on the ebay, google and
//			alltheweb sites
// @ujs:category site: enhancements
// @ujs:published 2005-09-29 08:34
// @ujs:modified 2005-09-29 16:27
// @ujs:documentation http://userjs.org/scripts/site/enhancements/save-searches-using-wand 
// @ujs:download http://userjs.org/scripts/download/site/enhancements/save-searches-using-wand.js
// ==/UserScript==


/* 
 * This script is granted to the Public Domain.
 */

document.addEventListener('load',function(){
	var oForms = [
		// you can add more here - the way it works is to change a hidden input (of your choice) into a pasword input
		// ['formName','hiddenInputNameToAbuse','inputYouWantToSave','match.domains.containing.this'],
		['f','hl','q','.google.'],
		['gs','hl','q','.google.'],
		['find','from','satitle','.ebay.'],
		['f','cat','q','.alltheweb.'],
	null];
	for( var i = 0; oForms[i]; i++ ) {
		if( location.hostname.indexOf(oForms[i][3]) == -1 ) { continue; }
		var oForm = document[oForms[i][0]];
		if( !oForm || !oForm[oForms[i][1]] || !oForm[oForms[i][2]] ) { continue; }
		var x = oForm[oForms[i][1]];
		x.type = 'password';
		x.setAttribute('style','width: 0px; height: 0px;');
		var y = x.value;
		oForm[oForms[i][2]].onkeypress = function () { x.value = this.value; };
		oForm.onsubmit = function () { x.value = y; };
	}
},false);
