

function category( id, name, help ) {
	this.id=id;
	this.name=name;
	this.help=help;
}
var gCategoryList = [
	new category( "pp", "Premier Providers", "The popular, general-purpose Web search engines." ),
	new category( "wp", "People and Businesses", "Names, e-mail, phone numbers, mailing addresses for people and businesses." ),
	new category( "ft", "Full-Web", "Search every word on every page of the Web." ),
	new category( "gu", "Directories and Guides", "Categorized and reviewed indexes to Web sites." ),
	new category( "ng", "Newsgroups", "Search and participate in Usenet newsgroups on the Web." ),
//	new category( "sh", "Shopping", "Merchants and Internet shopping guides." ),
	new category( "sp", "Specialty", "Specialized services and reference information on the Web." ),
	new category( "usp", "User Specified", "If you know of a search provider that isn't in this list, but you'd like to use it in the Search Bar, enter the URL here.<BR><BR><B>WARNING:</B> URLs that are not designed for the search bar will not work properly." )
];


function engine( cat, id, name, url, dom, help ) {
	this.cat=cat;
	this.id=id;
	this.name=name;
	this.url=url;
	this.dom=dom;
	this.help=help;
	this.count = 0;
}
var gEngineList = [];
var gNumEngines = 0;
function AddEngine( cat, id, name, url, dom, help ) {
	gEngineList[id] = new engine( cat, id, name, url, dom, help );
	gNumEngines++;
}

// BEGIN SMCADD: new provider codes for top-tier providers (to match HMC codes)
AddEngine("pp", "sALTA", "AltaVista", "http://jump.altavista.com/start/ie4", "",
	   "Use AltaVista to search the Web or Usenet. Features like language-specific results make AltaVista your searching choice.");
AddEngine("pp", "sGOTO", "GoTo.com", "http://www.goto.com/d/search/p/iepanel/4/?Partner=ie4panel", "", 
	   "Welcome to GoTo.com-- the fastest, easiest, and friendliest way to find the most relevant information on any topic. GoTo.com is \"Search made simple\"(TM)");
AddEngine("pp", "sINFO", "GO.com", "http://www.infoseek.com/Home?pg=home.html&sv=M6&win=_search", "www.infoseek.com",
	   "World Wide Web searching at its finest. Just enter your topic of interest. Advanced search features allow you to search for a specific site, URL, title, or links to a page.");
AddEngine("pp", "sLYCO", "Lycos", "http://www.lycos.com/msie4.html", "",
	   "Let Lycos be your Personal Guide to the Internet. Surf our Web Guides by category, vote for your favorite sites, and join the Lycos community.");
AddEngine("pp", "sMSN", "MSN Search", "http://search.msn.com/spbasic.htm", "", 
	   "Start your search for web sites, people, or businesses with MSN Web Search--your best source for quick, relevant search results.");
AddEngine("ft", "sEXCI", "Excite", "http://www.excite.com/microsoft/ie40/", "",
	   "Excite’s patented search technology gives you access to more than 50 million Web pages, 140,000 pre-selected Web site listings, and thousands of Usenet postings.");
AddEngine("wp", "sBIGF", "Bigfoot", "http://search.bigfoot.com/RUN?locale=SearchBar&Ref=MS_SearchBar", "",
	   "Bigfoot, Tools for the Net! The most complete & powerful set of online communication services. Your Internet is served!");
//AddEngine("ng", "sDEJA", "Deja.com", "http://www.deja.com/forms/mssb.shtml", "",
//	   "Deja.com is the premiere Web site for participating in and searching discussion forums, including Usenet newsgroups.");
AddEngine("sp", "sENCA", "Encarta", "http://ie.search.msn.com/srchpane/vendor/senca/senca.htm", "",
		"Start your Internet search with Microsoft® Encarta® Concise Encyclopedia, a free, condensed version of the world's best-selling electronic encyclopedia.");
AddEngine("sp", "sEURO", "Euroseek", "http://www.euroseek.net/page?ifl=uk&page=msie", "",
		"EuroSeek, The *first* true multilingual search engine in the world! With 40 European languages supported. Come and give us a try!");
AddEngine("wp", "sINSP", "InfoSpace", "http://www.infospace.com/info.iebar/", "",
	   "InfoSpace, the Ultimate Directory, is the best place to find people, businesses, places and things on the Internet.");
AddEngine("gu", "sLOOK", "Look Smart", "http://www.looksmart.com/ie/looksmart.html", "",
	   "Search LookSmart's database of over 250,000 selected and reviewed quality sites or the entire Web via AltaVista.");
AddEngine("gu", "sNETG", "NetGuide", "http://www.netguide.com/mssearchbox", "",
	   "New sites, best sites, live events, Internet tips and tricks--we provide everything you need to know to get the most out of your online experience.");
AddEngine("gu", "sYAHO", "Yahoo", "http://www.yahoo.com/search/ie.html", "", 
	   "Yahoo! Inc. offers a globally-branded Internet navigational service to information and entertainment on the Web.");
AddEngine("wp", "sWRLD", "WorldPages", "http://www.worldpages.com/micro_side/", "",
	   "WorldPages' easy to use search tools help you find businesses, people, email addresses and websites worldwide!");
AddEngine("sp", "sYACK", "Yack", "http://www.yack.com/content/site/ie_searchpane.html", "", 
	   "Yack! Is the ultimate guide to Internet chat. Easily find chat rooms on your favorite topics.");

AddEngine("usp", "USER", "User Specified", "","","");

