/*-----------------------------------------------------------------------------
	Name: A01_MPD_007_PolNum_PrefillPage.c
	Recorded By: Converted via tool
	Date of recording:
	Flow details:
	Build details:
	Modification History:
-----------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ns_string.h"

void A01_MPD_007_PolNum_PrefillPage()
{
	/* val addr */
	char PrefillValidateAddress[70];

	

	ns_start_transaction("A01_AZ_011_MPD_PolNum_prefill_ValidateAddress");

	//addDynaTraceHeader("NA=A01_AZ_011_MPD_prefill_ValidateAddress;PC=flow_13");
	ns_web_url("PolicyNum_ValidateAddress",
		"URL={P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Method=POST", 
		"HEADER=Faces-Request:partial/ajax",
		"HEADER=Origin:{P_URL}",
        	"HEADER=Content-Type:application/x-www-form-urlencoded",
		"HEADER=Referer: {P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Snapshot=t17.inf", 
		ITEMDATA,
		"Name=policyDataGatherForm:j_id__v_2_bls-input","Value=",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_firstName","Value={P_PolFname}",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_middleName","Value=",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_lastName","Value={P_PolLname}",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_addressType","Value=current",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_address_postalCode","Value={P_PolZipCode}",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_address_addressLine1","Value={C_AddressLine1_06}", 
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_address_addressLine2","Value=",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_address_city","Value={C_City_06}", 
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_address_stateProvCd","Value=AZ",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_priorAddress_stateProvCd","Value=",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_dateOfBirthInputDate","Value={P_PolDOB}",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_dateOfBirthInputCurrentDate","Value={C_DOBInpCurrDate_06}",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_riskStateCd","Value=AZ",
		"Name=policyDataGatherForm:addressStandartized","Value=false",
		"Name=policyDataGatherForm:priorAddressStandartized","Value=",
		"Name=policyDataGatherForm:j_id__v_3_bls-input","Value=",
		"Name=policyDataGatherForm:j_id__v_4_bls-input","Value=",
		"Name=policyDataGatherForm:currentPFElmentFocus","Value=",
		"Name=policyDataGatherForm:rulesValidationSubmit","Value=true",
		"Name=policyDataGatherForm:focusFirstInputElement","Value=",
		"Name=policyDataGatherForm:focusFirstInputForInstance","Value=",
		"Name=policyDataGatherForm:instanceToEliminate","Value=",
		"Name=policyDataGatherForm:focusControlAfterPopupClose","Value=",
		"Name=policyDataGatherForm_SUBMIT","Value=1",
		"Name=javax.faces.ViewState","Value={C_VSPrefillPage_06}", 
		"Name=org.richfaces.ajax.component","Value=policyDataGatherForm:validateAddressButton",
		"Name=policyDataGatherForm:validateAddressButton","Value=policyDataGatherForm:validateAddressButton",
		"Name=AJAX:EVENTS_COUNT","Value=1",
		"Name=javax.faces.partial.event","Value=click",
		"Name=javax.faces.source","Value=policyDataGatherForm:validateAddressButton",
		"Name=javax.faces.partial.ajax","Value=true",
		"Name=javax.faces.partial.execute","Value=@component policyDataGatherForm:validateAddressButton",
		"Name=javax.faces.partial.render","Value=@component",
		"Name=policyDataGatherForm","Value=policyDataGatherForm",
		ITEMDATA_END
		);
	
	ns_end_transaction("A01_AZ_011_MPD_PolNum_prefill_ValidateAddress", NS_AUTO_STATUS);
		//ns_page_think_time(think_time);

