<?php


// Grab the car type POST value
if (isset($_SESSION['vehicles'])) {
    $vehicle_type = $_SESSION['vehicles'];
} else {
    $vehicle_type = [];
}

//get campaign tracking session data
/*if (isset($_SESSION['utm_source'])) {
    $source = $_SESSION['utm_source'];
}*/

if (isset($_SESSION['utm_medium'])) {
    $medium = $_SESSION['utm_medium'];
}
/*if (isset($_SESSION['utm_campaign'])) {
    $campaign = $_SESSION['utm_campaign'];
	
} */

function get_client_ip() {
    $ipaddress = '';
    if (isset($_SERVER['HTTP_CLIENT_IP']))
        $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
    else if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
        $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
    else if (isset($_SERVER['HTTP_X_FORWARDED']))
        $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
    else if (isset($_SERVER['HTTP_FORWARDED_FOR']))
        $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
    else if (isset($_SERVER['HTTP_FORWARDED']))
        $ipaddress = $_SERVER['HTTP_FORWARDED'];
    else if (isset($_SERVER['REMOTE_ADDR']))
        $ipaddress = $_SERVER['REMOTE_ADDR'];
    else
        $ipaddress = 'UNKNOWN';
    return $ipaddress;
}

function syncMailchimp($data, $fields) {
    $apiKey = '7ff1cadca9bcb77561aec48cfbf9eeab-us16';
    $listId = 'b389cd2305';

	//testing keys
	//$apiKey = '1a16bae3c278fae73dd3246bcbaea214-us10';
    //$listId = '8c2e808ab3';

    $memberId = md5(strtolower($data['email']));
    $dataCenter = substr($apiKey, strpos($apiKey, '-') + 1);
    $url = 'https://' . $dataCenter . '.api.mailchimp.com/3.0/lists/' . $listId . '/members/' . $memberId;
    $json = json_encode([
       'email_address' => $data['email'],
        'status' => $data['status'], // "subscribed","unsubscribed","cleaned","pending"
        'merge_fields' => $fields
    ]);

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_USERPWD, 'user:' . $apiKey);
    curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $json);

    $result = curl_exec($ch);
	
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    return $httpCode;
}

