var showHide = new Array();
var relatedBox = new Array();
var aaaDependent = new Array();
var mandatory = new Array();


// 802.1x
showHide['dot1xEnable'] = ['dummyBox'];
relatedBox['dot1xEnable'] = "spoke_Dot1x";
aaaDependent['dot1xEnable'] = true;
mandatory['dot1xEnable'] = false;

// Auth Proxy
showHide['client_authproc'] = ['dummyBox'];
relatedBox['client_authproc'] = "spoke_Authp";
aaaDependent['client_authproc'] = true;
mandatory['client_authproc'] = false;

// Wireless
showHide['client_wireless'] = ['wireless_ssid'];
relatedBox['client_wireless'] = "spoke_Wireless";
aaaDependent['client_wireless'] = true;
mandatory['client_wireless'] = true;

// Corporate call manager
showHide['haveCUCM'] = ['client_pool_150_ip'];
relatedBox['haveCUCM'] = "dummyBox";
aaaDependent['haveCUCM'] = false;
mandatory['haveCUCM'] = true;

// Voice Servers
showHide['enableVoice'] = ['voice_srvrs',
						'addVoice',
						'delVoice'];
relatedBox['haveCUCM'] = "dummyBox";
aaaDependent['haveCUCM'] = false;
mandatory['enableVoice'] = true;

// Configuration Engine
showHide['CE_Enabled'] = [	'CE_IP_Address',
							'CE_Hostname'];
relatedBox['CE_Enabled'] = "dummyBox";
aaaDependent['CE_Enabled'] = false;
mandatory['CE_Enabled'] = true;

// Split Tunneling
showHide['splitTunnelEnable'] = ['addCorpSubnet',
								 'delCorpSubnet',
								 'ezvpn_data_subnets'];
relatedBox['splitTunnelEnable'] = "dummyBox";
aaaDependent['splitTunnelEnable'] = false;
mandatory['splitTunnelEnable'] = false;

// AAA Fields
showHide['client_aaa'] = [	'client_radius_aaa',
							'client_radius_shared_aaa_key',
							'client_authen_grp_aaa',
							'hdr_aaa_auth'];
relatedBox['client_aaa'] = "dummyBox";
aaaDependent['client_aaa'] = false;
mandatory['client_aaa'] = true;

// Template config server access
showHide['sdp_tftp_user_yes_no'] = ['sdp_tftp_username',
									'sdp_tftp_passwd'];
relatedBox['sdp_tftp_user_yes_no'] = "dummyBox";
aaaDependent['sdp_tftp_user_yes_no'] = false;
mandatory['sdp_tftp_user_yes_no'] = true;

// Changes for the spoke being either an 881 or an 871
// When its an 871, the following appear in lieu of 
// !!!Spoke 881 off change <number> where number = index+1 below
var spoke_881_off = new Array (	'bridge irb',
								'bridge-group 1',
								'bridge 1 route ip',
								'bridge-group 1',
								'bridge-group 1 spanning-disabled');

// Choosing the two-hub design. When the user chooses to have a
// separate management hub, the fields for the primary EZVPN Server
// are displayed.
showHide['add_mgmt_hub'] = ['ezvpn_router',
							'hdr_ezvpn_network_config',
							'ezvpn_wan_ip',
							'ezvpn_wan_netmask',
							'ezvpn_default_gw',
							'hdr_ezvpn_access_cred',
							'ezvpn_enable',
							'ezvpn_local_username',
							'ezvpn_local_passwd',
							'hdr_ezvpn_tunnel_detail',
							'ezvpn_tunnel_start',
							'ezvpn_tunnel_end',
							'sdp_mmgt',
							'addMgmt_subnet',	// CHECK
							'delMgmt_subnet',	// CHECK
							'hdndBtmBack',			// CHECK
							'hdndBtmNext',			// CHECK
							'hdr_ezvpn_adv_conf',
							'ezvpn_mmgt_acl_name',
							'ezvpn_ipsec_encr',
							'ezvpn_ipsec_key_len',
							'ezvpn_ipsec_hash',
							'ezvpn_isakmp_encr',
							'ezvpn_isakmp_key_len',
							'ezvpn_isakmp_key_grp',
							'ezvpn_pki_trustpt_name',
							'ezvpn_dhcp_pool_name',
							'ezvpn_hostname',
							'ezvpn_ipsec_prof_name',
							'ezvpn_isa_prof_name',
							'ezvpn_ipsec_xform_set',
							'advGenConfBtm',		// CHECK
							'hdr_hdndVPN'];			// CHECK

relatedBox['add_mgmt_hub'] = "dummyBox";
aaaDependent['add_mgmt_hub'] = false;
mandatory['add_mgmt_hub'] = true;

