svg_g2d.addScript( "function callback" + Math.abs( script.hashCode( ) ) + "(evt,source)" + "{" + script + "}" );
svg_g2d.addScript( "function callback" + Math.abs( script.hashCode( ) ) + "(evt,source,categoryData,valueData,valueSeriesName)" + "{" + script + "}" );
	private void addEventHandling( Element elm, StructureSource src,			Trigger[] triggers )	{		if ( elm != null )		{			//Need to check if we have a url redirect trigger.   We handle the interaction differently			boolean redirect = false;			for ( int x = 0; x < triggers.length; x++ )			{				Trigger tg = triggers[x];				if ( tg.getAction( ).getType( ).getValue( ) == ActionType.URL_REDIRECT){					redirect = true;					break;				}			}			if (redirect){				Element aLink = svg_g2d.createElement( "a" ); //$NON-NLS-1$				Element group = svg_g2d.createElement( "g" ); //$NON-NLS-1$				group.appendChild( elm );				// Create empty href				aLink.setAttribute( "xlink:href", "" ); //$NON-NLS-1$ //$NON-NLS-2$				aLink.appendChild( group );				elm = group;				hotspotLayer.appendChild( aLink );			}			else				hotspotLayer.appendChild( elm );						for ( int x = 0; x < triggers.length; x++ )			{				Trigger tg = triggers[x];				String scriptEvent = getJsScriptEvent( tg.getCondition( )						.getValue( ) );				if ( scriptEvent != null )				{					switch ( tg.getAction( ).getType( ).getValue( ) )					{						case ActionType.SHOW_TOOLTIP :							String tooltipText = ( (TooltipValue) tg.getAction( )									.getValue( ) ).getText( );							// make sure the tooltip text is not empty							if ( ( tooltipText != null )									&& ( tooltipText.trim( ).length( ) > 0 ) )							{								Element title = svg_g2d.dom.createElement( "title" ); //$NON-NLS-1$								title.appendChild( svg_g2d.dom.createTextNode( tooltipText ) );								elm.appendChild( title );								//on mouse over is actually two events to show the tooltip								if (scriptEvent.equals("onmouseover")){//$NON-NLS-1$									elm.setAttribute( "onmouseout", "TM.remove()" ); //$NON-NLS-1$ //$NON-NLS-2$									elm.setAttribute( "onmousemove", "TM.show(evt)" ); //$NON-NLS-1$ //$NON-NLS-2$								}								else									elm.setAttribute( scriptEvent, "TM.toggleToolTip(evt)" ); //$NON-NLS-1$ 							}							break;						case ActionType.URL_REDIRECT :							URLValue urlValue = ( (URLValue) tg.getAction( )									.getValue( ) );							// See if this is an internal anchor link														if ( urlValue.getBaseUrl( ).startsWith( "#" ) ) { //$NON-NLS-1$								elm.setAttribute( scriptEvent, "top.document.location.hash='" + urlValue.getBaseUrl( ) + "';" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$								elm.setAttribute( "style", "cursor:pointer" ); //$NON-NLS-1$ //$NON-NLS-2$							}							else							{								String target = urlValue.getTarget( );								if (target == null)									target="null"; //$NON-NLS-1$								elm.setAttribute( scriptEvent, "redirect('"+target+"','"+urlValue.getBaseUrl( )+"')" ); //$NON-NLS-1$															}							break;						case ActionType.TOGGLE_VISIBILITY :						case ActionType.TOGGLE_DATA_POINT_VISIBILITY:						case ActionType.HIGHLIGHT:							addJSCodeOnElement( src, tg, elm, scriptEvent, tg.getAction( ).getType( ).getValue( ));							break;												case ActionType.INVOKE_SCRIPT :							// lets see if we need to add accessibility							if ( tg.getCondition( )									.equals( TriggerCondition.ACCESSIBILITY_LITERAL ) )							{								AccessibilityValue accessValue = ( (AccessibilityValue) tg.getAction( )										.getValue( ) );								if ( accessValue.getText( ) != null )								{									Element title = svg_g2d.createElement( "title" ); //$NON-NLS-1$									title.appendChild( svg_g2d.dom.createTextNode( accessValue.getText( ) ) );									elm.appendChild( title );								}								if ( accessValue.getAccessibility( ) != null )								{									Element description = svg_g2d.createElement( "desc" ); //$NON-NLS-1$									description.appendChild( svg_g2d.dom.createTextNode( accessValue.getAccessibility( ) ) );									elm.appendChild( description );								}							}							else							{								// TODO add base, value, series name in callback								String script = ( (ScriptValue) tg.getAction( )										.getValue( ) ).getScript( );								String callbackFunction = "callback" + Math.abs( script.hashCode( ) ) + "(evt," + src.getSource( ).hashCode( ) + ");"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$								elm.setAttribute( scriptEvent, callbackFunction );								setCursor( elm );								if ( !( scripts.contains( script ) ) )								{									svg_g2d.addScript( "function callback" + Math.abs( script.hashCode( ) ) + "(evt,source)" + "{" + script + "}" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$									scripts.add( script );								}							}							break;					}				} 			}		}	}