// JavaScript Document

var BottomMenuItem = Class.create(
{
	element: null,
	
	dom: {},
	
	menu: null, // BottomMenu object
	
	url: null,
	
	requiresJava: false, 
	
	initialize: function( element, menu )
	{
		this.element = $( element );
		this.menu = menu;
		
		this.initOther();
		this.initEvents();
	},
	
	initOther: function()
	{
		this.url = this.element.href;
		this.requiresJava = this.element.hasClassName( "java" );
	},
	
	initEvents: function()
	{
		this.element.observe( "click", this.handleClick.bind( this ) );
	},
	
	handleClick: function( e )
	{
		Event.stop( e );
		
		if( !this.requiresJava )
		{
			this.menu.deactivate();
			window.location = this.url;
			return;
		}
		
		if( confirm( "This application requires Java version 6 or better\n\nhttp://java.sun.com\nDo you wish to continue?" ) )
		{
			this.menu.deactivate();
			window.location = this.url;
			
		} else {
			
			alert( "The application was not launched" );
		}
	}
});