var show_generated_configs = ['hdr_configGen_Mgmt',
					'hdr_configGen_VPN',
					'hdr_configGen_Spoke'];

// This array contains all element ids which will change text if two hubs are enabled
// In the one-hub scenario, the label texts associated with these elements
// are borrowed from the ezvpn_.. labels. If twin hubs are enabled, then
// the label texts are used in a direct lookup from labelLookup[].
var dualHubCA = new Array();
dualHubCA ['lbl_sdp_router'] = 	 		   'lbl_ezvpn_router';
dualHubCA ['hdr_sdp_network_config'] = 	   'hdr_ezvpn_network_config';
dualHubCA ['lbl_sdp_wan_ip'] =             'lbl_ezvpn_wan_ip';
dualHubCA ['lbl_sdp_wan_netmask'] =        'lbl_ezvpn_wan_netmask';
dualHubCA ['lbl_sdp_default_gw'] =         'lbl_ezvpn_default_gw';
dualHubCA ['hdr_sdp_access_cred'] =    	   'hdr_ezvpn_access_cred';
dualHubCA ['lbl_sdp_enable'] =             'lbl_ezvpn_enable';
dualHubCA ['lbl_sdp_local_username'] =     'lbl_ezvpn_local_username';
dualHubCA ['lbl_sdp_local_password'] =     'lbl_ezvpn_local_password';
dualHubCA ['hdr_sdp_tunnel_detail'] =  	   'hdr_ezvpn_tunnel_detail';
dualHubCA ['lbl_sdp_tunnel_start'] =       'lbl_ezvpn_tunnel_start';
dualHubCA ['lbl_sdp_tunnel_end'] =         'lbl_ezvpn_tunnel_end';
dualHubCA ['hdr_sdp_adv_conf'] =       	   'hdr_ezvpn_adv_conf';
dualHubCA ['lbl_sdp_mmgt_acl_name'] =      'lbl_ezvpn_mmgt_acl_name';
dualHubCA ['lbl_ezvpn_data_subnets'] =     'lbl_ezvpn_data_subnets';
dualHubCA ['lbl_sdp_ipsec_xform_encr'] =   'lbl_ezvpn_ipsec_encr';
dualHubCA ['lbl_sdp_ipsec_key_len'] =      'lbl_ezvpn_ipsec_key_len';
dualHubCA ['lbl_sdp_ipsec_hash'] =         'lbl_ezvpn_ipsec_hash';
dualHubCA ['lbl_sdp_isakmp_encr'] =        'lbl_ezvpn_isakmp_encr';
dualHubCA ['lbl_sdp_isakmp_key_len'] =     'lbl_ezvpn_isakmp_key_len';
dualHubCA ['lbl_sdp_isakmp_key_grp'] =     'lbl_ezvpn_isakmp_key_grp';
dualHubCA ['lbl_sdp_pki_trustpt_name'] =   'lbl_ezvpn_pki_trustpt_name';
dualHubCA ['lbl_sdp_dpool'] =     		   'lbl_ezvpn_dhcp_pool_name';
dualHubCA ['lbl_sdp_hostname'] =           'lbl_ezvpn_hostname';
dualHubCA ['lbl_sdp_ipsec_prof_name'] =    'lbl_ezvpn_ipsec_prof_name';
dualHubCA ['lbl_sdp_isa_prof_name'] =      'lbl_ezvpn_isa_prof_name';
dualHubCA ['lbl_sdp_ipsec_xform_set'] =    'lbl_ezvpn_ipsec_xform_set';
dualHubCA ['hdr_hdndMgmt'] =			   'hdr_hdndVPN';

var requiredStar = ' <img class="apps-form-img-required" src="http://www.cisco.com/web/fw/apps/i/apps_form_required.gif" alt="Required Field" />';

var errorCross = '<img class="apps-form-img-error" src="http://www.cisco.com/web/fw/apps/i/apps_form_error.gif" alt="This field contains an error" />  ';

var globalMandatoryPassed = false;


