document.onkeypress = spress;
var browserName=navigator.appName;
var browserVer=navigator.userAgent;
var browserVer = browserVer.substring(30,31);
function jav()
{
if(!document.getElementById('in').focus()) {
	document.getElementById('in').focus()
}
if (browserName == "Microsoft Internet Explorer" && browserVer > 6){
	document.getElementById("fire").innerHTML= "<a href=http://www.mozilla.com/en-US/firefox/><img src=http://haastek.co.uk/blog/pictures/ff/468x60FF2b_Orange.png width=468 height=60 alt=Firefox /></a>";
}
else if (browserName == "Microsoft Internet Explorer" && browserVer < 7){
	document.getElementById("fire").innerHTML= "<div id=crap_browser><h1>Warning, the web browser you are using is obsolete! Please either upgrade to <a href=http://www.mozilla.com/en-US/firefox/>Firefox </a>(Recommended) or get the latest version of <a href=http://www.microsoft.com/windows/downloads/ie/getitnow.mspx>Internet Explorer</a>.</h1></div>";
}
}
function spress(e) {
	var code;
	if (!e) var e = window.event;
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;
	if(code==13) {
	var imp1 = document.getElementById('zee');
	var imp2 = document.getElementById('in');
	process(imp1, imp2);
	}
}
function process(elem, elem2)
{
var url = false;
var q = elem2.value;
function trim(q){
var l=0; var r=q.length -1;
while(l < q.length && q[l] == ' ')
{	l++; }
while(r > l && q[r] == ' ')
{	r-=1;	}
return q.substring(l, r+1);
}
if(elem.value == 4){
var q = q.replace(/ /g, "_");
}
else {
var q = q.replace(/ /g, "+");
}
var q = q.replace(/"/g, '%22');
if (elem.value == 1){
url = 'http://www.google.co.uk/search?hl=en&q=' + q + '&btnG=Google+Search&meta=';
}
else if (elem.value == 2 && q != ''){
url = 'http://search.ebay.co.uk/search/search.dll?cgiurl=http%3A%2F%2Fcgi.ebay.co.uk%2Fws%2F&fkr=1&from=R8&satitle=' + q + '&category0=';
}
else if (elem.value == 2 && q == ''){
window.location = 'http://ebay.co.uk';
}
else if (elem.value == 3 && q != ''){
url = 'http://www.youtube.com/results?search_query=' + q + '&search=Search';

}
else if (elem.value == 3 && q == ''){
window.location = 'http://www.youtube.com';
}
else if (elem.value == 4){
url = 'http://en.wikipedia.org/wiki/' + q;
}
else if (elem.value == 5){
url = 'http://www.amazon.co.uk/s/ref=nb_ss_w_h_/203-6419174-4335918?url=search-alias%3Daps&field-keywords=' + q + '&Go.x=0&Go.y=0&Go=Go';
}
else if (elem.value == 6 && q != ''){
url = 'http://www.play.com/Search.aspx?searchtype=allproducts&searchstring=' + q + '&page=search&pa=search&go.x=0&go.y=0';
}
else if (elem.value == 6 && q == ''){
window.location = 'http://www.play.com';
}
else if (elem.value == 7 && q != ''){
url = 'http://imdb.com/find?s=all&q=' + q;
}
else if (elem.value == 7 && q == ''){
window.location = 'http://imdb.com';
}
else if (elem.value == 8) {
url = "http://www.wolframalpha.com/input/?i=" + q;
}
if(url!=false)
window.location=url;
}
