﻿// AnotherSE © Andrienko Ilia a.k.a. EvolMate
// http://evolmate.wordpress.com/2009/09/29/anotherse-userjs-for-opera/

// Based on original adfind.js © VVSite
// http://vvsite.com.ua/?fl=0&i=21

// Thanks to DrPepper

// ==UserScript==
// @name        Another SE
// @namespace	http://evolmate.wordpress.com
// @include	http://*google*
// @version     2.0
// @date        2009-09-30
// @author      Andrienko Ilia <evolmate@gmail.com>
// @download    http://dl.getdropbox.com/u/1684364/opera/userjs/anotherSE.user.js
// ==/UserScript==


function anotherSE(){
	if (top.location.href.indexOf('www.google.')>-1 && document.getElementById("AnSE")==null) {
		
		AnSE_div=document.createElement('DIV'); 

		AnSE_div.id="AnSE"; 
		qu=document.getElementsByName('q')[0].value;

		AnSE_div.innerHTML+="<br>&#1042;&#32;&#1088;&#1091;&#1089;&#1089;&#1082;&#1080;&#1093;&#32;&#1087;&#1086;&#1080;&#1089;&#1082;&#1086;&#1074;&#1099;&#1093;&#32;&#1089;&#1080;&#1089;&#1090;&#1077;&#1084;&#1072;&#1093;&#58;"

		AnSE_div.innerHTML+='&nbsp; &nbsp;<a href="http://www.yandex.ru/yandsearch?text='+qu+'" target="_blank">Yandex</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://search.rambler.ru/cgi-bin/rambler_search?words='+qu+'" target="_blank">Rambler</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://go.mail.ru/search?mailru=1&q='+qu+'" target="_blank">Mail.ru</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://sm.aport.ru/scripts/template.dll?That=std&r='+qu+'" target="_blank">Aport</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://gogo.ru/go?q='+qu+'" target="_blank">GoGo</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://meta-ukraine.com/search.asp?q='+qu+'" target="_blank">META</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://nigma.ru/index.php?s='+qu+'" target="_blank">Nigma</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://results.metabot.ru/?st='+qu+'" target="_blank">MetaBot</a>';
		AnSE_div.innerHTML+="<br>&#1042;&#32;&#1079;&#1072;&#1088;&#1091;&#1073;&#1077;&#1078;&#1085;&#1099;&#1093;&#32;&#1087;&#1086;&#1080;&#1089;&#1082;&#1086;&#1074;&#1099;&#1093;&#32;&#1089;&#1080;&#1089;&#1090;&#1077;&#1084;&#1072;&#1093;&#58;"

		AnSE_div.innerHTML+='&nbsp; &nbsp;<a href="http://www.bing.com/search?q='+qu+'" target="_blank">Bing</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://search.yahoo.com/search?p='+qu+'" target="_blank">Yahoo!</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://www.ask.com/web?q='+qu+'" target="_blank">Ask</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://www.altavista.com/web/results?q='+qu+'" target="_blank">Altavista</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://www.dogpile.com/dogpile/ws/results/Web/'+qu+'/1/417/TopNavigation/Relevance/iq=true/zoom=off/_iceUrlFlag=7?_IceUrl=true" target="_blank">DogPile</a>';

		if(document.getElementById("bsf")){
			document.getElementById("bsf").appendChild(AnSE_div); 
		}
		else{	
			AnSE_div.style.paddingBottom="10px";
			document.getElementById("flp").appendChild(AnSE_div); 
		}

		
	


	}

	else if(top.location.href.indexOf('images.google.')>-1 && document.getElementById("AnSE")==null){

		AnSE_div=document.createElement('DIV'); 
		AnSE_div.id="AnSE"; 
		qu=document.getElementsByName('q')[0].value;

		AnSE_div.innerHTML='<br>&#1055;&#1086;&#1080;&#1089;&#1082;&#1072;&#1090;&#1100;&#32;&#1074;&#32;&#1076;&#1088;&#1091;&#1075;&#1080;&#1093;&#32;&#1089;&#1080;&#1089;&#1090;&#1077;&#1084;&#1072;&#1093;&#58;';

		AnSE_div.innerHTML+='&nbsp; &nbsp;<a href="http://images.yandex.ru/yandsearch?text='+qu+'" target="_blank">Yandex</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://images.search.yahoo.com/search/images?p='+qu+'" target="_blank">Yahoo</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://www.picsearch.com/search.cgi?q='+qu+'" target="_blank">Picsearch</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://www.altavista.com/image/results?q='+qu+'" target="_blank">Altavista</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://www.imagetoss.com/redirect.php?q='+qu+'" target="_blank">Imagetoss</a>';

		AnSE_div.innerHTML+='</div>';
		if(document.getElementById("repfa")){
			document.getElementById("repfa").parentNode.appendChild(AnSE_div); 
		}
		else{
			document.getElementById("repfa").parentNode.appendChild(AnSE_div); 
		}

	}

	else if(top.location.href.indexOf('video.google.')>-1 && document.getElementById("AnSE")==null){

		AnSE_div=document.createElement('DIV'); 
		AnSE_div.id="AnSE"; 
		qu=document.getElementsByName('q')[0].value;
		
		AnSE_div.innerHTML='<br>&#1055;&#1086;&#1080;&#1089;&#1082;&#1072;&#1090;&#1100;&#32;&#1074;&#32;&#1076;&#1088;&#1091;&#1075;&#1080;&#1093;&#32;&#1089;&#1080;&#1089;&#1090;&#1077;&#1084;&#1072;&#1093;&#58;';

		AnSE_div.innerHTML+='&nbsp; &nbsp;<a href="http://video.yandex.ru/search.xml?text='+qu+'" target="_blank">Yandex</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://www.bing.com/videos?scope=video&q='+qu+'" target="_blank">Bing</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://www.gogo.ru/video?q='+qu+'" target="_blank">GoGo</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://nova.rambler.ru/video?query='+qu+'" target="_blank">Rambler</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://www.blinkx.com/videos/'+qu+'" target="_blank">Blinkx</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://www.searchforvideo.com/search.php?k='+qu+'" target="_blank">searchforvideo</a>';
		AnSE_div.innerHTML+='&nbsp;-&nbsp;<a href="http://www.truveo.com/search?query='+qu+'" target="_blank">Truveo</a>';


		AnSE_div.innerHTML+='</div>';

		document.getElementById("searchagain").appendChild(AnSE_div); 

	}	




};



window.onkeydown=function(keyHandler){ 
	if(keyHandler.ctrlKey && (top.location.href.indexOf('www.google.')>-1 | top.location.href.indexOf('images.google.')>-1)){
		if (keyHandler.keyCode==39 && document.getElementById("nav").childNodes[0].firstChild.lastChild.innerHTML.match(/href=\"([\D\d]*?)\"/i))top.location.href="http://"+document.domain+decodeURI(RegExp.$1.replace(/\&amp\;/ig,"&"));
		if (keyHandler.keyCode==37 && document.getElementById("nav").childNodes[0].firstChild.firstChild.innerHTML.match(/href=\"([\D\d]*?)\"/i))top.location.href="http://"+document.domain+decodeURI(RegExp.$1.replace(/\&amp\;/ig,"&"));
	}; 
};

anotherSE();