var helpTexts = new Array (
	"Choose your enable password", //0
	"This can be an ftp server, tftp server, flash etc\neg: flash:<name_of_file>\ntftp://10.10.10.129/folder_name/<name_of_file>", //1
	"write the management subnets with the following format: \n IP/mask, IP2/mask2, IP3/mask3... ex:\n 10.10.104.128/25, 10.10.104.192/26 ,... ",//2
	"Enter your domain name \neg: domain.org",//3
	"Choose your username",//4
	"Insert the key word",//5
	"Insert password",//6
	"write the IP with the following format \n xx.xx.xx.xx ex : \n 192.168.100.1 \n or write the name o solve ex: \n domain.org.com",//7
	"Can be multiple IP's ex: \n xx.xx.xx.xx, xx.xx,xx,xx",//8
    "Enter the IP address of your corporate DNS server. \nWrite the address in the following format : xx.xx.xx.xx \neg: 192.168.100.1",//9
	"Enter the IP address of the outside facing interface. \nWrite the address in the following format : xx.xx.xx.xx \neg: 192.168.100.1",//10
	"Enter the network mask of the WAN IP address. \neg: 255.255.248.0",//11
    "Enter the IP address of the TFTP server for the Call Manager  \n(You can enter additional TFTP servers by separating the IP addresses by spaces in the same field.)",//12
    "Choose your password",//13
    "Enter start of range for pool from which an address will be assigned to the virtual tunnel interface of every new Easy VPN tunnel on the spoke.(These addresses should be company-wide routable)",//14
    "Enter end of range for pool from which an address will be assigned to the virtual tunnel interface of every new Easy VPN tunnel on the spoke.(These addresses should be company-wide routable)",//15
    "Enter the name of the access-list that allows only the traffic going to the management subnets defined above to go through the tunnel.",//16
    "Enter the name of the access-list that allows only the traffic going to the corporate data subnets defined above to go through the tunnel",//17
    "Enter start of range for pool from which an address will be assigned to devices on the LAN network",//18
    "Enter end of range for pool from which an address will be assigned to devices on the LAN network",//19
 	"Enter the default gateway that the device should point to. \nWrite the address in the following format : xx.xx.xx.xx \neg: 192.168.1.1", //20
    "Enter the IP address of the Network Time Protocol (NTP) server that will be used by all the devices \nWrite the address in the following format : xx.xx.xx.xx \neg: 192.168.100.1",//21
    "Enter the password to be used to enable the certificate server",//22
    "Enter the IP address of the ACS AAA server you would like to point to. \n This will be used for authentication for 802.1x, wireless and Authentication-proxy",//23
    "Enter the shared secret of the AAA profile",//24
	"You need to store the client spoke configuration files at a specific location for the zero touch process. This can be anywhere that the VPN headend router has access to, e.g. on the flash memory of the headend router itself, an external ftp server, or http server. ",//25
	"Add another router to function as the management server. This can be very useful for the maintenance and troubleshooting of individual spokes if the data tunnel goes down.",//26
	"You may now copy and paste the respective configs into the headend routers and store the spoke configs in the location specified",//27
	"Please enter just the hostname: the domain name will be automatically appended to this hostname",//28
	"The wireless SSID cannot have spaces",//29
	"The Configuration Engine (CE) can be used for advanced configuration and Cisco IOS software upgrades",//30
	"Please enter the IP addresses of servers used for voice eg Phone Services server, Directory Services Server, etc",//31
	"If the number of users is going to exceed 100, we recommend that you use a separate ftp server to store the certificates for additional security. Normally this would default to flash:",//32
	"Enter a summer time zone for daylight savings, such as EDT (Eastern Daylight Time) if the corporate location is New York, PDT in California, etc.");//33


var wanInt = new Array();
var guestLan = new Array();
var corpLan = new Array();
var connectPC = new Array();

wanInt ['871'] = "FastEthernet 4";
guestLan ['871'] = "2-3";
corpLan ['871'] = "0-1";
connectPC['871'] = "FastEthernet 0";

wanInt ['881'] = "FastEthernet 4";
guestLan ['881'] = "2-3";
corpLan ['881'] = "0-1";
connectPC['881'] = "FastEthernet 0";

wanInt ['891'] = "FastEthernet 8";
guestLan ['891'] = "4-7";
corpLan ['891'] = "0-3";
connectPC['891'] = "FastEthernet 0";

wanInt ['1811'] = "FastEthernet 0";
guestLan ['1811'] = "6-9";
corpLan ['1811'] = "2-5";
connectPC['1811'] = "FastEthernet 2";

var exportText = "The export funtionality allows you to save all the data you have filled in this form. When you import from this saved data, "+
             "the form automatically gets populated. For export, please copy and save the following into a text file. If you are not ready, please press Cancel.";
var importText = "The import funtionality allows you to retrieve all the data you had previously filled in this form. Please copy and paste the data from the "+
             "text file you should have saved from a previous session below. If you do not have the data, you may choose to cancel the process.";

// This variable contains the list of all mandatory fields
// which have been left empty. Its easier to let all fields
// report themselves to the array depending on all checkboxes
// and combinations rather than checking for dependencies all
// over again when generating the configs.
var emptyVars = new Array();
// Initially populated with all fields that are empty to begin with.
emptyVars = ['sdp_pki_cert_orgzn',
			 'sdp_domain_name',
			 'sdp_pki_passwd',
			 'sdp_wan_ip',
			 'sdp_wan_netmask',
			 'sdp_default_gw',
			 'sdp_enable',
			 'client_enable_pwd'];

