<!DOCTYPE html>
<!-- 
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
 -->
<html lang="en">

<head>
    <meta charset="utf-8">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- 
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" href="style.css">
    <script src="script.js"></script>
-->
	<style type="text/css">
		.picture img {
			width: 800px;
		}
	
		.picture {
			display: block;
			text-align: center;
		}

<? if ($_GET['card'] === '0' || $_GET['card'] === 0) { ?>
		* {color: #fff;}
<? } ?>
<? if ($_GET['card'] === '3' || $_GET['card'] === 3) { ?>


		.to:before {
			content: "<? echo $_GET['to'] ?>";
		}

		.to {
			position: absolute;
			text-align: center;
			font-size: 80%;
			top: 46px;
			width: 100%;
		}


		.from:before {
			content: "<? echo $_GET['from'] ?>";
		}

		.from {
			position: absolute;
			text-align: center;
			font-size: 80%;
			top: 73px;
			width: 100%;
		}

		.cardid {
			position: absolute;
			text-align: center;
			font-size: 200%;
			top: 235px;
			width: 140%;
		}
		.cardlabel {
			position: absolute;
			text-align: center;
			font-size: 210%;
			top: 140px;
			width: 100%;
		}

<? } else { ?>
		.cardid {
			position: absolute;
			text-align: center;
		    font-size: 180%;
		    top: 395px;
			width: 100%;
		}
		.cardlabel {
			position: absolute;
			text-align: center;
			font-size: 210%;
			top: 450px;
			width: 100%;
		}

<? } ?>
/*		.cardid {
		    position: absolute;
		    text-align: center;
		    font-size: 300%;
		    top: 545px;
		    width: 100%;
		}
		.cardlabel {
		    position: absolute;
		    text-align: center;
		    font-size: 400%;
		    top: 625px;
		    width: 100%;
		}
*/





		#header {
			display: block;
			text-align: center;
		}
		.messagearea {
			display: block;
			text-align: center;
			margin-top: 200px;
			font-size: 150%;
		}

	</style>
    <title>Gift Certificate</title>
</head>

<body>
	<?
    	$valid = false;
    	$error = 'Unspecified Error';

    	if (isset($_GET['id'])) {
		    include('_functions2.php');
		    $check = transferCheck($_GET['id']);

		    if (strlen($check) > 30) {
		    	$valid = false;
		    	$error = 'This gift card has been transfered.';
		        
		    } else {
		    	$cert = certificatePrint($_GET['id']);
		    	if (sizeof($cert)) {
			    	if ($cert[0]['used']) {
				    	$valid = false;
				    	$error = 'This gift card has been used.';
			    	} elseif ($cert[0]['del']) {
				    	$valid = false;
				    	$error = 'This gift card has been deleted.';
			    	} else {
			    		$valid = true;
			    	}

		    	} else {
			    	$valid = false;
			    	$error = 'This gift card has been deleted.';
		    	}
		                              
		    }

    	} else {
	    	$valid = false;
	    	$error = 'Missing ID';
	    	$check = '';
    	}

	?>
<!-- 
	<nav style="text-align: center;">
		<div id="home">home</div>
	</nav>
-->
    <div id='main'>
		<? if ($valid) { ?>


    		<div class='picture'>
    		<? if ($_GET['card'] === '1' || $_GET['card'] === 1) { ?>
    			<img src="images/print_gold_card.jpg">
    		<? } else if ($_GET['card'] === '3' || $_GET['card'] === 3) { ?>
    			<img src="images/print_new_card.jpg">

    		<? 	} else { ?>
    			<img src="images/print_black_card.jpg">
    		<? } ?>
    		</div>
    	<div id='content' style="text-align: center;">
    	</div>
    	<div class="cardid">#<? echo $cert[0]['label']; ?></div>
    	<div class="cardlabel"><? echo $cert[0]['dvalue']; ?></div>
    	<div class="to"></div>
    	<div class="from"></div>

    	<? } else { ?>
    		<div id="header">
    			<img src="images/logo.jpg" id="logo" alt="" />
    		</div>
    		<div class="messagearea">
    			<div class="error">There is an issue with this eGift Card. 
    				<br /> 
    				<br /> 
    				If you feel that you have reached this message in error, please contact Signature&nbsp;Massage&nbsp;&amp;&nbsp;Facial&nbsp;Spa&nbsp;at&nbsp;813&#8209;925&#8209;8898 
    				<br />
    				<br />
    				Our apologies for any inconvenience.
    			</div>
    				<br />
    				<br />
    			<div class="specificerror">Error: <? echo $error; ?></div>
    		</div>
    	<? } ?>
    </div>


    <script type="text/javascript">




    	appName = {}
		appName.form = {
			record: 0,
			guid: '',
		    one: function() {
				$.post(
				    "file.php", {
				        'id': 0
				    },
				    function(data) {
				    	appName.form.two(data)
				    }
				);
				// appName.form.one();
		    }, //==============================================
		    two: function(data) {
		    	console.log(data);
				// appName.form.two();
		    } //==============================================
		}
    </script>

</body>

</html>
