<?php 
$INC_DIR = $_SERVER['DOCUMENT_ROOT']."/v1/app/";
include $INC_DIR."src/common.php";

$customer_details=get_customer_details($configs);
if(empty($customer_details['package'])) {
	$homeUrl = 'choose.php' . (!empty($_SERVER['QUERY_STRING']) ? ('?' . $_SERVER['QUERY_STRING']) : '');
	header('Location:' . $homeUrl);
	exit(0);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title><?php echo $configs->page_title; ?></title>
	<meta content="width=device-width, initial-scale=1" name="viewport">
	<link href="../assets/brand/favicon.png" rel="icon" type="image/png">

	<link href="../assets/css/app.css" rel="stylesheet">
	<link href="assets/css/inner.css" type="text/css" rel="stylesheet">
	<link href="assets/css/btn-animation.css" type="text/css" rel="stylesheet">
	<style>.chkbox{
		width:auto !important;
		height:auto !important;
		appearance:checkbox !important;
		outline:auto !important;
		display:inline !important;
		text-align:center !important;
	}
	.frmCheckElemts {
		margin-top: 15px;
		text-align:center;
	}
	.frmCheckElemts label{
		font-size:12px !important;
		font-weight:normal;
	}

	form{padding:0;}

	.has-error{
		border: 2px solid #ff5e45 !important;
		background-image: url('./assets/images/icon-validation-bad.png') !important;
		background-position: right center !important;
		background-repeat: no-repeat !important;
		background-size: 30px !important;
	}
	.no-error{
		border: 2px solid #6abd6a !important;
		background-image: url('./assets/images/icon-validation-good.png') !important;
		background-position: right center !important;
		background-repeat: no-repeat !important;
		background-size: 30px !important;
	}
	</style>
	<script>
		history.pushState(null, null, window.location.href);
		history.back();
		history.forward(); 
		window.onpopstate = function () { history.go(1); };
	</script>
</head>
<body data-mobile-id="5984" style="max-width: 600px; margin: 0 auto">
<div id="app">
   <div class="checkout-page" id="pagecontainer">

      <div id="top-1">
            <center><img src="assets/brand/logo2-strips.png"
                    style="width:158px; margin: 6px 0 10px 0;"></center>
            <div class="breadcrumbs">
                <ul class="breadcrumbs__list">
                    <li class="breadcrumbs__item ">
                        <span>Qualify Now</span>
                    </li>
                    <li class="breadcrumbs__item breadcrumbs__item_2 ">
                        <span>Select Package</span>
                    </li>
                    <li class="breadcrumbs__item breadcrumbs__item_3 breadcrumbs__item_active">
                        <span>Confirm Order</span>
                    </li>
                </ul>
            </div>

            <p style="text-align:center;"><br>
                <b style="color:#000; font-size:18px;">Final Step - Payment Information</b><br>
                <span style="color:#444; font-size:11px;">
                    <em>Your order will be processed on our secure servers</em>
                </span>
                </p>
            <div class="cards-list">
                <span>We Accept:</span>
                <img alt="" src="assets/images/visa.png">
                <img alt="" src="assets/images/mastercard.png">
                <!-- <img alt="" src="./assets/images/amex.png"> -->
            </div>


            <div id="shortcheckoutcontainer" style="max-width:95%; margin:0 auto;">
			<form class="paymentform form"  method="POST" action="/v1/app/src/ajax.php"  onSubmit="return submit_form();" id="order_form" name="order_form">
					
				<input type="hidden" name="cpid[]" id="package" value="<?=isset($customer_details['package'])?$customer_details['package']:''?>">
				<input type="hidden" id="creditCardType" name="creditCardType" value="visa">
				<input type="hidden" name="device" value="mobile">
				<input type="hidden" name="pgtag" value="mcheckout">
				<input type="hidden" name="prospectId" value="<?=isset($customer_details['prospectId'])?$customer_details['prospectId']:$_GET['prospectId']?>">
				<input type="hidden" name="AFFID" value="<?=isset($customer_details['AFFID'])?$customer_details['AFFID']:$_GET['AFFID']?>">
				<input type="hidden" name="shippingCountry" id="shippingCountry" value="US">
				<input type="hidden" name="billingCountry" id="billingCountry" value="US">
				<input type="hidden" name="billingSameAsShipping" id="billShipSame" value="yes">
				<input type="hidden" id="cc_type" name="cc_type" value="">
			                                
                	<label for="payment_as_shipping" class="payment_as_shipping_label">
                        <input type="checkbox"  name="" id="payment_as_shipping" checked class="bill-inp">
                        <span>Billing same as Shipping</span>
                	</label>
                    <div class="billing-info" style="display: none; margin-bottom: 15px">

                   
                    <div class="billing-form">
                        <div class="billing-title">Billing Information</div>

                        <div class="form-holder">
                            <span>First Name: </span>
                            <input class="form-control required" data-placement="auto left" name="billingFirstName" id="firstName" placeholder="First Name*" title="First Name" type="text" onKeyUp="javascript: this.value = this.value.replace(/[^a-zA-Z]/g, '');">
                        </div>

                        <div class="form-holder" placeholder="Last Name*">
                            <span>Last Name: </span>
                            <input class="form-control required" data-placement="auto left" name="billingLastName" id="lastName" placeholder="Last Name*" title="Last Name" type="text" onKeyUp="javascript: this.value = this.value.replace(/[^a-zA-Z]/g, '');">
                        </div>

                        <div class=" form-holder">
                            <label>Address:</label>
                            <input class="form-control required" data-placement="auto left" name="billingAddress1" id="billingAddress1" placeholder="Address*" title="Address" type="text" value="" onKeyUp="javascript: this.value = this.value.replace(/[^a-zA-Z0-9 .'\-#:;,]/g, '');">
                        </div>

                        <div class=" form-holder">
                            <label>Zip Code:</label>
                            <input class="form-control required" data-placement="auto left" name="billingZip" id="billingZip" placeholder="Zip Code*"  title="Zip Code" type="text" value="" onKeyUp="javascript: this.value = this.value.replace(/[^0-9]/g, '');" >
                        </div>

                        <div class="form-holder">
                            <label>City:</label>
                            <input class="form-control required" data-placement="auto left" name="billingCity" id="billingCity" placeholder="City*" title="City" type="text" value="">
                        </div>

                        <div class="form-holder" style="display:none;">
                            <label>Country:</label>
                            <select class="form-control" id="id_country" >
                            </select>
                        </div>

                        <div class=" form-holder">
                            <label>State/Region:</label>
                            <select  name="billingState" id="billingState" class="form-control required" />
			                        <option value="" onClick="" selected>Select Billing State</option>
			                        <option value="AL">Alabama (AL)</option>
									<option value="AK">Alaska (AK)</option>
									<option value="AS">American Samoa (AS)</option>
									<option value="AZ">Arizona (AZ)</option>
									<option value="AR">Arkansas (AR)</option>
									<option value="AE">Armed Forces (AE)</option>
									<option value="AA">Armed Forces Americas (AA)</option>
									<option value="AP">Armed Forces Pacific (AP)</option>
									<option value="CA">California (CA)</option>
									<option value="CO">Colorado (CO)</option>
									<option value="CT">Connecticut (CT)</option>
									<option value="DE">Delaware (DE)</option>
									<option value="DC">District of Columbia (DC)</option>
									<option value="FM">Federated States of Micronesia (FM)</option>
									<option value="FL">Florida (FL)</option>
									<option value="GA">Georgia (GA)</option>
									<option value="GU">Guam (GU)</option>
									<option value="HI">Hawaii (HI)</option>
									<option value="ID">Idaho (ID)</option>
									<option value="IL">Illinois (IL)</option>
									<option value="IN">Indiana (IN)</option>
									<option value="IA">Iowa (IA)</option>
									<option value="KS">Kansas (KS)</option>
									<option value="KY">Kentucky (KY)</option>
									<option value="LA">Louisiana (LA)</option>
									<option value="ME">Maine (ME)</option>
									<option value="MD">Maryland (MD)</option>
									<option value="MA">Massachusetts (MA)</option>
									<option value="MI">Michigan (MI)</option>
									<option value="MN">Minnesota (MN)</option>
									<option value="MS">Mississippi (MS)</option>
									<option value="MO">Missouri (MO)</option>
									<option value="MT">Montana (MT)</option>
									<option value="NE">Nebraska (NE)</option>
									<option value="NV">Nevada (NV)</option>
									<option value="NH">New Hampshire (NH)</option>
									<option value="NJ">New Jersey (NJ)</option>
									<option value="NM">New Mexico (NM)</option>
									<option value="NY">New York (NY)</option>
									<option value="NC">North Carolina (NC)</option>
									<option value="ND">North Dakota (ND)</option>
									<option value="MP">Northern Mariana Islands (MP)</option>
									<option value="OH">Ohio (OH)</option>
									<option value="OK">Oklahoma (OK)</option>
									<option value="OR">Oregon (OR)</option>
									<option value="PA">Pennsylvania (PA)</option>
									<option value="MH">Republic of Marshall Islands (MH)</option>
									<option value="RI">Rhode Island (RI)</option>
									<option value="SC">South Carolina (SC)</option>
									<option value="SD">South Dakota (SD)</option>
									<option value="TN">Tennessee (TN)</option>
									<option value="TX">Texas (TX)</option>
									<option value="UT">Utah (UT)</option>
									<option value="VT">Vermont (VT)</option>
									<option value="VI">Virgin Islands of the U.S. (VI)</option>
									<option value="VA">Virginia (VA)</option>
									<option value="WA">Washington (WA)</option>
									<option value="WV">West Virginia (WV)</option>
									<option value="WI">Wisconsin (WI)</option>
									<option value="WY">Wyoming (WY)</option>
			                    </select>
                        </div>
                        <div class="billing-title">Payment Information</div>
                    </div>
                    </div>
                    
                    <div class="checkout-form-wrapper">
                        <div class="form-holder">
                            <label>Card Number:</label>
                            <input type="tel" name="creditCardNumber" id="cardNumber" data-threeds="pan" class="form-control required masked" placeholder="Card Number" maxlength="16" autocomplete="off"   />
                        </div>

                        <div class="form-fields">
                            <label>Card Expiry Date:</label>
                            <div class="form-holder" id="expire_m">
                                <select name="expmonth" data-threeds="month" id="cardMonth" class="required form-control" autocomplete="off" data-error-message="Please select a valid expiry month!">
                                  <option value="">Month</option>
                                  <option value="01">01 - January</option>
                                  <option value="02">02 - February</option>
                                  <option value="03">03 - March</option>
                                  <option value="04">04 - April</option>
                                  <option value="05">05 - May</option>
                                  <option value="06">06 - June</option>
                                  <option value="07">07 - July</option>
                                  <option value="08">08 - August</option>
                                  <option value="09">09 - September</option>
                                  <option value="10">10 - October</option>
                                  <option value="11">11 - November</option>
                                  <option value="12">12 - December</option>
                                </select>
                            </div>
                            <div class="form-holder" id="expire_y">
                                <select name="expyear" data-threeds="year" id="cardYear" class="required form-control" autocomplete="off" data-error-message="Please select a valid expiry year!" onchange="yearselected()">
                                  <option value="">Year</option>
                                  <option value="24">2024</option>
                                  <option value="25">2025</option>
                                  <option value="26">2026</option>
                                  <option value="27">2027</option>
                                  <option value="28">2028</option>
                                  <option value="29">2029</option>
                                  <option value="30">2030</option>
                                  <option value="31">2031</option>
                                  <option value="32">2032</option>
                                  <option value="33">2033</option>
                                  <option value="34">2034</option>
                                  <option value="35">2035</option>
                                  <option value="36">2036</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-holder" id="cvv">
                            <label>CVV:</label>
                            <input type="tel" name="CVV" id="cc_cvv" class="form-control fcheckout-field required" data-validate="cvv" maxlength="3" placeholder="CVV" autocomplete="off" data-error-message="Please enter a valid CVV code!" onKeyUp="javascript: this.value = this.value.replace(/[^0-9]/g, '');" />
                        </div>
                        <div class="cvv-link left"><a href="javascript:void(0)" style="margin: 30px 0px 0px 17px; display: inline-block;">What is this?</a></div>
                        <div class="clear"></div>
                        <div class="cvv-image" style="display:none;">
							<img alt="" src="assets/images/cvv-image.png" style="margin: 0px 0px 15px !important; width:190px;">
						</div>
                        <div id="rushtop"><input alt="Submit" border="0" class="pulsebutton cformbtn-default btn_pulse" id="cform-submit-btn" name="" src="assets/images/RushButton.jpg" style="width: 100%; outline:none;display:none;" type="image" value="submit"></div>
                                                
                    </div>
					<style>.chkbox {
						width: auto !important;
						height: auto !important;
						appearance: checkbox !important;
						outline: auto !important;
						display: inline !important;
						text-align: center !important;
					}
					</style>
					<!-- <div class="frmCheckElemts">
						<label class="spl-checkbox" style="vertical-align:top;text-align: left;font-size: 14px !important;">
							<input type="checkbox" name="emag_subscription" id="emag_subscription" value="Y" checked="checked" class="chkbox" style="margin:0 !important;">
							As a special gift you will gain access to the <?=$configs->step3_product_name?> today for the discounted rate of only <?=$configs->step3_product_price?> monthly.  For information on this separate enrollment, call any time.</label>
					</div> -->
                </form>
            </div>

            <div class="linebreak" style="margin:15px 0;"></div>
            <div id="content-3">
                <div style="color:#7b0600; font-size:11px; text-align:center;">We care about your privacy.</div>
            </div>
            <div id="top-2">
                <img src="assets/images/godaddyimg.png">
            </div>
            <div class="linebreak" style="margin:15px 0;"></div>
            <div id="top-3">
                <img src="assets/images/safe.png">
            </div>
            <div class="linebreak" style="margin:15px 0;"></div>

   		 <div id="footer">
        	<br>
            <center>
                <ul class="terms-links">
                    <li> <a href="javascript:void(0);" onClick="openNewWindow('../disclosures/privacy.php','modal');">Privacy Policy |</a></li>
                    <li> <a href="javascript:void(0);" onClick="openNewWindow('../disclosures/terms.php','modal');">Terms and Conditions |</a></li>
		                <li><a href="javascript:void(0);" onClick="openNewWindow('../disclosures/wireless.php','modal');">Wireless Policy</a></li>
										
                </ul>
                <br>
                <div class="text-center">
                    <p><?php echo $configs->step_1_name; ?> is committed to maintaining the highest quality products and the utmost integrity in business practices. All products sold on this website are certified by Good Manufacturing Practices (GMP), which is the highest standard of testing in the supplement industry.</p><br><p>Notice: The products and information found on this site are not intended to replace professional medical advice or treatment. These statements have not been evaluated by the Food and Drug Administration. These products are not intended to diagnose, treat, cure or prevent any disease. Individual results may vary.</p>
                </div>
                <br>
            </center>

            <center>
                <div class="text-center">
                    <p class="cop-text">&copy; <script> var date = new Date(); document.write(date.getFullYear()) </script> <span class="product-name"><?php echo $configs->step_1_name; ?></span>. All Rights Reserved.</p>
                    <br>
                </div>
            </center>
        	<p></p>
    	</div>
	</div>
</div>
</div>

<p id="loading-indicator" style="display:none;">Processing...</p>
<p id="crm-response-container" style="display:none;">Limelight messages will appear here...</p>

<div class="loading-screen" style="display:none;">
	<div class="loading-pop">
    	<div class="pop-content">
        	<img src="assets/images/loading.gif" class="loading-img">
        	<ul class="pop-list">
            	<li class="show-1"><img src="assets/images/pop-tik.png"> Checking Inventory</li>
                <li class="show-2"><img src="assets/images/pop-tik.png"> Processing Transaction</li>
                <li class="show-3"><img src="assets/images/pop-tik.png"> Sending to Fulfillment</li>
                <li class="show-4"><img src="assets/images/pop-tik.png"> Order Confirmed</li>
            </ul>
            <div id="grp-progress">
                <div id="progress-bar"><div id="text_bar"></div></div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="assets/js/jquery-3.5.1.min.js"></script> 
<script	type="text/javascript" src="assets/js/scripts.js"></script>
<script type="text/javascript" src="assets/js/jquery.mask.min.js"></script>	
<script src="assets/js/jquery.cardtype.js"></script>
<script src="assets/js/custom.js"></script>
		

<script type="text/javascript">

	$('.bill-inp').click(function(){
		if($(this).prop("checked") == true){
			$('.billing-info').slideUp();
			$('#billShipSame').val("yes");
			$('#hidden-fields').find('input,select').removeClass('required');
			$('#billingSameAsShipping').trigger('change');
		} else {
			$('.billing-info').slideDown();
			$('#billShipSame').val("no");
			$('#hidden-fields').find('input,select').addClass('required');
			$('#billingSameAsShipping').trigger('change');
		}
	});


	$(document).ready(function(){
		$('#cform-submit-btn').show();
	});

	function yearselected(){
        //reset option values
        for (let i = 1; i < 12; i++) {
            if(i<10)document.getElementById("cardMonth").options[i].value = "0"+i;
            else document.getElementById("cardMonth").options[i].value = i;
        }
        var year = document.getElementById("cardYear").value;
        //get current selected option value
        let currentval = $("#cardMonth option:selected" ).val();
        if(year == 24 || year == 2024){
            //get current month value
            const d = new Date();
            let month = d.getMonth();
            if(parseInt(currentval) < (month+1)){
                //$("#cardMonth").prop('selectedIndex', 0);
                $("#cardMonth").removeClass('no-error');
                $("#cardMonth").addClass('has-error');
            }
            //clear expired month option values to trigger error
            for (let i = 1; i < (month+1); i++) {
                document.getElementById("cardMonth").options[i].value = "";
            }
        }else{
            //when year is not current year and a valid option
            //is in place, remomve error
            if(currentval != ""){
                $("#cardMonth").removeClass('has-error');
                $("#cardMonth").addClass('no-error');
            }
        }
    }
	</script> 
<?php if(!empty($_SESSION['partial_pixel_fire']))
	echo $_SESSION['partial_pixel_fire'];
?>
</body>
</html>