// search google
(function () {
	var q = window.prompt('Search Google:', ''), url;
	if (!q) {
		return;
	}
	url = 'http://www.google.com/search?q=' + encodeURIComponent(q);
	if (location.href == '/' || location.href == 'about:blank') {
		location.href = url;
	} else {
		window.open(url);
	}
})()

// search wikipedia (en)
(function () {
	var q = window.prompt('Search Wikipedia:', ''), url;
	if (!q) {
		return;
	}
	url = 'http://en.wikipedia.org/wiki/Special:Search?search=' + encodeURIComponent(q);
	if (location.href == '/' || location.href == 'about:blank') {
		location.href = url;
	} else {
		window.open(url);
	}
})()

// search answers.com
(function () {
	var q = window.prompt('Search Answers.com:', ''), url;
	if (!q) {
		return;
	}
	url = 'http://www.answers.com/main/ntquery?s=' + encodeURIComponent(q);
	if (location.href == '/' || location.href == 'about:blank') {
		location.href = url;
	} else {
		window.open(url);
	}
})()
