<?php
					if(isset($_POST['submit_reg_form'])){
						if($bank->register_account($_POST,$_FILES['passportUpload'])){
							echo '<div class="alert alert-success">Your Account was Successful, Our Marketing Department will get back to you soon!</div>';
						}else{
							echo '<div class="alert alert-danger">Your Account was not created!, Please try again later!</div>';
						}
					}
?>
        <!--Start Main Contact Form Area-->
        <section class="main-contact-form-area">
            <div class="container">
                <div class="row d-flex justify-content-center contact-form">
	<p class="p-4 my-2 text-center">Please complete the form below to setup an account</p>
		<h2 class="text-primary text-center font-weight-bold">PERSONAL INFORMATION</h2>
	<form action="/register" method="POST" enctype="multipart/form-data" class="default-form2" id="register">
		<div class="form-group">
			<label for="fname">First Name</label>
			<div class="input-box">
				<input type="email" required name="fname" value="" id="fname" placeholder="&nbsp;">
			</div>	
		</div>
		<div class="form-group">
			<label for="lname">Last Name</label>
				<input type="text" required name="lname" value="" id="lname" placeholder="&nbsp;">
		</div>
		<div class="form-group">
			<label for="gender">
				Gender
			</label>
			<select name="gender" id="gender">
					<option value="male">Male</option>
					<option value="female">Female</option>
			</select>
		</div>
		<div class="form-group">
			<label for="date">Date of Birth</label>
			<div class="input-box">
				<input type="date" required name="bday" value="" id="date" placeholder="&nbsp;">
			</div>
		</div>
		<div class="form-group">
			<label for="email">
				<span class="label">Email</span>
			</label>
			<input type="email" required name="email" id="email" value="" pattern="[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,3}$" oninput="emaila(this)" placeholder="&nbsp;">
			<!-- <div id="emailErr" class="form_hint"> Email must not be empty!</div>
            <div id="emailErra" class="form_hint"> Email format not supportted!</div>
            <div id="emailErrb" class="form_hint"> Email already exist!</div> -->
            <!-- <div id="emailErrc" class="form_hint"><i class="fa fa-spinner fa-spin center"></i></div> -->
		</div>
		<div class="form-group">
			<label for="pno">Phone Number</label>
			<div class="input-box">
			<input type="tel" id="mobile-number" required name="pno" id="pno" value="" placeholder="&nbsp;">
			</div>
			<!-- <select id="address-country" name="country" style="display:none" required></select> -->
		</div>
		<div class="form-group">
			<label for="address">Address
			</label>
				<input type="text" required name="haddress" value="" id="address" placeholder="&nbsp;">
				
		</div>
		<div class="form-group">
			<label for="city" class="inp">City
			</label>
				<input type="text" required name="city" value="" id="city" placeholder="&nbsp;">
				
		</div>
		<div class="form-group">
			<label for="state" class="inp">State
			</label>
				<input type="text" required name="states" value="" id="state" placeholder="&nbsp;">
				
		</div>
		<div class="form-group">
			<label for="zip" class="inp">Zip Code
			</label>
				<input type="text" required name="zip" value="" id="zip" placeholder="&nbsp;">
				
		</div>
		<div class="form-group">
			<label for="acc_type" class="inp">
				Account Type
			</label>
			<div class="input-box">
			<select name="acc_type" id="acc_type">
					<option>Savings</option>
					<option>Checking</option>
			</select></div>
		</div>
		<div class="form-group">
			<h4 class="text-primary text-center font-weight-bold" style="margin-top:50px">PERSONAL IDENTIFICATION</h4>
		</div>
		<div class="form-group">
			<label for="idenType">
				Identification Type
			</label><div class="input-box">
				<select name="idenType" id="idenType">
					<option>International Passport</option>
					<option>Driver's Licence</option>
					<option>Social Security Number</option>
				</select>
				</div>
		</div>
		<div class="form-group">
			<label for="idenNo">
				Identification Number
			</label>
			<div class="input-box">
			<input type="text" required name="idenNo" value="" id="idenNo" placeholder="&nbsp;">
		</div></div>
		<div class="form-group">
			<label for="expireDate">
				Expiry Date
			</label>
				<input type="date" required name="expireDateCard" value="" id="expireDate" placeholder="&nbsp;">
		</div>
		<div class="form-group">
			<h4 class="text-primary text-center font-weight-bold" style="margin-top:50px">PASSPORT PHOTO</h4>
		</div>
		<div class="form-group">
			<label for="passportUpload">Upload your photo
			</label>
				<input type="file" required name="passportUpload" id="passportUpload" placeholder="&nbsp;">
				
		</div>
		<div class="col-md-12">
			<button type="submit" name="submit_reg_form" value="submit" class="btn btn-outline-primary rounded-pill">Submit Application</button>
        </div>
	</form>
	
	</div>
            </div>
        </section>
        <!--End Main Contact Form Area-->
<script src="/js/intlTelInput.js"></script> 

<script>
var countryData = $.fn.intlTelInput.getCountryData(),
  telInput = $("#mobile-number"),
  addressDropdown = $("#address-country");

telInput.intlTelInput({
  initialCountry: "auto",
  customPlaceholder: function(selectedCountryPlaceholder, selectedCountryData) {
	  return "e.g. " + selectedCountryPlaceholder;
	},
  preferredCountries: [ "us", "gb" ],
  geoIpLookup: function(callback) {
    $.get("https://ipinfo.io", function() {}, "jsonp").always(function(resp) {
      var countryCode = (resp && resp.country) ? resp.country : "";
      callback(countryCode);
    });
  },
  utilsScript: "/js/utils.js" // just for formatting/placeholders etc
});

// populate the country dropdown
$.each(countryData, function(i, country) {
  addressDropdown.append($("<option></option>").attr("value", country.name).text(country.name));
});
// set it\'s initial value
var initialCountry = telInput.intlTelInput("getSelectedCountryData").name;
addressDropdown.val(initialCountry);

// listen to the telephone input for changes
telInput.on("countrychange", function(e, countryData) {
  addressDropdown.val(countryData.name);
});

// listen to the address dropdown for changes
addressDropdown.change(function() {
	telInput.intlTelInput("setCountry", $(this).val());
});
$("#register").submit(function(e) {
	telInput.val(telInput.intlTelInput("getNumber"));
});

</script>

<div id="google_translate_element" style="display:none"></div>
<script type="text/javascript">

function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: "en"}, 'google_translate_element');
}

function changeLanguageByButtonClick() {
  var language = document.getElementById("language").value;
  var selectField = document.querySelector("#google_translate_element select");
  for(var i=0; i < selectField.children.length; i++){
    var option = selectField.children[i];
    // find desired langauge and change the former language of the hidden selection-field 
    if(option.value==language){
       selectField.selectedIndex = i;
       // trigger change event afterwards to make google-lib translate this side
       selectField.dispatchEvent(new Event('change'));
       break;
    }
  }
}
</script>

<script type="text/javascript" src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>