<?xml version="1.0" encoding="UTF-8"?>
<ccxml xmlns="http://www.w3.org/2002/09/ccxml" xmlns:conf="http://www.w3.org/2005/ccxml-conformance" version="1.0">
	<!--
      <conf:fail reason="'Unexpected Event ' + event$.name"/>
-->
	<conf:docsetup/>	
	<var name="chld_reason"/>
	<var name="send_id_1"/>
	<var name="cur_event_ID"/>
	<script><![CDATA[
	   function GetMilliseconds() {
     var d = new Date();
     return d.getTime();  // ms from midnight on Jan 1, 2000.application)"/>

   }

var t_start, t_end, t_delay = 2000, t_delta, t_delta_e = 0.05 * t_delay;
		   ]]></script>
	<script><![CDATA[

var i=0;
assertions[i++] = init_assertion('777');

add_2_assert_trace('777');
add_2_assert_trace('778');

var assert_last = i - 1;
var assert_index = -1;
//
// out of the loop assertions (children?)
//
//
s_ASSERTIONS_LEFT = show_remained_assertions();
var b_in_test = false;


]]></script>
	
	<eventprocessor statevariable="current_state">
		<conf:setup type="noconnection"/>
		
		<transition event="ccxml.loaded">
		  <assign name="current_state" expr="'init'"/>
		  <send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="connection.alerting" state="init">
			<send targettype="'ccxml'" target="session.id" name="'user.timeout'" delay="TEST_LONG_TIMEOUT"/>
			<accept connectionid="event$.connectionid"/>
		</transition>
		<transition event="connection.connected" state="init">
			<conf:comment expr="'Event: ' + event$.name"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
		<transition event="user.PREPARE_NEW">
			<conf:comment expr="'Event: ' + event$.name"/>

			<if cond="assert_index &gt;= 0">
				<assign name="ASSERTION_NUM" expr="assertions[assert_index].number"/>
				<assign name="t_ASSERT_RESULT" expr="assertions[assert_index].P_F"/>
				<script>t_ASSERT_REASON = assertions[assert_index].reason</script>
				<if cond="t_ASSERT_RESULT == s_PASS">
					<conf:pass reason="t_ASSERT_REASON"/>
					<elseif cond="t_ASSERT_RESULT == s_FAIL"/>
					<conf:fail reason="t_ASSERT_REASON"/>
					<else/>
					<conf:not_exec reason="t_ASSERT_REASON"/>
				</if>
			</if>
			
			<assign name="assert_index" expr="assert_index + 1"/>
			<if cond="assert_index &gt; assert_last">
				<assign name="current_state" expr="'switching_files'"/>
				<fetch next="'8_2_2_A_UTF_16.ccxml'"/>
				<else/>
				<log label="s_TA" expr="s_ASSERTIONS_LEFT"/>
				<assign name="ASSERTION_NUM" expr=" assertions[assert_index].number"/>
				<assign name="t_ASSERT_REASON" expr="''"/>
				<script>assertions[assert_index].P_F = s_FAIL;</script>
				<assign name="current_state" expr="state_prefix + ASSERTION_NUM"/>
				<send targettype="'ccxml'" target="session.id" name="start_name_prefix + ASSERTION_NUM" sendid="cur_event_ID"/>
				<log label="s_TA" expr="'Loop event: SendID=' + cur_event_ID"/>
			</if>
		</transition>
        
		<transition event="user.START_ASSERTION_777" state="ASSERTION_NMBR_777">
<!--777 	
8.2.2 &lt;script&gt; 	
A <script> element may contain a charset attribute set the character encoding type of the script. 
UTF-8 and UTF-16 encodings of ISO/IEC 10646 must be supported. 	
emily.candell@comverse.com 	Accepted -->

		
			<conf:comment expr="'Event: ' + event$.name"/>
			
			<!--<var name="A_one" expr="'Ä'"/>
			<var name="B_one" expr="'ß'"/>
			
			<script src="script_utf_8.es" charset="UTF-8"/>
			<script src="script_default.es"/>
		
			<if cond="A_one==A_two"> -->
				<script>assertions[assert_index].P_F = s_PASS;</script>
				<!--
                	    <else/>
                		<script>
				    assertions[assert_index].P_F = s_FAIL;
					assertions[assert_index].reason = 'a problem occured while running scripts with UTF-8 and UTF-16 ' +
					'encodings.'; 
				</script>
            </if> -->

<!--
778 	
8.2.2 &lt;script&gt; 	
If an enctype attribute is not provided, 
UTF-8 is used as the default value. 	
emily.candell@comverse.com 	Accepted -->
                
            		<assign name="ASSERTION_NUM" expr="'778'"/>
            	<!--	<if cond="B_one==B_two"> -->
				<conf:pass/> <!--
				<else/> 
				<conf:fail/>
			</if>
-->
			<assign name="current_state" expr="'GEN'"/>
			<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
		</transition>
			
		<transition event="fetch.done" state="switching_files">
			<goto fetchid="event$.fetchid"/>
		</transition>
		
		<transition event="user.timeout">
			<assign name="current_state" expr="'GEN'"/>
			<conf:uncond_exit expr="'TEST-TIMEOUT.' + show_remained_assertions()"/>
		</transition>

		<transition event="send.successful">
			<conf:comment expr="'Event: ' + event$.name + ' (generic handler) state=' + current_state"/>
		</transition>

		<transition event="*">
			<assign name="t_ASSERT_REASON" expr="'UNEXPECTED EVENT ' + event$.name + ' IN STATE ' + current_state"/>
			<conf:comment expr="t_ASSERT_REASON"/>
			<conf:uncond_exit/>
			<if cond="current_state == 'init'">
				<conf:uncond_exit expr="'Did not come out from init state.'"/>
				<else/>
				<send targettype="'ccxml'" target="session.id" name="name_prepare_new"/>
			</if>
		</transition>

	</eventprocessor>
</ccxml>
