function show(divid) {
		
	document.getElementById(divid).style.display = 'block';
}
		
function hide(divid) {

	document.getElementById(divid).style.display = 'none';	
}


function checkPlugin(path, l_plugin, l_plugin_hint, l_plugin_add, l_plugin)
{
	if (BrowserDetect.browser == "Firefox")
	{
		var pluginXML = 'addPlugin()';
		var pluginImage = 'ffplugin.png';
	}
	else if (BrowserDetect.browser == "Explorer" && BrowserDetect.version == 7)
	{
		var pluginXML = "addPluginIE()";
		var pluginImage = 'ieplugin.png';
	}

	if (pluginXML) {
	
	document.writeln('<div title="'+l_plugin_hint+'" id="plugin" style="display:block" onclick="'+pluginXML+'">');
	document.write('<div class="text">'+l_plugin_add+' '+BrowserDetect.browser+' '+l_plugin+'!</div>');
	document.writeln('<a href="#"> <img alt="'+l_plugin+'" src="'+ path +'images/'+pluginImage+'"> </a>');
	document.write('</div>');
	}
	
}

function addPlugin()
{
	hide('plugin');
	window.external.AddSearchProvider("http://www.p2pfinder.com/p2pfinder.xml");

} // addPlugin

function addPluginIE()
{
var strName = "p2pFinder";
var strURI = "http://www.p2pfinder.com/search?q=TEST";

strName = strName.replace (/^\s+|\s+$/g,'');
strURI = strURI.replace (/^\s+|\s+$/g,'');
var strEncoding = "UTF-8";

if (strURI.length<1) { alert ("Please enter the URL of the search results page."); document.getElementById("sURI").focus(); return false;}
if (strURI.indexOf("TEST")<0) { alert ("The search results URL must contain the word TEST.  Please check the URL.\nIt's possible that this tool cannot be used to build a query for that search engine."); document.getElementById("sURI").focus(); return false;}
if (strName.length<1) { alert ("Please enter a NAME for the new search provider"); document.getElementById("sName").focus(); return false;}


var strQuery = "Encoding="+ encodeURIComponent(strEncoding) + "&Name=" + encodeURIComponent(strName) + "&URI="  + encodeURIComponent(strURI);

var strAddURI = "http://www.microsoft.com/windows/ie/searchguide/spbuilder.mspx?" + strQuery;
//alert(strAddURI);

hide('plugin');

try{

                window.external.AddSearchProvider(strAddURI);

}

catch(eX){

                if (70 == (eX.number & 0xFFFF)){

                                alert("For security reasons, you must use the mouse\n(or the Enter key) to click the Install button.");

                }

                else

                {

                                alert("Unable to add search provider. The Create Your\nOwn tool requires Internet Explorer 7.   [" + (eX.number & 0xFFFF) + "]");

                }

}

return false;

} // addPluginIE
