////////////////////////////////////////////////////////////////////////////////
// Dropdown menu for websites                                                 //
// Copyright © 2005 InleadMedia ApS                                           //
//                                                                            //
// This program is free software; you can redistribute it and/or              //
// modify it under the terms of the GNU General Public License                //
// as published by the Free Software Foundation; either version 2             //
// of the License, or (at your option) any later version.                     //
//                                                                            //
// This program is distributed in the hope that it will be useful,            //
// but WITHOUT ANY WARRANTY; without even the implied warranty of             //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              //
// GNU General Public License for more details.                               //
//                                                                            //
// You should have received a copy of the GNU General Public License          //
// along with this program; if not, write to the Free Software                //
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.//
////////////////////////////////////////////////////////////////////////////////
/**
 * JavaScript for the dropdown menu.
 *
 * This file is include on the page through the menu/dropdown.tpl file.
 *
 * @author Karto <karto@karto.net>
 * @version $Id$
 * @copyright Copyright © 2005 InleadMedia ApS
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @package Menu
 * @subpackage Dropdown
 */
/**
 * Internet Explore workaround function
 * 
 * IE/Win only allows the :hover pseudo-class to be applied to a link — 
 * so the li:hover that makes the sub-menus appear means nothing to IE.
 * A tiny jot of JavaScript is required to kick IE back into action:
 * 
 * @package Common
 * @subpackage Base
 */
try
{
	if (-1 != window.navigator.userAgent.indexOf('MSIE') && -1 != window.navigator.userAgent.indexOf('Windows'))
	{
		window.attachEvent('onload', function ()
		{
			try
			{
				var nodeList = document.getElementsByTagName('LI');
				for(var i = 0; i < nodeList.length; ++i)
				{
					if (-1 == nodeList[i].className.indexOf('dropdownNode')) continue;
					if (0 == nodeList[i].getElementsByTagName('UL').length) continue;
					
					// Add events
					with (nodeList[i])
					{
						// Action when mouse moves onto from the node
						onmouseover = function () { this.className += " over"; };
						// Action when mouse moves away from the node
						onmouseout = function () { this.className = this.className.replace(" over", ""); };
					}
					
				}
			}
			catch (e)
			{
				alert('Unable initialize dropdown menu.');
			}
		});
	}
}
catch (e)
{
	alert('Unable add dropdown menu initializer.');
}

// DEBUG
if (0)
{
	alert('navigator: '+window.navigator+'\n'+
			'appCodeName: '+window.navigator.appCodeName+'\n'+
			'appName: '+window.navigator.appName+'\n'+
			'appVersion: '+window.navigator.appVersion+'\n'+
			'cookieEnabled: '+window.navigator.cookieEnabled+'\n'+
			'language: '+window.navigator.language+'\n'+
			'mimeTypes: '+window.navigator.mimeTypes+'\n'+
			'oscpu: '+window.navigator.oscpu+'\n'+
			'platform: '+window.navigator.platform+'\n'+
			'plugins: '+window.navigator.plugins+'\n'+
			'product: '+window.navigator.product+'\n'+
			'productSub: '+window.navigator.productSub+'\n'+
			'userAgent: '+window.navigator.userAgent+'\n'+
			'vendor: '+window.navigator.vendor+'\n'+
			'vendorSub: '+window.navigator.vendorSub+'\n');
}