if (atoi(ns_eval_string("{CaptureAddress}")) > 0){ 

		/*Enter Address details*/
		
		printf("AVS sytem might be down and address details section entered to split block");

		ns_start_transaction("A01_AZ_011A_MPD_PolNum_prefill_EnterAddress");

    //addDynaTraceHeader("NA=B04_AZ_015A_1D1V_EnterAddrss;PC=flow_13");
    ns_web_url("flow_13",
		"URL={P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Method=POST", 
		"HEADER=Faces-Request:partial/ajax",
		"HEADER=Origin:{P_URL}",
        	"HEADER=Content-Type:application/x-www-form-urlencoded",
		"HEADER=Referer: {p_url}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Snapshot=t41.inf", 
		ITEMDATA,
		"Name=addressValidationFormAAAPrefillAddressValidation:primaryStreetNumberInput","Value={P_StreetNo}",
		"Name=addressValidationFormAAAPrefillAddressValidation:primaryStreetNameInput","Value={P_StreetName}",
		"Name=addressValidationFormAAAPrefillAddressValidation:primaryUnitNumberInput","Value=",
		"Name=addressValidationFormAAAPrefillAddressValidation_SUBMIT","Value=1",
		"Name=javax.faces.ViewState","Value={C_VSPrefillPage_06}",
		"Name=javax.faces.behavior.event","Value=change",
		"Name=org.richfaces.ajax.component","Value=addressValidationFormAAAPrefillAddressValidation:primaryStreetNameInput",
		"Name=AJAX:EVENTS_COUNT","Value=1",
		"Name=javax.faces.partial.event","Value=change",
		"Name=javax.faces.source","Value=addressValidationFormAAAPrefillAddressValidation:primaryStreetNameInput",
		"Name=javax.faces.partial.ajax","Value=true",
		"Name=javax.faces.partial.execute","Value=@component addressValidationFormAAAPrefillAddressValidation:primaryStreetNameInput",
		"Name=javax.faces.partial.render","Value=@component",
		"Name=addressValidationFormAAAPrefillAddressValidation","Value=addressValidationFormAAAPrefillAddressValidation",
		ITEMDATA_END
		);


	ns_end_transaction("A01_AZ_011A_MPD_PolNum_prefill_EnterAddress", NS_AUTO_STATUS);
	
	//ns_page_think_time(think_time);

	/*Address Validation -> OK btn*/

	/*web_reg_save_param("C_VSOrderPrfl",
						   "LB=ViewState\" value=\"",
						   "RB=\" />",
						   "ORD=1",
						   "RelFrameId=1",
						   "Search=Body",
						   "IgnoreRedirections=Yes",
						   LAST);*/
	
	

	ns_start_transaction("A01_AZ_011_MPD_PolNum_prefill_Validateok");

	//addDynaTraceHeader("NA=B04_AZ_016_1D1V_PrefillAddrssValdtnOK;PC=flow_14");
	ns_web_url("PolicyNum_EnterAddressCode",
		"URL={P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Method=POST", 
		"HEADER=Faces-Request:partial/ajax",
		"HEADER=Origin:{P_URL}",
        	"HEADER=Content-Type:application/x-www-form-urlencoded",
		"HEADER=Referer: {P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Snapshot=t43.inf", 
		ITEMDATA,
		"Name=addressValidationFormAAAPrefillAddressValidation:primaryStreetNumberInput","Value={P_StreetNo}",
		"Name=addressValidationFormAAAPrefillAddressValidation:primaryStreetNameInput","Value={P_StreetName}",
		"Name=addressValidationFormAAAPrefillAddressValidation:primaryUnitNumberInput","Value=",
		"Name=addressValidationFormAAAPrefillAddressValidation_SUBMIT","Value=1",
		"Name=javax.faces.ViewState","Value={C_VSPrefillPage_06}",
		"Name=org.richfaces.ajax.component","Value=addressValidationFormAAAPrefillAddressValidation:submitAddressValidationAAAPrefillAddressValidation",
		"Name=addressValidationFormAAAPrefillAddressValidation:submitAddressValidationAAAPrefillAddressValidation","Value=addressValidationFormAAAPrefillAddressValidation:submitAddressValidationAAAPrefillAddressValidation",
		"Name=AJAX:EVENTS_COUNT","Value=1",
		"Name=javax.faces.partial.event","Value=click",
		"Name=javax.faces.source","Value=addressValidationFormAAAPrefillAddressValidation:submitAddressValidationAAAPrefillAddressValidation",
		"Name=javax.faces.partial.ajax","Value=true",
		"Name=javax.faces.partial.execute","Value=@component addressValidationFormAAAPrefillAddressValidation:submitAddressValidationAAAPrefillAddressValidation",
		"Name=javax.faces.partial.render","Value=@component",
		"Name=addressValidationFormAAAPrefillAddressValidation","Value=addressValidationFormAAAPrefillAddressValidation",
		ITEMDATA_END
		);

	ns_end_transaction("A01_AZ_011_MPD_PolNum_prefill_Validateok", NS_AUTO_STATUS);
	
	//ns_page_think_time(think_time);

	sprintf(PrefillValidateAddress, "%s", ns_eval_string("{C_AddrPostalCode_15}"));
	ns_save_string(PrefillValidateAddress, "P_AddressValidation_Final_06");

	}
	
	else{

	/* ok */

	//new zipcode
	//name="policyDataGatherForm:choicePointPrefillRequest_edit_address_postalCode" type="text" value="{C_AddrPostalCode}" onchange="var va
	
	
	ns_start_transaction("A01_AZ_011_MPD_PolNum_prefill_Validateok");

	//addDynaTraceHeader("NA=A01_AZ_011_MPD_prefill_Validateok;PC=flow_14");
	ns_web_url("PolicyNum_EnterAddressCode_Click",
		"URL={P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Method=POST", 
		"HEADER=Faces-Request:partial/ajax",
		"HEADER=Origin:{P_URL}",
        	"HEADER=Content-Type:application/x-www-form-urlencoded", 
		"HEADER=Referer: {P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Snapshot=t18.inf", 
		ITEMDATA,
		"Name=addressValidationFormAAAPrefillAddressValidation:primaryAddressSelectAAAPrefillAddressValidation","Value=0",
		"Name=addressValidationFormAAAPrefillAddressValidation_SUBMIT","Value=1",
		"Name=javax.faces.ViewState","Value={C_VSPrefillPage_06}",
		"Name=org.richfaces.ajax.component","Value=addressValidationFormAAAPrefillAddressValidation:submitAddressValidationAAAPrefillAddressValidation",
		"Name=addressValidationFormAAAPrefillAddressValidation:submitAddressValidationAAAPrefillAddressValidation","Value=addressValidationFormAAAPrefillAddressValidation:submitAddressValidationAAAPrefillAddressValidation",
		"Name=AJAX:EVENTS_COUNT","Value=1",
		"Name=javax.faces.partial.event","Value=click",
		"Name=javax.faces.source","Value=addressValidationFormAAAPrefillAddressValidation:submitAddressValidationAAAPrefillAddressValidation",
		"Name=javax.faces.partial.ajax","Value=true",
		"Name=javax.faces.partial.execute","Value=@component addressValidationFormAAAPrefillAddressValidation:submitAddressValidationAAAPrefillAddressValidation",
		"Name=javax.faces.partial.render","Value=@component",
		"Name=addressValidationFormAAAPrefillAddressValidation","Value=addressValidationFormAAAPrefillAddressValidation",
		ITEMDATA_END
		);
	
	ns_end_transaction("A01_AZ_011_MPD_PolNum_prefill_Validateok", NS_AUTO_STATUS);

	sprintf(PrefillValidateAddress, "%s", ns_eval_string("{C_AddrPostalCode_16}"));
	ns_save_string(PrefillValidateAddress, "P_AddressValidation_Final_06");
	
		//ns_page_think_time(think_time);

}

	/* op */

	ns_start_transaction("A01_AZ_012_MPD_PolNum_prefill_OrderPrefill");

	//addDynaTraceHeader("NA=A01_AZ_012_MPD_prefill_OrderPrefill;PC=flow_15");
	ns_web_url("PolicyNum_OrderPrefill",
		"URL={P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Method=POST", 
		"HEADER=Faces-Request:partial/ajax",
		"HEADER=Origin:{P_URL}",
        	"HEADER=Content-Type:application/x-www-form-urlencoded",
		"HEADER=Referer: {P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Snapshot=t19.inf", 
		ITEMDATA,
		"Name=policyDataGatherForm:j_id__v_2_bls-input","Value=",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_firstName","Value={P_PolFname}",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_middleName","Value=",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_lastName","Value={P_PolLname}",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_addressType","Value=current",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_address_postalCode","Value={P_AddressValidation_Final_06}",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_address_addressLine1","Value={C_AddressLine1_06}",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_address_addressLine2","Value=",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_address_city","Value={C_City_06}",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_address_stateProvCd","Value=AZ",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_priorAddress_stateProvCd","Value=",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_dateOfBirthInputDate","Value={P_PolDOB}",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_dateOfBirthInputCurrentDate","Value={C_DOBInpCurrDate_06}",
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_riskStateCd","Value=AZ",
		"Name=policyDataGatherForm:addressStandartized","Value=",
		"Name=policyDataGatherForm:priorAddressStandartized","Value=",
		"Name=policyDataGatherForm:j_id__v_3_bls-input","Value=",
		"Name=policyDataGatherForm:j_id__v_4_bls-input","Value=",
		"Name=policyDataGatherForm:currentPFElmentFocus","Value=",
		"Name=policyDataGatherForm:rulesValidationSubmit","Value=true",
		"Name=policyDataGatherForm:focusFirstInputElement","Value=",
		"Name=policyDataGatherForm:focusFirstInputForInstance","Value=",
		"Name=policyDataGatherForm:instanceToEliminate","Value=",
		"Name=policyDataGatherForm:focusControlAfterPopupClose","Value=",
		"Name=policyDataGatherForm_SUBMIT","Value=1",
		"Name=javax.faces.ViewState","Value={C_VSPrefillPage_06}",
		"Name=org.richfaces.ajax.component","Value=policyDataGatherForm:orderPrefillButton",
		"Name=policyDataGatherForm:orderPrefillButton","Value=policyDataGatherForm:orderPrefillButton",
		"Name=AJAX:EVENTS_COUNT","Value=1",
		"Name=javax.faces.partial.event","Value=click",
		"Name=javax.faces.source","Value=policyDataGatherForm:orderPrefillButton",
		"Name=javax.faces.partial.ajax","Value=true",
		"Name=javax.faces.partial.execute","Value=@component policyDataGatherForm:orderPrefillButton",
		"Name=javax.faces.partial.render","Value=@component",
		"Name=policyDataGatherForm","Value=policyDataGatherForm",
		ITEMDATA_END
		);
	ns_end_transaction("A01_AZ_012_MPD_PolNum_prefill_OrderPrefill", NS_AUTO_STATUS);

		//ns_page_think_time(think_time);
	/* cont */

	
	//<option value="{C_AAA1stNmdInsrd}" selected="selected"> fni
	
	//name="policyDataGatherForm:insuredInformation_insuredBaseDtInputDate" style="vertical-align: middle; " type="text" value="{C_InsrdBaseDate}" onchang
	
