<?xml version="1.0" encoding="UTF-8" ?>
<Module>
	<ModulePrefs
		title="gWoWDatabase"
		description="Search Thottbot, Wowhead, Allakhazam, Wowpedia, WoWWiki, Goblin Workshop, WoW Guru, WoW WarCry, WOWDB, WoWDigger, WoWLib, Lootables, AmpWow, Buffed.de, custom Google search, or WoW Armory for World of Warcraft for quests, mobs, spells/abilities, maps, items and more."
		screenshot="http://igoogle.gryphonllc.com/gwow/images/gwowdatabase.png"
		thumbnail="http://igoogle.gryphonllc.com/gwow/images/gwowdatabase_t.png"
		author="Ryan Snook"
		author_email="rsnook+igoogle@gmail.com"
		author_aboutme="I work in real estate investment and development. My most significant hobby is developing and managing primarily gaming web communities."
		author_link="http://www.ryansnook.net"
		author_quote="Fear the Talon"
		author_location="Everett, WA, USA"
		author_photo="http://www.gryphonllc.com/images/ig_ryan.jpg"
		title_url="http://www.google.com/ig/directory?type=authors&amp;url=rsnook%2Bigoogle%40gmail.com"
		directory_title="World of Warcraft Database Search"
		category="funandgames"
		category2="tools"
		height="70">
		<Require feature="dynamic-height" />
		<Require feature="setprefs" />
		<Require feature="tabs" />
		<Require feature="analytics" />
		<Require feature="minimessage" />
		<Require feature="settitle" />
	</ModulePrefs>

	<UserPref name="target" display_name="Open new window" datatype="bool" default_value="false" />
	<UserPref name="showsubmit" display_name="Show submit button" datatype="bool" default_value="false" />
	<UserPref name="poweredby" display_name="Show powered by link" datatype="bool" default_value="true" />
	<UserPref name="showabout" display_name="Show about tab" datatype="bool" default_value="true" />
	<UserPref name="disablenotice" display_name="Disable notices for web page embedding" datatype="bool" default_value="false" />
	<UserPref name="tabdisplay" display_name="Tab Display" datatype="enum" default_value="iconstext">
		<EnumValue value="text" display_value="Text Only" />
		<EnumValue value="iconstext" display_value="Icons and Text" />
		<EnumValue value="icons" display_value="Icons Only" />
	</UserPref>
	<UserPref name="armorylocale" display_name="Armory Locale" datatype="enum" default_value="us">
		<EnumValue value="us" display_value="US Armory" />
		<EnumValue value="eu" display_value="EU Armory" />
		<EnumValue value="tw" display_value="TW Armory" />
		<EnumValue value="kr" display_value="KR Armory" />
	</UserPref>
	<UserPref name="armorydefault" display_name="Armory Default Tab" datatype="enum" default_value="default">
		<EnumValue value="default" display_value="Default" />
		<EnumValue value="characters" display_value="Characters" />
		<EnumValue value="arenateams" display_value="Arena Teams" />
		<EnumValue value="items" display_value="Items" />
		<EnumValue value="guilds" display_value="Guilds" />
	</UserPref>
	<UserPref name="s_0" display_name="Thottbot Search" datatype="bool" default_value="true" />
	<UserPref name="s_1" display_name="Wowhead Search" datatype="bool" default_value="true" />
	<UserPref name="s_2" display_name="Allakhazam Search" datatype="bool" default_value="false" />
	<UserPref name="s_3" display_name="Wowpedia Search" datatype="bool" default_value="true" />
	<UserPref name="s_4" display_name="WoWWiki Search" datatype="bool" default_value="false" />
	<UserPref name="s_5" display_name="Goblin Workshop Search" datatype="bool" default_value="false" />
	<UserPref name="s_6" display_name="WoW Guru Search" datatype="bool" default_value="false" />
	<UserPref name="s_7" display_name="WoW WarCry Search" datatype="bool" default_value="false" />
	<UserPref name="s_8" display_name="WOWDB Search" datatype="bool" default_value="false" />
	<UserPref name="s_9" display_name="WoWDigger Search" datatype="bool" default_value="false" />
	<UserPref name="s_10" display_name="WoWLib Search" datatype="bool" default_value="false" />
	<UserPref name="s_11" display_name="Lootables Search" datatype="bool" default_value="false" />
	<UserPref name="s_12" display_name="AmpWow Search" datatype="bool" default_value="false" />
	<UserPref name="s_13" display_name="Google Search" datatype="bool" default_value="true" />
	<UserPref name="s_14" display_name="Armory Search" datatype="bool" default_value="true" />
	<UserPref name="s_15" display_name="Buffed.de Search" datatype="bool" default_value="false" />

	<UserPref name="showmsg" datatype="hidden" default_value="1"/>
	<UserPref name="msgversion" datatype="hidden" default_value="0"/>
	<UserPref name="selectedTab" datatype="hidden" />
	<UserPref name="selectedWowDB" datatype="hidden" />

	<Content type="html">
	<![CDATA[
<!-- ALm6fM211NCP5Bc2qbOVJme2Cc9NKGuNvenbKckH2FPiR5WzQzUcWU9ESEaGL08NGiodCmQuMEGWrpOjJL4V4h0ekhROXfRqrhT5ZA3L7kM07zUF8_ptnVk2HGQ7Ci26ZW57XFc48R_8 -->
	<style type="text/css">
		.poweredBy {
			font-size: 10px;
			text-align: right;
            width: 100%;
		}
		.iconTextcontain {
			white-space: nowrap;
		}
		.iconTexticon {
			margin-left: 2px;
		}
		.iconTexttext {
			margin-left: 4px;
            margin-right: 4px;
		}
		.about {
			background: #D9CB9A url('http://www.ig.gmodules.com/gadgets/proxy/refresh=3600&container=ig&gadget=http%3A%2F%2Figoogle.gryphonllc.com%2Fgwow%2Fgwowdatabase.xml/http://igoogle.gryphonllc.com/gwow/images/gwow_about_bg.jpg');
            border: 2px solid #BC7F2C;
            padding: 6px;
            margin: 6px;
            font-size: 12px;
		}
		.abouttooltip {
            width: 200px;
            float: right;
            background: #111111;
            color: #ffffff;
            border: 1px solid #BBBBBB;
            padding: 4px;
            margin: 4px;
            font-size: 10px;
            border-radius:6px;
            -webkit-border-radius:6px;
            -moz-border-radius:6px;
        }
		.abouttooltipicon {
            margin: 2px;
            float: right;
        }
		.abouttooltiptitle {
            font-weight: bold;
            color: #E5CC80;
        }
		.abouttooltipequip {
            color: #1EFF00;
        }
		.aboutpaypal {
            float: right;
        }
		.aboutdivclear {
            clear: both;
            margin-bottom: 4px;
        }
        .searchformtable {
            width: 100%;
            margin-top: 2px;
        }
        .searchforminput {
            width: 100%;
        }
        .searchformsubmit {
            width: 140px;
        }
	</style>
	<div id="wowdb"></div>
	<script type="text/javascript">
		// ########################################################################
		//
		// gWoWDatabase iGoogle Gadget, Copyright © 2008, Ryan Snook (www.gryphonllc.com )
		//
		// If you have fixes, improvements or other additions to make to
		// WoW Database iGoogle Gadget, please contact me at rsnook@gmail.com for collaboration.
		// I appreciate your kind consideration.
		//
		// This work is licensed under the Creative Commons
		// Attribution-Noncommercial-No Derivative Works 3.0 United States License.
		// To view a copy of this license, visit
		// http://creativecommons.org/licenses/by-nc-nd/3.0/us/ or send a letter to
		// Creative Commons, 171 Second Street, Suite 300,
		// San Francisco, California, 94105, USA.
		//
		// ########################### SVN info ###################################
		// $Id: gwowdatabase.xml 4 2009-11-21 03:01:09Z Gryphon $
		// $Rev: 4 $
		// $LastChangedBy: Gryphon $
		// $Date: 2009-11-20 19:01:09 -0800 (Fri, 20 Nov 2009) $

		var wowDbPrefs = new gadgets.Prefs(__MODULE_ID__);
		var onGoogle = true;
		var darkColor = false;

		var parentUrl = gadgets.util.getUrlParameters().parent;
        if (!parentUrl || (parentUrl.search(/google/i) !== -1))
		{
			onGoogle = false;
		}

		if(darkColor)
		{
			document.write('<style type="text/css">' +
				'body { margin: 0px 4px 0px 4px; background-color: #000000; color: #ffffff; }' +
				'a:link { color: red; }' +
				'a:hover { color: white; }' +
				'a:visited { color: red; }' +
			'</style>');
		}

		var wowDbMessage = '2010-09-30 » There is currently an issue with displaying the icons. Thank you for using this Gadget, tell your friends. If you really love it, feel free to make a donation! :) -<a href="http://ryan.snook.cc" target="_blank">Ryan</a>'

		if (wowDbPrefs.getString("tabdisplay") == 'iconstext')
		{
			document.write('<style type="text/css">.tablib_unselected {font-size: 8px;}</style>');
		}

		var armorylocale = wowDbPrefs.getString("armorylocale");

		var wowDatabase = [
			['Thottbot', 'Thottbot', 'http://thottbot.com/', 'http://thottbot.com/', 's', '', 'thott'],
			['Wowhead', 'Wowhead', 'http://www.wowhead.com/', 'http://www.wowhead.com/', 'search', '', 'whead'],
			['Allakhazam', 'Allakhazam', 'http://wow.allakhazam.com/', 'http://wow.allakhazam.com/search.html', 'q', '', 'alla'],
			['Wowpedia', 'Wowpedia', 'http://www.wowpedia.org/', 'http://www.wowpedia.org/Special:Search', 'search', '', 'wowpedia'],
			['WoWWiki', 'WoWWiki', 'http://www.wowwiki.com/', 'http://www.wowwiki.com/Special:Search', 'search', '', 'wowwiki'],
			['Goblin', 'Goblin Workshop', 'http://www.goblinworkshop.com/', 'http://www.goblinworkshop.com/search2.html', 's', '', 'goblin'],
			['Guru', 'WoW Guru', 'http://www.wowguru.com', 'http://www.wowguru.com/db/search.php', 'q', '', 'wguru'],
			['WarCry', 'WoW WarCry', 'http://wow.warcry.com', 'http://wow.warcry.com/db/search.php', 'sh', '', 'warcry'],
			['WOWDB', 'WOWDB', 'http://www.wowdb.com', 'http://www.wowdb.com/search.aspx?search_text', 'search_text', '', 'wowdb'],
			['Digger', 'WoWDigger', 'http://wowdigger.incgamers.com/', 'http://wowdigger.incgamers.com/', 'keywords', '<input type="hidden" name="c" value="search" />', 'wowdigger'],
			['WoWLib', 'WoWLib', 'http://www.wowlib.com/', 'http://www.wowlib.com/', 'id', '<input type="hidden" name="type" value="search" />', 'wowlib'],
			['Lootables', 'Lootables', 'http://www.lootables.com/', 'http://www.lootables.com/', 'q_name', '', 'lootables'],
			['AmpWow', 'AmpWow', 'http://wow.gameamp.com/', 'http://wow.gameamp.com/wow/viewSearchResults', 'search', '', 'ampwow'],
			['Google', 'Google', 'http://www.google.com/cse?cx=017240127583672351158:yxfzwbk7hp0', 'http://www.google.com/', 'q', '<input type="hidden" name="cx" value="017240127583672351158:yxfzwbk7hp0" /><input type="hidden" name="cof" value="FORID:1" />', 'google'],
			['Armory', 'WoW Armory', 'http://' + armorylocale + '.wowarmory.com/', 'http://' + armorylocale + '.wowarmory.com/search.xml', 'searchQuery', '<input type="hidden" name="searchType" value="all" />', 'armory'],
			['Buffed', 'Buffed', 'http://wow.buffed.de/', 'http://wow.buffed.de/', 'f', '', 'buffed']
		];

		// Show Message
		var mini__MODULE_ID__ = new gadgets.MiniMessage(__MODULE_ID__);
		var MSG_VERSION__MODULE_ID__ = wowDbMessage.length;

		if (wowDbPrefs.getInt("msgversion") != MSG_VERSION__MODULE_ID__)
		{
			wowDbPrefs.set("showmsg", 1, "msgversion", MSG_VERSION__MODULE_ID__);
		}

		if (wowDbPrefs.getInt("showmsg") && wowDbPrefs.getInt("disablenotice") == 0 && onGoogle )
		{
			var html = [wowDbMessage].join("");
			mini__MODULE_ID__.createDismissibleMessage(html, ondismissMsg__MODULE_ID__());
		}

		function ondismissMsg__MODULE_ID__()
		{
			return function()
			{
				wowDbPrefs.set("showmsg", 0);
				gadgets.window.adjustHeight();
			}
		}
		// End Show Message

		function init__MODULE_ID__() {
			var tabs = new gadgets.TabSet(__MODULE_ID__);
			var numtabs = 0;

			for (var i = 0; i <= wowDatabase.length; i++)
			{
				if (wowDbPrefs.getInt("s_" + i))
				{
					var tabTitle = wowDatabase[i][0];

					if (wowDbPrefs.getString("tabdisplay") == 'iconstext')
					{
						var iconimg = gadgets.io.getProxyUrl('http://igoogle.gryphonllc.com/gwow/images/gwow_icon_' + wowDatabase[i][6] + '.gif');
						tabTitle = '<div class="iconTextcontain"><span class="iconTexticon"><img src="' + gadgets.io.getProxyUrl('http://igoogle.gryphonllc.com/gwow/images/gwow_icon_' + wowDatabase[i][6] + '.gif') + '" width="16" height="16" align="absmiddle" /></span><span class="iconTexttext">' + wowDatabase[i][0] + '</span><div>';
					}

					if (wowDbPrefs.getString("tabdisplay") == 'icons')
					{
						var iconimg = gadgets.io.getProxyUrl('http://igoogle.gryphonllc.com/gwow/images/gwow_icon_' + wowDatabase[i][6] + '.gif');
						tabTitle = '<img src="' + gadgets.io.getProxyUrl('http://igoogle.gryphonllc.com/gwow/images/gwow_icon_' + wowDatabase[i][6] + '.gif') + '" width="16" height="16" align="absmiddle" />';
					}

					tabs.addTab(tabTitle, {
						callback: generateCallback__MODULE_ID__(i),
						tooltip: wowDatabase[i][1]
					});

					numtabs++;
				}

			}

			if (wowDbPrefs.getBool("showabout") || !onGoogle)
			{
				tabs.addTab('&copy;', {
				 	contentContainer: document.getElementById("wowdbabout"),
				 	callback: aboutgenerateCallback__MODULE_ID__(i++),
					tooltip: 'About'
				});

				numtabs++;
			}

			if (numtabs == 0)
			{
				 callBack__MODULE_ID__(0, wowDbPrefs.getInt("selectedWowDB"));
			}
            gadgets.window.adjustHeight();
		}

		function aboutgenerateCallback__MODULE_ID__(tabIndex)
		{
			return function(tabId)
			{
				aboutCallback__MODULE_ID__(tabId, tabIndex);
			}
		}

		function aboutCallback__MODULE_ID__(tabId, tabIndex)
		{
			var curdate = new Date();
			var year = curdate.getYear();

			var html = '<div class="about"><div class="abouttooltip"><div class="abouttooltipicon"><img src="' + gadgets.io.getProxyUrl('http://igoogle.gryphonllc.com/gwow/images/gwow_about_gwow.png') + '" width="32" /></div><span class="abouttooltiptitle">gWoWDatabase iGoogle Gadget</span><br />&copy; 2006 - ' + year + ', Ryan Snook.<br />All Rights Reserved.<br />Requires Level 1<br /><span class="abouttooltipequip">Equip: Increases your effective item search ability by 1000.</span></div><div class="aboutdivclear"></div>Thank you for using this World of Warcraft search gadget for iGoogle, if you like it, please pass it on to your friends :)<br /><br />Suggestions, improvements, comments welcome at <a href="mailto:rsnook+igoogle@gmail.com">rsnook@gmail.com</a>.<br /><br />Check out my other World of Warcraft tools at <a href="http://www.gryphonllc.com/p/php/" target="_blank">GryphonLLC.com</a>.<br /><br /><div class="aboutpaypal"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal%40gryphonllc%2ecom&item_name=gWoWDatabase%20Donation&no_shipping=1&return=http%3a%2f%2fwww%2egryphonllc%2ecom%2f%3fpage%3dthankyou&no_note=1&tax=0&currency_code=USD" target="_blank"><img src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" border="0" alt="Make payments with PayPal - it is fast, free and secure!"></a></div>--<br />Ryan Snook</div><div class="aboutdivclear"></div></div>';

			document.getElementById(tabId).innerHTML = html;

			wowDbPrefs.set("selectedWowDB", tabIndex);
			gadgets.window.setTitle('About', __MODULE_ID__);
			gadgets.window.adjustHeight();
		}

		function generateCallback__MODULE_ID__(tabIndex)
		{
			return function(tabId)
			{
				callBack__MODULE_ID__(tabId, tabIndex);
			}
		}

		function callBack__MODULE_ID__(tabId, tabIndex) {

			var fullName = wowDatabase[tabIndex][1];
			var homeURL = wowDatabase[tabIndex][2];
			var searchURL = wowDatabase[tabIndex][3];
			var searchVar = wowDatabase[tabIndex][4];
			var hiddenVar = wowDatabase[tabIndex][5];
			var analyticsId = wowDatabase[tabIndex][6];

			var armoryDefault = wowDbPrefs.getString("armorydefault")

			var armoryTab = "";
			var googleSearchId = "";
			var submitButton = "hidden";
			var targetWindow = "top";
			var poweredBy = "";

			if (analyticsId == 'google')
			{
				googleSearchId = 'searchbox_017240127583672351158:yxfzwbk7hp0';
			}

			if (wowDbPrefs.getBool("showsubmit"))
			{
				submitButton = 'submit';
			}

			if (wowDbPrefs.getBool("target"))
			{
				targetWindow = 'blank';
			}

			if (wowDbPrefs.getBool("poweredby"))
			{
				poweredBy = '<div class="poweredBy">powered by <a href="' + homeURL + '" target="_' + targetWindow + '">' + fullName + '</a></div>';
			}

			if (armoryDefault != 'default' && analyticsId == 'armory')
			{
				armoryTab = '<input type="hidden" name="selectedTab" value="' + armoryDefault + '" />'
			}

			var html =
				'<form method="get" name="wowdb" id="' + googleSearchId + '" action="' + searchURL + '" target="_' + targetWindow + '" onsubmit="_IG_Analytics(\'UA-91882-10\', \'/gWoWDatabase/' + analyticsId + '_submit\')">' +
				hiddenVar +
				armoryTab +
				'<table class="searchformtable" cellpadding="0" cellspacing="0" border="0">' +
				'<tr>' +
					'<td width="100%" align="center">' +
						'<input class="searchforminput" type="text" name="' + searchVar + '" onfocus="this.form.' + searchVar + '.focus();this.form.' + searchVar + '.select();" />' +
						'<br /><input class="searchformsubmit" type="' + submitButton + '" value="' + fullName + '" />' +
				poweredBy +
					'</td>' +
				'</tr>' +
				'</table>' +
				'<input type="hidden" name="ref" value="gWoWDatabase" />' +
				'</form>';

			if (tabId == 0)
			{
				document.getElementById("wowdb").innerHTML = html;
			}
			else
			{
				document.getElementById(tabId).innerHTML = html;
			}

			wowDbPrefs.set("selectedWowDB", tabIndex);
			gadgets.window.setTitle('Search ' + fullName + ' database', __MODULE_ID__);
			gadgets.window.adjustHeight();
		}

		gadgets.util.registerOnLoadHandler(init__MODULE_ID__);
		_IG_Analytics("UA-91882-10", "/gWoWDatabase");
		gadgets.window.adjustHeight();
	</script>
	]]>
	</Content>
</Module>
