' Last modified Dec 6, 2004

sub EONControl_OnEvent(e,v)
	'This subroutine receives events from EON and will send the events to HTML elements 
	'which will be picked up by javascript and sent to the javascript function that 
	'handles EONs Outevents. That function is called EONEmbed_OnEvent(e,v)
	if IsArray(v) then
		j=Ubound(v)
		document.eonhiddenfields.EONOutEventType.value = j
		document.eonhiddenfields.EONOutEventName.value = e
		document.eonhiddenfields.EONOutEventV1.value = v(0)
		if j >=1 then 
			document.eonhiddenfields.EONOutEventV2.value = v(1)
			if j>=2 then
				document.eonhiddenfields.EONOutEventV3.value = v(2)
				if j>=3 then
					document.eonhiddenfields.EONOutEventV4.value = v(3)
				end if
			end if
		end if				
	else
		document.eonhiddenfields.EONOutEventType.value = "0"
		document.eonhiddenfields.EONOutEventName.value = e
		document.eonhiddenfields.EONOutEventV1.value = v
	end if
	document.eonhiddenfields.EONOutEventName.Click()
end sub


sub EONInEventName_OnClick()
	' Javascript cannot send events to EON that have arrays as values. 
	' Therefore javascript sent them to HTML Elements and now this subroutine
	' gathers the values and sends them to EON. For simplicity all EON events
	' of every EON datatype are sent via this subroutine when IE is used.
	dim t, e, v1
	t = document.eonhiddenfields.EONInEventType.value
	e = document.eonhiddenfields.EONInEventName.value
	v1 = document.eonhiddenfields.EONInEventV1.value
	simpletypes = "SFBOOL, SFFLOAT, SFIMAGE, SFINT32, SFNODE, SFSTRING, SFTIME"
	if InStr(simpletypes, t) > 0 then
		if t="SFBOOL" then
			if v1= "true" then v1= true else v1=false
		end if
		call EONControl.SendEvent(e,v1)
	else
		dim v2, v3, v4
		v2 = document.eonhiddenfields.EONInEventV2.value
		v3 = document.eonhiddenfields.EONInEventV3.value
		v4 = document.eonhiddenfields.EONInEventV4.value
		Dim TheArray(3)
		TheArray(0) = v1
		TheArray(1) = v2
		TheArray(2) = v3
		TheArray(3) = v4
		call EONControl.SendEvent(e, TheArray)
	end if
end sub


'end of file