//	web_reg_save_param("C_AAA1stNmdInsrd",
//					   "LB=<option value=\"",
//					   "RB=\" selected",
//					   "ORD=2",
//					   "RelFrameId=1",
//					   "Search=Body",
//					   "IgnoreRedirections=Yes",
//					   LAST);
	
	
	
	
	
	
	
	ns_start_transaction("A01_AZ_013_MPD_PolNum_prefill_Continue");

	
	//addDynaTraceHeader("NA=A01_AZ_013_MPD_prefill_Continue;PC=flow_16");
	ns_web_url("PolicyNum_AddCode",
		"URL={P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Method=POST", 
		//"HEADER=Faces-Request:partial/ajax",
		"HEADER=Origin:{P_URL}",
        	"HEADER=Content-Type:application/x-www-form-urlencoded",
		"HEADER=Referer: {P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Snapshot=t20.inf", 
		ITEMDATA, 
		"Name=policyDataGatherForm:j_id__v_2_bls-input", "Value=",  
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_firstName", "Value={P_PolFname}",  
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_middleName", "Value=",  
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_lastName", "Value={P_PolLname}",  
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_addressType", "Value=current",  
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_address_postalCode", "Value={P_AddressValidation_Final_06}",  
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_address_addressLine1", "Value={C_AddressLine1_06}",  
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_address_addressLine2", "Value=",  
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_address_city", "Value={C_City_06}",  
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_address_stateProvCd", "Value=AZ",  
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_priorAddress_stateProvCd", "Value=",  
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_dateOfBirthInputDate", "Value={P_PolDOB}",  
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_dateOfBirthInputCurrentDate", "Value={C_DOBInpCurrDate_06}",  
		"Name=policyDataGatherForm:choicePointPrefillRequest_edit_riskStateCd", "Value=AZ",  
		"Name=policyDataGatherForm:addressStandartized", "Value=",  
		"Name=policyDataGatherForm:priorAddressStandartized", "Value=",  
		"Name=policyDataGatherForm:prefillNext", "Value=Continue",  
		"Name=policyDataGatherForm:j_id__v_3_bls-input", "Value=",  
		"Name=policyDataGatherForm:j_id__v_4_bls-input", "Value=",  
		"Name=policyDataGatherForm:currentPFElmentFocus", "Value=",  
		"Name=policyDataGatherForm:rulesValidationSubmit", "Value=true",  
		"Name=policyDataGatherForm:focusFirstInputElement", "Value=",  
		"Name=policyDataGatherForm:focusFirstInputForInstance", "Value=",  
		"Name=policyDataGatherForm:instanceToEliminate", "Value=",  
		"Name=policyDataGatherForm:focusControlAfterPopupClose", "Value=",  
		"Name=policyDataGatherForm_SUBMIT", "Value=1",  
		"Name=javax.faces.ViewState", "Value={C_VSPrefillPage_06}",  
		ITEMDATA_END
		);
	
	ns_end_transaction("A01_AZ_013_MPD_PolNum_prefill_Continue", NS_AUTO_STATUS);

}