<?php
include("config.inc.php");

print <<<HERE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>

body { 
    height:100% 
}
divL {
    height: 100%;
}
.style1{
	color: #000000;
	font-size:13px;
	font-family: Arial, Geneva, sans-serif;
	
}
.style2{
	color: #000000;
	font-weight: bold;
	font-size:16px;
	font-family: Arial, Geneva, sans-serif;
	
}
.style3{
	color: #FF0000;
	font-weight: bold;
	font-size:14px;
	font-family: Arial, Geneva, sans-serif;
}

.ft-sect{
	color: #000000;
	font-size:12px;
	font-family: Arial, Geneva, sans-serif;
	text-decoration:none;
}
.ft-sect a{
	color: #000000;
	margin-left:5px;
	margin-right:5px;
}
.ft-sect a:hover{
	color: #000000;
	text-decoration:underline;
}
</style>


<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript">

function SaveChanges() {

	var formvalidate = validateForm();
	
	if (formvalidate) { 
		document.license_form.action="LicenseAction.php?actionmode=activate";
		document.license_form.submit();
	}

}

function validateForm() {
    var x=document.license_form;
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
    if (x.companyname.value == "") {
        alert("Company name should be filled.");
		x.companyname.focus();
        return false;
    }
	else if (x.licenseno.value == "") {
        alert("License no should be filled.");
		x.licenseno.focus();
        return false;
    }
	else if (x.email.value == "") {
        alert("Email address should be filled.");
		x.email.focus();
        return false;
    }
	else if (x.telephoneno.value == "" && x.mobile.value == "") {
        alert("Telephone or Mobile should be filled.");
		x.telephoneno.focus();
        return false;
    }
	else if (x.country.value == "") {
        alert("Country should be filled.");
		x.country.focus();
        return false;
    }
	else if (!filter.test(x.email.value)) {
		alert('Please provide a valid email address.');
		x.email.focus();
		return false;
	}   

	return true;
    	
}

</script>

<title>Activate License</title>
</head>
<body style='margin:0px;' bgcolor="#026E8B" >
<form  enctype="multipart/form-data"  id='license_form' name='license_form' method='post' >

HERE;


echo "
<div style='position:absolute;margin-right:5%;margin-left:5%;background-color:#F2F2F2;min-height:100%;width:90%;' >
	<div style='position:relative;float:left;width:309px;border:0px solid black;'  >
		<div style='position:relative;float:left;height:258px;width:309px;border:0px solid black;'  >
			<img src='license-img/leftpanel.png' width='309px' height='258px' border='0' alt='logo'>
		</div>
	</div>
	<div style='position:relative;float:right;width:70%;background-color:#F2F2F2;border:0px solid black;'  >";

echo "<table border='0' cellpadding='0' cellspacing='0' style='table-layout:fixed;'>";
echo "
	<tr height='40px'> 
		<td valign='center' align='left' colspan='2' style='border-bottom:1px #CCC solid;'><span class='style2'>License Activation</span></td>
	</tr>";
	
if ($_GET['error']	!= "") {
	echo "<tr><td valign='center' align='center' colspan='2' ><span class='style3'>".$_GET['error']."</span></td></tr>";
}

echo "
	<tr height='30px'> 
		<td valign='center' align='right' width='150px' style='padding-top:10px;'><span class='style1'>Company Name&nbsp;</span></td>
		<td align='left' width='300px' style='padding-top:10px;'><input type='text' name='companyname' id='companyname' value='".$_POST['companyname']."' maxlength='100' style='font-size:14px; width:200px; height:18px;' /></td>
	</tr>
	<tr height='30px'>
		<td valign='center' align='right' width='150px'><span class='style1'>License No&nbsp;</span></td>
		<td align='left' width='300px'><input type='text' name='licenseno' id='licenseno' value='".$_POST['licenseno']."' maxlength='16' style='font-size:14px; width:200px; height:18px;' /></td>
	</tr>
	<tr height='30px'>
		<td valign='center' align='right' width='150px'><span class='style1'>First Name&nbsp;</span></td>
		<td align='left' width='300px'><input type='text' name='firstname' id='firstname' value='".$_POST['firstname']."' maxlength='60' style='font-size:14px; width:200px; height:18px;' /></td>
	</tr>
	<tr height='30px'>
		<td valign='center' align='right' width='150px'><span class='style1'>Father Name&nbsp;</span></td>
		<td align='left' width='300px'><input type='text' name='fathername' id='fathername' value='".$_POST['fathername']."' maxlength='60' style='font-size:14px; width:200px; height:18px;' /></td>
	</tr>
	<tr height='30px'>
		<td valign='center' align='right' width='150px'><span class='style1'>Family Name&nbsp;</span></td>
		<td align='left' width='300px'><input type='text' name='familyname' id='familyname' value='".$_POST['familyname']."' maxlength='60' style='font-size:14px; width:200px; height:18px;' /></td>
	</tr>
	<tr height='30px'>
		<td valign='center' align='right' width='150px'><span class='style1'>Email&nbsp;</span></td>
		<td align='left' width='300px'><input type='text' name='email' id='email' value='".$_POST['email']."' maxlength='60' style='font-size:14px; width:200px; height:18px;' /></td>
	</tr>
	<tr height='30px'>
		<td valign='center' align='right' width='150px'><span class='style1'>Telephone&nbsp;</span></td>
		<td align='left' width='300px'><input type='text' name='telephoneno' id='telephoneno' value='".$_POST['telephoneno']."' maxlength='20' style='font-size:14px; width:130px; height:18px;' /></td>
	</tr>
	<tr height='30px'>
		<td valign='center' align='right' width='150px'><span class='style1'>Mobile&nbsp;</span></td>
		<td align='left' width='300px'><input type='text' name='mobile' id='mobile' value='".$_POST['mobile']."' maxlength='20' style='font-size:14px; width:130px; height:18px;' /></td>
	</tr>
	<tr height='30px'>
		<td valign='center' align='right' width='150px'><span class='style1'>Country&nbsp;</span></td>
		<td align='left' width='300px'>
			<select name='country' id='country' style='font-size:14px; width:200px; height:23px;'>
				<option value='' selected='selected'>select one</option>";
				
			foreach($config['CountryList'] as $list=>$list_value)
			{
				echo "<option value='" . $list . "'>" . $list_value . "</option>";
			}	
				
echo"		</select>
		</td>
	</tr>
	<tr>
		<td valign='center' align='right' width='150px'><span class='style1'>Address&nbsp;</span></td>
		<td align='left' width='300px'><textarea rows='4' cols='50' name='address' id='address' style='font-size:14px;' >".$_POST['address']."</textarea></td>
	</tr>
	<tr height='35px'><td valign='center' align='right' colspan='2'>&nbsp;</td></tr>
	<tr>
		<td colspan='2' align='right' >
			<button type='button' id='btnPost' name='btnPost' onclick='SaveChanges(); return false;' title='Submit Data'><span><span>Activate</span></span></button>
			<button type='reset' id='btnReset' name='btnReset'><span><span>Reset</span></span></button>
		</td>
	</tr>
	</table>";

echo "
	</div>
</div>";	



print <<< HERE
</form>
</body>
<html>
HERE;
?>	