
function ChangeGoogleFormAction(se)
{

	for(i=0;i<document.forms.length;i++)
	{
		if(se == 1) // Omgili
			document.forms[i].action = 'http://www.omgili.com/omgili.search'
			
		if(se ==2) // yahoo
		{
			document.forms[i].action = 'http://search.yahoo.com/search'
			if(document.forms[i].p)
				document.forms[i].p.value = document.forms[i].q.value;
		}
	}
}



function AddSEToGoogleMainPage()
{
	var FormStr = "<input type=submit value=\"Yahoo!\" onclick=\"ChangeGoogleFormAction(2)\"><input type=submit value=\"Omgili\" onclick=\"ChangeGoogleFormAction(1)\"><input type=hidden name=p>";
	
	InputElements = document.body.getElementsByTagName("INPUT");
	if(InputElements)
	{
		for(i=0;i<InputElements.length;i++)
		{
			if(InputElements[i].name == "btnG")
			{
				InputElements[i].parentNode.innerHTML = InputElements[i].parentNode.innerHTML + FormStr;
				
				return;
			}
		}
	}
}
function get_search_form()
{
	FormElements = document.body.getElementsByTagName("FORM");
	
	if(FormElements)
	{
		for(i=0;i<FormElements.length;i++)
		{
			if(FormElements[i].action == '/search' ||
			   FormElements[i].action == 'http://www.google.com/search' ||	
			   FormElements[i].action == '/custom' ||	
			   FormElements[i].action == '/unclesam' ||	
			   FormElements[i].action == '/linux' ||	
			   FormElements[i].action == '/bsd' ||	
			   FormElements[i].action == '/mac' ||	
			   FormElements[i].action == '/microsoft')
			   {
				   return FormElements[i];
			   }
		}
	}
	
	return null
}


var href = document.location.href;

// Google 
if (!(/\.(js|css|xml|rss|pdf)$/.test(href)) &&
	!(/complete\/search/.test(href)) 		&&
	 ( /^http[s]?:\/\/[^.]*\.(google|googleproxy)\.[a-z\.]+\//.test(href) || /^http:\/\/(64\.233\.161\.99|64\.233\.161\.104|64\.233\.161\.105|64\.233\.161\.147|64\.233\.167\.99|64\.233\.167\.104|64\.233\.167\.147|64\.233\.171\.99|64\.233\.171\.104|64\.233\.171\.105|64\.233\.171\.147|64\.233\.179\.99|64\.233\.179\.99|64\.233\.183\.99|64\.233\.183\.104|64\.233\.185\.99|64\.233\.185\.104|64\.233\.187\.99|64\.233\.187\.104|64\.233\.189\.104|66\.102\.7\.104|66\.102\.7\.105|66\.102\.7\.147|66\.102\.9\.104|66\.102\.11\.104|216\.239\.37\.104|216\.239\.37\.105|216\.239\.37\.147|216\.239\.39\.104|216\.239\.53\.104|216\.239\.57\.98|216\.239\.57\.104|216\.239\.57\.105|216\.239\.57\.147|216\.239\.59\.104|216\.239\.59\.105|216\.239\.63\.104|66\.249\.81\.99)\//.test(href) )) 
	 {
	 
		if ((href.match(/^http:\/\/[^\/]+\/$/i) || href.match(/^http:\/\/[^\/]+\/(search|custom|firefox|webhp|unclesam|linux|bsd|mac|microsoft|ig)/i))) 
		{
			AddSEToGoogleMainPage();
			
		}
		
	 }
