<?php
	include_once("initialize.php");
	include("top.php");
?>


<?php

	$ENVIRONMENT = "production";

	$latestVersion = "0.0.0";
	$latestVersionInfo = Array();
	$directoryName = "./downloads/WarBird";

	$directory = dir($directoryName);
	while (false !== ($file = $directory->read()))
	{
		if ($file != "." && $file != "..")
	   	{
	   		$version = str_replace("_", ".", str_replace("WarBird_", "", str_replace(".exe", "", $file)));
	   		if (strcmp($latestVersion, $version) < 0)
	   		{
	   			$latestVersion = $version;
	   			$releaseDate = date("F j, Y", filemtime($directoryName . "/" .$file));
	   			$fileSize = filesize($directoryName . "/" .$file);
	   			$latestVersionInfo = Array("version" => $version, "filename" => $file, "releaseDate" => $releaseDate, "fileSize" => $fileSize);
	   		}
	   	}
	}

?>
									<!-- main content -->
									<table border="0" cellspacing="0" cellpadding="5" width="100%">
										<tr>
											<td class="pageTitleText" nowrap="true" valign="top">
												Purchase
											</td>
										</tr>
										<tr>
											<td class="mainContent" colspan="3" width="100%">

												<table border="0" cellspacing="0" cellpadding="0" width="100%">
													<tr>
														<td>

															<table border="0" cellpadding="0" cellspacing="0" width="100%">
																<tr>
																	<td colspan="2" valign="top"><img src="images/warBirdLogo.gif"></td>
																	<td rowspan="2" valign="top" width="210">
																		<table border="0" cellspacing="0" cellpadding="0" width="100%">
																			<tr>
																				<td><img src="images/yellowBoxTop.gif"></td>
																			</tr>
																			<tr>
																				<td background="images/yellowBoxBackground.gif" style="padding-left: 5px; padding-right: 5px;">

																					<table border="0" cellspacing="0" cellpadding="0" width="100%">
																						<tr>
																							<td style="padding: 5px 5px 5px 5px;" valign="top"><a href="downloads/WarBird/WarBird_<?php echo str_replace('.', '_', $latestVersionInfo['version']); ?>.exe" class="downloadText">Get WarBird</a></td>
																							<td align="left" rowspan="3" valign="middle"><img src="images/downArrow.gif"></td>
																						</tr>
																						<tr>
																							<td style="font-size:8pt; padding-left:5px">WarBird <?php echo $latestVersionInfo['version']; ?> for Windows XP with WMP 7.0 and higher</td>
																						</tr>
																					</table>

																				</td>
																			</tr>
																			<tr>
																				<td><img src="images/yellowBoxBottom.gif"></td>
																			</tr>
																		</table>

																		<br>

																		<table border="0" cellspacing="0" cellpadding="0" width="100%">
																			<tr>
																				<td><img src="images/grayBoxTop.gif"></td>
																			</tr>
																			<tr>
																				<td background="images/grayBoxBackground.gif" style="padding-left: 5px; padding-right: 5px;">
																					<h2 class="subHeadingText">Support</h2>
																					<ul>
																						<li><a href="support.php">Get support for WarBird</a></li>
																					</ul>
																				</td>
																			</tr>
																			<tr>
																				<td><img src="images/grayBoxBottom.gif"></td>
																			</tr>
																		</table>

																		<br>

																		<table border="0" cellspacing="0" cellpadding="0" width="100%">
																			<tr>
																				<td><img src="images/grayBoxTop.gif"></td>
																			</tr>
																			<tr>
																				<td background="images/grayBoxBackground.gif" style="padding-left: 5px; padding-right: 5px;">
																					<h2 class="subHeadingText">Contact</h2>
																					<ul>
																						<li><a href="contact.php">Contact Xenolutions</a></li>
																					</ul>
																				</td>
																			</tr>
																			<tr>
																				<td><img src="images/grayBoxBottom.gif"></td>
																			</tr>
																		</table>
																	</td>

																</tr>
																<tr>
																	<td class="indentedText" style="margin-left:30px; padding-top:15px;">


																		<?php if ($_REQUEST['complete'] == "true") 	{ ?>

																			<h2 class="subHeadingText" style="margin-top:15px">Thank you for your payment.</h2>
																			<ul>
																				<li>Your transaction has been completed, and a receipt for your purchase has been emailed to you.</li>
																				<li>You may log into your account at <a href="http://www.paypal.com">www.paypal.com</a> to view details of this transaction.</li>
																			</ul>

																			<h2 class="subHeadingText" style="margin-top:15px">Download Product Key</h2>
																			<ul>
																				<li>Please click <a href="generateKey.php">here</a> to download the key to "unlock" WarBird.</li>
																				<li>When prompted, save the license.dat file to your WarBird installation directory (C:\Program Files\WarBird).</li>
																			</ul><br>


																		<?php } else { ?>

																			<center>

																			<?php if (@$ENVIRONMENT == "test" || @$_REQUEST["environment"] == "test") { ?>

																				<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
																				<input type="hidden" name="business" value="test@thisisatest.com">

																			<?php } else { ?>

																				<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
																				<input type="hidden" name="business" value="payments@xenolutions.com">

																			<?php } ?>

																				<input type="hidden" name="cmd" value="_xclick">
																				<input type="hidden" name="item_name" value="WarBird v<?php echo $latestVersionInfo['version']; ?>">
																				<input type="hidden" name="item_number" value="warbird_<?php echo str_replace('.', '_', $latestVersionInfo['version']); ?>">
																				<input type="hidden" name="amount" value="9.95">
																				<input type="hidden" name="currency_code" value="USD">
																				<input type="hidden" name="bn" value="PP-BuyNowBF">
																				<input type="hidden" name="return" value="http://www.xenolutions.com/new/purchase.php?complete=true">

																				<table bgcolor="#336699" border="0" cellspacing="1" cellpadding="0" width="80%">
																					<tr>
																						<td>
																							<table bgcolor="#FFFFFF" border="0" cellspacing="0" cellpadding="5" width="100%">
																								<tr bgcolor="#336699" style="color:#FFFFFF; font-weight:bold">
																									<td>Product</td>
																									<td>Version</td>
																									<td>Unit Price</td>
																									<td>Order</td>
																								</tr>
																								<tr>
																									<td>WarBird</td>
																									<td><?php echo $latestVersionInfo['version']; ?></td>
																									<td>$9.95</td>
																									<td><input type="submit" name="order" value="Order" /></td>
																								</tr>
																							</table>

																						</td>
																					</tr>
																				</table>

																			</form>

																			</center>

																			<div style="padding-left:47px; padding-right:10px">
																				<h2 class="subHeadingText">Offer Details:</h2>
																				<ul>
																					<li>One unit = one licensed user.</li>
																					<li>Includes free one year of the customer support package.</li>
																					<li>Full 30 days money-back guarantee according to our return policy.</li>
																					<li>Electronic delivery of license keys.</li>
																				</ul>
																			</div>

																		<?php } ?>

																	</td>
																</tr>
															</table>

														</td>
													</tr>
												</table>

											</td>
										</tr>
									</table>


<?php include("bottom.php"); ?>