// New additions since 12/15
AddEngine("sp", "sCORB", "Corbis", "http://shopping.corbis.com/referrals/wrk_jump.asp?linkid=5737&s=", "",
	   "Corbis-The Place for Pictures on the Internet brings you more than 600,000 digital pictures for use in your personal Web pages, newsletters, school reports and presentations or create your own desktop wallpaper!");
//AddEngine("sh", "sBOTD", "Bottom Dollar", "http://ie.search.msn.com/srchpane/vendor/sbotd/sbotd.htm", "",
//	   "Shop the Web more efficiently by quickly and easily comparing price and availability on an extensive selection of products from the top Internet merchants.");

// New additions since 1/29
AddEngine("sp", "sMAPQ", "MapQuest", "http://ie.search.msn.com/srchpane/vendor/sMAPQ/sMAPQ.htm", "", 
        "Use MapQuest to see maps, get driving directions, use the online travel guide, buy maps, and more!");
AddEngine("ft", "sNORT", "Northern Light", "http://www.northernlight.com/ie_search.html", "", 
        "Search the largest database of Web pages on the planet with Northern Light's research engine--PC Magazine's 1998 Editor's Choice.");
//AddEngine("sh", "sMYSI", "mySimon", "http://ie.search.msn.com/srchpane/vendor/sMYSI/sMYSI.htm", "", 
//        "Welcome to mySimon -- the smartest way to shop on the Internet.  You can quickly and easily find and compare prices and products from the most merchants on the Web.");
AddEngine("sp", "sLEXT", "Roget's Thesaurus", "http://www.thesaurus.com/msie/", "", 
        "Express yourself! Find new English words and phrases for your ideas in this popular reference.");
AddEngine("sp", "sLEXD", "Dictionary.com", "http://www.dictionary.com/msie/", "", 
        "Not just a dictionary! Look up English words, the latest computer and Internet terms, Bible names and terminology, U.S. cities and Zip Codes, and information on the countries of the world.");

// New additions since 5/6
AddEngine("gu", "sMINE", "About.com", "http://search.about.com/library/search_ie4.htm", "", 
        "About.com is the leading network where visitors can find over 700 highly targeted topic areas -- each one managed by an professional About.com Guide.");


// map old provider codes to new ones (as defined in searchProv.txt)
var aOldToNewMap = [];
aOldToNewMap[ "AV" ] = "sALTA" ;
aOldToNewMap[ "AOL"] = "sAOLN" ;
aOldToNewMap[ "EX" ] = "sEXCI" ;
aOldToNewMap[ "LY" ] = "sLYCO" ;
aOldToNewMap[ "IS" ] = "sINFO" ;
aOldToNewMap[ "YA" ] = "sYAHO" ;

function mapOldToNew ( oldCode )
{
	if ( aOldToNewMap[ oldCode ] != null )
		return aOldToNewMap[ oldCode ];
	else
		return oldCode ;
	
}	// mapOldToNew ()


// map old provider codes to new ones (as defined in searchProv.txt)
var aNewToOldMap = [];
aNewToOldMap[ "sALTA" ] = "AV" ;
aNewToOldMap[ "sAOLN" ] = "AOL";
aNewToOldMap[ "sEXCI" ] = "EX" ;
aNewToOldMap[ "sLYCO" ] = "LY" ;
aNewToOldMap[ "sINFO" ] = "IS" ;
aNewToOldMap[ "sYAHO" ] = "YA" ;

function mapNewToOld ( newCode )
{
	if ( aNewToOldMap[ newCode ] != null )
		return aNewToOldMap[ newCode ];
	else
		return newCode ;
	
}	// mapNewToOld ()


// END SMCADD:


gNumEngines--;

function SetUserSP( url )
{
	gEngineList["USER"].url = url;
}


function SetProp( prop, value )
{
	var str = document.cookie;
	var offset = str.indexOf( "IE4Search=" );
	var endoff = str.indexOf( ";", offset );
	if (endoff == -1) endoff = str.length;

	if (value == "") value = "x";

	if (offset >= 0) {
		str = str.substring( offset+10, endoff );

		if (str.substring(str.length-1, str.length) == "&")
		{
			str = str.substring(0, str.length-1);
		}

		offset = str.indexOf( prop + "=" );

		if (offset >= 0) {
			endoff = str.indexOf( "&", offset + prop.length + 1 );
			if (endoff == -1) endoff = str.length;
			str = str.substring( 0, offset - 1) + str.substring( endoff, str.length );

		}
		if ( str.charAt(0) != "&" && str.length != 0 )
			str = "&" + str ;

	} else {
		str = "";
	}

	document.cookie = "IE4Search=" + prop + "=" + escape(value) + str + ";path=/;expires=Friday, 21-Nov-08 01:23:45 GMT";
}

function GetProp( prop )
{
	var str = document.cookie;
	var offset = str.indexOf( "IE4Search=" );
	var endoff = str.indexOf( ";", offset );
	if (endoff == -1) endoff = str.length;

	if (offset >= 0) {
		offset = str.indexOf( prop + "=", offset );
		if (offset >= 0) {
			offset += prop.length + 1;

			var iNextAmp = str.indexOf("&", offset);
	
			if ( (iNextAmp > endoff) || (iNextAmp == -1) )
				endoff = endoff
			else 
				endoff = iNextAmp

			//if (endoff != -1) return unescape(str.substring( offset, endoff ));

			var result = unescape(str.substring( offset, endoff ));
			if (result == "x" || result == "xYz") result = "";
			return result;
		}
	}
	return "";
}
