<?xml version="1.0" encoding="UTF-8" ?>
<Module>
	<ModulePrefs
		title="gWoWAddon"
		description="Search Google, WoWInterface, Curse, WoWUI, Cosmos for your favorite World of Warcraft addons."
		screenshot="http://igoogle.gryphonllc.com/gwow/images/gwowaddon.png"
		thumbnail="http://igoogle.gryphonllc.com/gwow/images/gwowaddon_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 Addon Search"
		category="funandgames"
		category2="tools"
		height="100">
		<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="true" />
	<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="s_0" display_name="Google Search" datatype="bool" default_value="true" />
	<UserPref name="s_1" display_name="WoWInterface Search" datatype="bool" default_value="true" />
	<UserPref name="s_2" display_name="Curse Search" datatype="bool" default_value="true" />
	<UserPref name="s_3" display_name="WoWUI Search" datatype="bool" default_value="false" />
	<UserPref name="s_4" display_name="Cosmos Search" datatype="bool" default_value="true" />

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

	<Content type="html">
	<![CDATA[
<!-- ALm6fM2O-GFsZ8PWLRbLjB9mjYHys4cPOc5s3WjXwpMawJT6r1ouyFY7jj08i9OE85hblMYYD_300THPug7cThYUIdQUpkq8RKSmRrYLUIAN5Xx3tStslxGkcy1pD8fu9MjrZ8w0fKpP -->
	<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="gwowaddon"></div>
	<script type="text/javascript">
		// ########################################################################
		//
		// gWoWAddon 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: gwowaddon.xml 4 2009-11-21 03:01:17Z Gryphon $
		// $Rev: 4 $
		// $LastChangedBy: Gryphon $
		// $Date: 2009-11-20 19:01:17 -0800 (Fri, 20 Nov 2009) $

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

		var parentUrl = _args()['parent'];
        if (!parentUrl || (parentUrl.search('http://www.google') !== 0))
		{
			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 gWoWAddonMessage = '2010-09-30 » There is currently an issue with displaying the icons. You can <a href="http://www.google.com/ig/directory?url=http://igoogle.gryphonllc.com/gwow/gwowaddon.xml&amp;synd=open" target="_blank">embed this gadget on web pages</a>. 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 (gWoWAddonPrefs.getString("tabdisplay") == 'iconstext')
		{
			document.write('<style type="text/css">.tablib_unselected {font-size: 8px;}</style>');
		}

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

		var wowDatabase = [
			['Google', 'Google', 'http://www.google.com/cse?cx=017240127583672351158:ovf7svsdhz4', 'http://www.google.com/cse', 'q', '<input type="hidden" name="cx" value="017240127583672351158:ovf7svsdhz4" />', 'google'],
			['WoWInterface', 'WoWInterface', 'http://www.wowinterface.com/', 'http://www.wowinterface.com/downloads/search.php', 'search', '', 'wowinterface'],
			['Curse', 'Curse', 'http://wow.curse.com/', 'http://wow.curse.com/downloads/wow-addons/SearchResults.aspx', 'q', '', 'curse'],
			['WoWUI', 'WoWUI', 'http://wowui.incgamers.com/', 'http://wowui.incgamers.com/', 's', '<input type="hidden" name="p" value="browse" />', 'wowui'],
			['Cosmos', 'Cosmos', 'http://www.cosmosui.org/', 'http://www.cosmosui.org/addons.php', 'q', '', 'cosmos'],
		];

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

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

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

		function ondismissMsg__MODULE_ID__()
		{
			return function()
			{
				gWoWAddonPrefs.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 (gWoWAddonPrefs.getInt("s_" + i))
				{
					var tabTitle = wowDatabase[i][0];

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

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

					numtabs++;
				}

			}

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

				numtabs++;
			}

			if (numtabs == 0)
			{
				 callBack__MODULE_ID__(0, gWoWAddonPrefs.getInt("selectedgwowaddon"));
			}
            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">gWoWAddon 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=gWoWAddon%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;

			gWoWAddonPrefs.set("selectedgwowaddon", 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 = gWoWAddonPrefs.getString("armorydefault")

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

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

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

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

			if (gWoWAddonPrefs.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="gwowaddon" id="' + googleSearchId + '" action="' + searchURL + '" target="_' + targetWindow + '" onsubmit="_IG_Analytics(\'UA-91882-10\', \'/gWoWAddon/' + 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="gWoWAddon" />' +
				'<form>';

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

			gWoWAddonPrefs.set("selectedgwowaddon", tabIndex);
			gadgets.window.setTitle('Search ' + fullName + ' addons', __MODULE_ID__);
			gadgets.window.adjustHeight();
		}

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