$budget = isset($_POST['budget']) ? filter_var($_POST['budget'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) : null;
$employment_status = isset($_POST['employment-status']) ? filter_var($_POST['employment-status'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) : null;
$income = isset($_POST['income']) ? filter_var($_POST['income'], FILTER_SANITIZE_NUMBER_INT) : null;
$first_name_ =$first_name = isset($_POST['first-name']) ? filter_var($_POST['first-name'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) : null;
$last_name_ = $last_name = isset($_POST['last-name']) ? filter_var($_POST['last-name'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) : null;
$email_ = $email = isset($_POST['email']) ? filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) : null;
//$address = filter_var($_POST['address'], FILTER_SANITIZE_STRING);
$city_ = $city =  isset($_POST['phone']) ?filter_var($_POST['city'], FILTER_SANITIZE_STRING) : null;;
$phone_ =  isset($_POST['phone']) ? filter_var($_POST['phone'], FILTER_VALIDATE_EMAIL) : null;

$phone_format = "/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/";
//$postal_code_format = "/^[A-Za-z]\d[A-Za-z][ -]?\d[A-Za-z]\d$/";

//You must be at least 22 years old to apply.
$min = isset($_POST['email']) ?strtotime('+22 years', strtotime($_POST['birthdate'])): null;

if (isset($_POST['vehicle']) && !empty($_POST['vehicle']) && $budget != "" && $employment_status != "" && $income > 1700 &&
    $first_name != "" && $last_name != "" && $email != "" && preg_match($phone_format, $_POST['phone']) && time() > $min 
	//&& $address != "" && $city != "" && preg_match($postal_code_format, $_POST['postal-code'])
    //&& isset($_POST['current-address-years']) && isset($_POST['current-address-months']) && isset($_POST['income-years'])
    //&& isset($_POST['income-months']) 
   ) {


    // Submit form
    $message = '';
    $fields = array('vehicle', 'budget', 'employment-status', 'coapplicant', 'income', 'first-name', 'last-name', 'email', 'phone', 'birthdate', 'address', 'city', 'province','lived-canada', 'postal-code', 'current-address-years', 'current-address-months', 'income-years', 'income-months',// 'utm-source', 
	'utm-medium',
	// 'utm-campaign'
	);

    foreach ($fields as $field) {
        $value = is_array($_POST[$field]) ? implode(', ', $_POST[$field]) : $_POST[$field];
        if (!empty($value)) {
            $message .= "$field : $value \r\n";
        }
    }

    $ip_client = get_client_ip();
    $message .= "IP : $ip_client \r\n";

    $checkemail = explode('@', $_POST['email']);

    if (($checkemail[1] != 'supersendme.org') && ($_POST['first-name'] != $_POST['last-name'])) {
      // wp_mail('psarojanand@gmail.com, psarojanand@gmail.com', 'Full Lead From MVPNS Website Frontpage', $message, 'From: MVPNS Homepage <noreply@mvpns.ca>');
  wp_mail('leads@mvpns.ca, leadfunneler@atlanticstudio.ca, leadscopy.mvpns@gmail.com', 'Full Lead From MVPNS Website Frontpage', $message, 'From: MVPNS Homepage <noreply@mvpns.ca>');
		
        // Mailchimp submit
        $field_data = array(
            'FNAME' => $_POST['first-name'],
            'LNAME' => $_POST['last-name'],
            'BDAY' => $_POST['birthdate'],
            'PHONE' => $_POST['phone'],
            //'ADDRESS' => $_POST['address'],
            'ADDRESS' => isset($_POST['address']) ? $_POST['address'] : '',
            'VEHICLE' => $_POST['vehicle'],
            'BUDGET' => $_POST['budget'],
            //'CITY' => $_POST['city'],
            'CITY' => isset($_POST['city']) ? $_POST['city'] : '',
            //'PROVINCE' => $_POST['province'],
            'PROVINCE' => isset($_POST['province']) ? $_POST['province'] : '',
            //'POSTALCODE' => $_POST['postal-code'],
            'POSTALCODE' => isset($_POST['postal-code']) ? $_POST['postal-code'] : '',
            'CURRENTADD' => $_POST['current-address-years'] . ' years and' . $_POST['current-address-months'] . ' months',
            'EMPLOYED' => $_POST['employment-status'],
            'INCOME' => $_POST['income'],
			'RESIDENT' => $_POST['lived-canada'],
            'CURRENTJOB' => $_POST['income-years'] . ' years and' . $_POST['income-months'] . ' months',
			//'UTMSOURCE'=>$source,
			'UTMMEDIUM'=>$medium,
			//'UTMCAMP'=>$campaign,
            'IP' => get_client_ip()
        );
        $data = array(
            'email' => $_POST['email'],
            'status' => 'subscribed',
        );
        $filename = 'Lead-'.time().'.xml';
        //Send email with attched adf xml
        $xmlDoc = new DOMDocument("1.0", "UTF-8");
        $xmlDoc->preserveWhiteSpace = false;
        $xmlDoc->formatOutput = true;
        $doc = $xmlDoc->createProcessingInstruction('ADF', 'VERSION="1.0"');
        $xmlDoc->appendChild($doc);
        //create the root element
        $root = $xmlDoc->appendChild($xmlDoc->createElement("adf"));
        $prospect = $root->appendChild($xmlDoc->createElement("prospect"));
        $prospect->appendChild($xmlDoc->createElement("requestdate"))->appendChild($xmlDoc->createTextNode(date('Y-m-d g:i a')));
        $vehicle = $prospect->appendChild($xmlDoc->createElement("vehicle")); 
        $vehicle->setAttribute("interest", "buy");
        $vehicle->setAttribute("status", "new");
        $vehicle->appendChild($xmlDoc->createElement("year"));
        $vehicle->appendChild($xmlDoc->createElement("make"));
        $vehicle->appendChild($xmlDoc->createElement("model"));
        $vehicle->appendChild($xmlDoc->createElement("trim"));
        $vehicle->appendChild($xmlDoc->createElement("vin"));
        $vehicle->appendChild($xmlDoc->createElement("stock"));
        $customer = $prospect->appendChild($xmlDoc->createElement("customer"));
        $contact = $customer->appendChild($xmlDoc->createElement("contact"));
        $first = $contact->appendChild($xmlDoc->createElement("name"));
        $first->appendChild($xmlDoc->createTextNode($_POST['first-name']));
        $first->setAttribute("part", "first");
        $last = $contact->appendChild($xmlDoc->createElement("name"));
        $last->appendChild($xmlDoc->createTextNode($_POST['last-name']));
        $last->setAttribute("part", "last");
        $email = $contact->appendChild($xmlDoc->createElement("email"));
        $email->appendChild($xmlDoc->createTextNode($_POST['email']));
        $phone = $contact->appendChild($xmlDoc->createElement("phone"));
        $phone->appendChild($xmlDoc->createTextNode($_POST['phone']));
        $phone->setAttribute("type", "voice");
        $phone->setAttribute("time", "day");
        $cell = $contact->appendChild($xmlDoc->createElement("phone"));
        $cell->appendChild($xmlDoc->createTextNode($_POST['phone']));
        $cell->setAttribute("type", "cellphone");
        //$address = $contact->appendChild($xmlDoc->createElement("address"));
        //$address->setAttribute("type", "home");
        //$street = $address->appendChild($xmlDoc->createElement("street"));
        //$street->setAttribute('line',1);
        //$street->appendChild($xmlDoc->createTextNode($_POST['address']));
        //$city = $address->appendChild($xmlDoc->createElement("city"));
        //$city->appendChild($xmlDoc->createTextNode($_POST['city']));
        //$regioncode = $address->appendChild($xmlDoc->createElement("regioncode"));
        //$regioncode->appendChild($xmlDoc->createTextNode($_POST['province']));
        //$postalcode = $address->appendChild($xmlDoc->createElement("postalcode"));
        //$postalcode->appendChild($xmlDoc->createTextNode($_POST['postal-code']));
        //$country = $address->appendChild($xmlDoc->createElement("country"));
        //$country->appendChild($xmlDoc->createTextNode("Canada"));
        //$time_at_home = $contact->appendChild($xmlDoc->createElement('time-at-home'));
        //$time_at_home->appendChild($xmlDoc->createTextNode($_POST['current-address-years'].' Years '.$_POST['current-address-months'].' months '));
        $comments = $customer->appendChild($xmlDoc->createElement("comments"));
        $coapplicant = $comments->appendChild($xmlDoc->createElement("coapplicant"));
        $coapplicant->appendChild($xmlDoc->createTextNode($_POST['coapplicant']));
        $budget = $comments->appendChild($xmlDoc->createElement("budget"));
        $budget->appendChild($xmlDoc->createTextNode($_POST['budget']));
        $employment_status = $comments->appendChild($xmlDoc->createElement("employmentstatus"));
        $employment_status->appendChild($xmlDoc->createTextNode($_POST['employment-status']));
        $date_of_brith = $comments->appendChild($xmlDoc->createElement("DOB"));
        $date_of_brith->appendChild($xmlDoc->createTextNode($_POST['birthdate']));
        $income = $comments->appendChild($xmlDoc->createElement("income"));
		$resident = $comments->appendChild($xmlDoc->createElement("lived-canada")); 
        $income->appendChild($xmlDoc->createTextNode($_POST['income']));
		$resident->appendChild($xmlDoc->createTextNode($_POST['lived-canada']));
        //$time_at_work = $comments->appendChild($xmlDoc->createElement("time-at-work"));
        //$time_at_work->appendChild($xmlDoc->createTextNode($_POST['income-years'].' Years '.$_POST['income-months'].' months'));
        // $comments->appendChild($xmlDoc->createTextNode("Inventory Pricing |"));
        $vendor = $prospect->appendChild($xmlDoc->createElement("vendor"));
        $contact = $vendor->appendChild($xmlDoc->createElement("contact"));
        $service = $contact->appendChild($xmlDoc->createElement("service"));
        $service->appendChild($xmlDoc->createTextNode("DealerSocket Support"));
        $url = $contact->appendChild($xmlDoc->createElement("url"));
        $url->appendChild($xmlDoc->createTextNode("http://www.dealersocket.com/"));
        $provider = $prospect->appendChild($xmlDoc->createElement("provider"));
        $name = $provider->appendChild($xmlDoc->createElement("name"));
        $name->appendChild($xmlDoc->createTextNode("DealerSocket Support"));
        $xmlDoc->save($filename);

        $xml = file_get_contents($filename);

        wp_mail('webleads@mvp.dsmessage.com, psarojanand@gmail.com', 'Full Lead From MVPNS Website Frontpage', $xml, 'From: MVPNS Homepage <noreply@mvpns.ca>');

        syncMailchimp($data, $field_data);
		
        unlink(ABSPATH .$filename);
    }
	 wp_redirect(get_site_url().'/thank-you-vehicle?other=1&email='.$email_.'&phone='.$phone_.'&address=&first-name='.$first_name_.'&last-name='.$last_name_.'&postal-code=&city='.$city_.'&form_name=main_finance_app');
     exit;
  
}
get_header();
?>
<section class="walkthrough-section">
    <form method="post">
        <!--<input type="hidden" name="utm-source" value="<?php echo ($source) ? $source : '' ?>">-->
        <input type="hidden" name="utm-medium" value="<?php echo ($medium) ? $medium : '' ?>">
        <!--<input type="hidden" name="utm-campaign" value="<?php echo ($campaign) ? $campaign : '' ?>">-->
        <input type="hidden" name="vehicle" value="<?php echo (!empty($vehicle_type))?implode(", ", $vehicle_type):'Car'; ?>">
        <ol class="walkthrough">

            <li class="walkthrough-step">
                <h2>What's your ideal budget?</h2>
                <ul class="walkthrough-lg-options">
                    <li><label class="walkthrough-lg-option"><input type="radio" name="budget" value="Under $250/month" data-formatted="under $250/month"><span>Under $250/month</span></label>
                    <li><label class="walkthrough-lg-option"><input type="radio" name="budget" value="$250-375/month" data-formatted="between $250-375/month"><span>$250-375/month</span></label>
                    <li><label class="walkthrough-lg-option"><input type="radio" name="budget" value="$375-500/month" data-formatted="between $375-500/month"><span>$375-500/month</span></label>
                    <li><label class="walkthrough-lg-option"><input type="radio" name="budget" value="$500+/month" data-formatted="over $500/month"><span>$500+/month</span></label>
                </ul>
                <div class="walkthrough-navi">
                    <div class="error-holder"></div>
                    <a class="button-alt-outline" style="margin-right:20px; text-decoration: none; text-transform:uppercase;" href="/">Back</a>
                    <button class="button-alt js-walkthrough-next">Continue</button>
                </div>
                <p class="walkthrough-info"><small>By telling us your monthly budget we are able to provide several vehicle options suited just for you.</small></p>
                </li>
            <li class="walkthrough-step">
                <h2>What Is Your Employment Status?</h2>
                <ul class="walkthrough-lg-options">
                    <li><label class="walkthrough-lg-option"><input type="radio" name="employment-status" value="Employed"><span>Employed</span></label>
                    <li><label class="walkthrough-lg-option"><input type="radio" name="employment-status" value="Student"><span>Student</span></label>
                    <li><label class="walkthrough-lg-option"><input type="radio" name="employment-status" value="Homemaker"><span>Homemaker</span></label>
                    <li><label class="walkthrough-lg-option"><input type="radio" name="employment-status" value="Self-Employed"><span>Self-Employed</span></label>
                    <li><label class="walkthrough-lg-option"><input type="radio" name="employment-status" value="Retired"><span>Retired</span></label>
                    <li><label class="walkthrough-lg-option"><input type="radio" name="employment-status" value="Unemployed"><span>Unemployed</span></label>
                    <li><label class="walkthrough-lg-option"><input type="radio" name="employment-status" value="Other"><span>Other</span></label>
                </ul>
                <div class="walkthrough-navi">
                    <div class="error-holder"></div>
                    <button class="button-alt-outline js-walkthrough-back">Back</button>
                    <button class="button-alt js-walkthrough-next">Continue</button>
                </div>
                <p class="walkthrough-info"><small>The status of your employment helps us determine the appropriate loan program for you.</small></p>
                
                </li>
            <li class="walkthrough-step">
                <h2>Do you have a co-applicant?</h2>
                <ul class="walkthrough-lg-options">
                    <li><label class="walkthrough-lg-option"><input type="radio" name="coapplicant" value="Yes"><span>Yes</span></label>
                    <li><label class="walkthrough-lg-option"><input type="radio" name="coapplicant" value="No"><span>No</span></label>
                </ul>
                <div class="walkthrough-navi">
                    <div class="error-holder"></div>
                    <button class="button-alt-outline js-walkthrough-back">Back</button>
                    <button class="button-alt js-walkthrough-next">Continue</button>
                </div>
                <p class="walkthrough-info"><small>The status of your employment helps us determine the appropriate loan program for you.</small></p>
                </li>
            <li class="walkthrough-step">
                <div class="income-step-disabled">
                    <h2>Apologies.</h2>
                    <div class="container"><p>We are unable to finance Homemakers, Students or those Unemployed without a co-applicant at this time.  If you can arrange a co-applicant please re-apply again later.</p></div>
                    <div class="walkthrough-navi">
                        <button class="button-alt-outline js-walkthrough-back">Back</button>
                    </div>
                </div>
                <div class="income-step-enabled">
                    <h2 class="income-step-title-normal">What Is Your Income Per Month Before Tax/Deductions?</h2>
                    <h2 class="income-step-title-combined">What is the combined monthly income of both applicants before tax/deductions?</h2>
                    <ul class="walkthrough-lg-options">
                        <!-- <li><label class="walkthrough-lg-field"><input type="text" name="income" placeholder="Monthly Income" required></label></li> -->
                    
                        <li><label class="walkthrough-lg-option"><input type="radio" name="income" value="$5000+" required><span>$5000+</span></label>
                        <li><label class="walkthrough-lg-option"><input type="radio" name="income" value="$4000 - $5000"><span>$4000 - $5000</span></label>
                        <li><label class="walkthrough-lg-option"><input type="radio" name="income" value="$3000 - $4000"><span>$3000 - $4000</span></label>
                        <li><label class="walkthrough-lg-option"><input type="radio" name="income" value="$1800 - $3000"><span>$1800 - $3000</span></label>
                        <li><label class="walkthrough-lg-option"><input type="radio" name="income" value="1700"><span>Under $1800</span></label>
                        
                    </ul>
                    
                    <div class="walkthrough-navi">
                        <div class="error-holder"></div>
                        <button class="button-alt-outline js-walkthrough-back">Back</button>
                        <button class="button-alt js-walkthrough-next">Continue</button>
                    </div>
                    <p class="walkthrough-info"><small>Your income details show that you have the resources to make your monthly or bi-weekly payments, increasing your approval rate.</small></p>
                </div>
                
            </li>
           <li class="walkthrough-step">
           	<div class="lived-step-disabled">
                    <h2>Apologies.</h2>
                    <div class="container"><p>We are unable to accept New residence to Canada at this time. We are working on this however, so please try again soon.</p></div>
                    <div class="walkthrough-navi">
                        <button class="button-alt-outline js-walkthrough-back">Back</button>
                    </div>
                </div>
           <div class="lived-step-enabled">
            <h2>Have You Lived in Canada for More Than 2 Years?</h2>
                 <ul class="walkthrough-lg-options">
                 
                 
                        <li >
                            <label class="walkthrough-lg-option">
                            <input type="radio" name="lived-canada" value="Yes"><span>Yes</span></label>
                        </li>
                        <li>
                            <label class="walkthrough-lg-option">
                            <input type="radio" name="lived-canada" value="No"><span>No</span></label> 
                        </li>
                                    
             
               
                  <div class="walkthrough-navi">
                            <div class="error-holder"></div>
                            <button class="button-alt-outline js-walkthrough-back">Back</button>
                            <button class="button-alt js-walkthrough-next js-walkthrough-open-overlay">Continue</button>
                        </div>
                    </ul>
           		</div>
              </li>
            <li class="walkthrough-step">
                <h2>Almost Done - Create Your Account</h2>
                <ul class="walkthrough-lg-options">
                    <li><label class="walkthrough-lg-field"><input type="text" name="first-name" placeholder="First Name" required></label>
                    <li><label class="walkthrough-lg-field"><input type="text" name="last-name" placeholder="Last Name" required></label>
                </ul>
                <div class="walkthrough-navi">
                    <div class="error-holder"></div>
                    <button class="button-alt-outline js-walkthrough-back">Back</button>
                    <button class="button-alt js-walkthrough-next">Continue</button>
                </div>
                <p class="walkthrough-info"><small>To complete your application and access your loan we need your basic information.</small></p>
          </li>
            <li class="walkthrough-step">
                <h2>Complete Your Account</h2>
                <ul class="walkthrough-lg-options">

                    <li><label class="walkthrough-lg-field"><input type="email" name="email" placeholder="email@email.com" required></label>
                    <li><label class="walkthrough-lg-field"><input type="tel" name="phone" placeholder="Home (999) 999-9999" required></label>
                </ul>
                <div class="walkthrough-navi">
                    <div class="error-holder"></div>
                    <button class="button-alt-outline js-walkthrough-back">Back</button>
                    <button class="button-alt js-walkthrough-next">Continue</button>
                </div>
                <p class="walkthrough-info"><small>By completing the registration, you are giving Maritime Vehicle Providers permission to pull credit history and relevant information needed to complete your application, and to contact you with your approval information.</small></p>
            
            </li>
            <li class="walkthrough-step">
                <h2>Are You Old Enough to Get Financing?</h2>
                <ul class="walkthrough-lg-options">
                    <label class="walkthrough-lg-field"><input type="text" name="birthdate" placeholder="MM / DD / YYYY" required></label>
                </ul>
                <div class="walkthrough-navi">
                    <div class="error-holder"></div>
                    <button class="button-alt-outline js-walkthrough-back">Back</button>
                    <button class="button-alt js-walkthrough-next">Continue</button>
                </div>
                <p class="walkthrough-info"><small>Program eligibility in Canadian provinces and territories varies based on age.</small></p>
            <!--li class="walkthrough-step">
                <h2>Where Are You Looking for a Vehicle?</h2>
                <ul class="walkthrough-lg-options">
                    <li><label class="walkthrough-lg-field large"><input type="text" name="address" placeholder="Street Address" required></label>
                    <li><label class="walkthrough-lg-field"><input type="text" name="city" placeholder="City or Town name" required></label>
                    <li><label class="walkthrough-lg-field">
                            <select name="province" required>
                                <option value="">Province or Territory</option>
                                <option value="Nova Scotia">Nova Scotia</option>
                                <option value="New Brunswick">New Brunswick</option>
                                <option value="Prince Edward Island">Prince Edward Island</option>
                            </select></label>
                    <li><label class="walkthrough-lg-field"><input type="text" name="postal-code" placeholder="Postal Code" required></label>
                </ul>
                <div class="walkthrough-navi">
                    <div class="error-holder"></div>
                    <button class="button-alt-outline js-walkthrough-back">Back</button>
                    <button class="button-alt js-walkthrough-next">Continue</button>
                </div>
                <p class="walkthrough-info"><small>Available programs vary based on where you live. Please help us find the most convenient option for you by entering your home mailing address above.</small></p>
            <li class="walkthrough-step">
                <h2>How Long Have You Lived at Your Current Address?</h2>
                <ul class="walkthrough-lg-options">
                    <li><label class="walkthrough-lg-field has-addon"><input type="number" placeholder="0" name="current-address-years" required><span class="walk-field-addon">Years</span></label>
                    <li><label class="walkthrough-lg-field has-addon"><input type="number" placeholder="0" name="current-address-months" required><span class="walk-field-addon">Months</span></label>
                </ul>
                <div class="walkthrough-navi">
                    <div class="error-holder"></div>
                    <button class="button-alt-outline js-walkthrough-back">Back</button>
                    <button class="button-alt js-walkthrough-next">Continue</button>
                </div>
                <p class="walkthrough-info"><small>Your address details help us determine a suitable budget and loan amount that will maximize your chance of getting approved.</small></p>
            <li class="walkthrough-step">
                <h2>How Long Have You Worked at Your Current Job?</h2>
                <ul class="walkthrough-lg-options">
                    <li><label class="walkthrough-lg-field has-addon"><input type="number" placeholder="0" name="income-years" required><span class="walk-field-addon">Years</span></label>
                    <li><label class="walkthrough-lg-field has-addon"><input type="number" placeholder="0" name="income-months" required><span class="walk-field-addon">Months</span></label>
                </ul>
                <div class="walkthrough-navi">
                    <div class="error-holder"></div>
                    <button class="button-alt-outline js-walkthrough-back">Back</button>
                    <button class="button-alt js-walkthrough-next">Continue</button>
                </div>
                <p class="walkthrough-info"><small>Providing the length of the time you have been receiving this income helps us better understand your employment situation, increasing the likelihood of you getting approved.</small></p-->
        </ol>
        <div class="overlay"><div class="dialog">
                <div class="icon"><img src="<?= get_template_directory_uri(); ?>/img/walk-flag.gif" alt="approval flag" style="width:140px;height:80px;"></div>
                <h2 class="large">Congratulations!</h2>
                <p class="align-center">You have been preapproved for a <?php echo  is_array($vehicle_type) & !empty($vehicle_type) ?$vehicle_type[0]: null; ?> <span class="js-overlay-vehicle"></span> <span class="js-overlay-budget"></span></p>
                <p class="align-center"><button type="button" class="button-alt js-dialog-close">Continue</button></p>
            </div></div>
    </form>
    <!--div class="walk-more-info">
        <p>
            We love the Maritimes and we're driven to help Maritimers explore its roads. We've helped 1000's of Maritimers get approved since 2017 with the best application technology for online Car Loans and a huge network of thousands of vehicles for you to choose from. No matter what you're credit or financial standing is, you can get on the road within just a few hours of shopping <a href="<?=get_site_url();?>/used-cars-for-sale">our vehicle inventory</a>, or applying online. If you're employed and make at least $1700/mo, then you're already pre-approved for a car loan with us! Don't be fooled into buying a new vehicle with a high interest rate! We have a bankruptcy program for car loans with a flat low interest rate for everyone including those who've just entered bankruptcy. Even if you'd declared bankruptcy yesterday, we can get you into a vehicle today with a low interest rate. Other lenders will insist you need to 30-40% or more interest to get approved. We don't... we'll make sure you start off again on the right foot. Start car shopping the right way today. We often offer one or more of the following with: No Payments for 3 Months, Cash Back Options Available, Free Tires with Purchase, Free Delivery Anywhere. We have a record of thousands of vehicle car loan transactions and keep current on up-to-date used vehicle values. Do you want to know what your trade-in is valued at on a standard trade-in purchase at MVP? We'll give you an exact value your vehicle will carry towards a trade-in with MVP. No fee. No purchase necessary. To find out what your trade-in value is, just fill out our <a href="<?=get_site_url();?>/trade-in-calculator">trade-in calculator form</a>. Just entered a Bankruptcy? Forget paying 30% interest! We have a flat interest rate of 13.9% for those who are dealing with bankruptcy. We helped thousands of applicants throughout the Maritimes to get an approved with this last year! It's your turn! <a href="<?=get_site_url();?>/">Apply Now</a>.
        </p>
    </div-->
</section>
<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/tiny-slider/2.9.1/min/tiny-slider.js?ver=1.0'></script>
<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/cleave.js/1.4.7/cleave.min.js?ver=1.0'></script>
<?php get_footer(); ?>
<style>
    .main-footer{display:none;}
    .main-menu {display:none;}
    .form-search {visibility: hidden;}
    .btn-expand {visibility: hidden;}
</style>