<?
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
include('auth.php');
include('common.php');

$d = $_GET['d'];


if (count($_POST) > 0) //form has been submitted by user
{
	if ($_FILES["ufile"]["error"] > 0)
	{
		echo "Error: " . $_FILES["ufile"]["error"] . "<br />";
	}
	else
	{
			unlink("forms/".$_DOCSNAMES[$d]);
			move_uploaded_file($_FILES["ufile"]["tmp_name"], "forms/".$_DOCSNAMES[$d] );
			$do_close=true;
	}

}

?>
<head>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/llnb-style.css">
</head>

<style type="text/css">
body { background-color: #fff; background-image:none; padding: 20px;}

div { font-family: sans-serif; color: #222; }

.btn	{ -moz-border-radius: 7px; -webkit-border-radius: 7px; -khtml-border-radius: 7px; border-radius: 7px; border: 1px #222 solid; background-image: url(img/btn-bg-nor.jpg) ; line-height: 25px; padding: 3px 10px 0; text-decoration: none; color: #222; }
.btn:hover	{ border-color: #33C; color: #33c;}

.btnhidden {border-color: #CCC; background-image: none; font-size: .8em;}

.btncnt	{ width: 160px; text-align:center; display: block; margin-bottom: 10px;}

.btnlrg	{width: 300px; padding-left: 20px;}
.btnsml	{ padding: 1px 10px; font-weight: bold;}
.btnpg	{ padding: 2px 4px 1px; font-size: .75em;margin-right: 4px;}

.lfr	{ float: right; margin-right: 10px;}
.lfl	{ float: left; margin-right: 10px;}
form label { display:block; margin-top: 10px; font-size: .8em; color: #555; }
.session { margin-bottom: 15px; padding-bottom: 10px;}
.talrg	{ width: 460px; height: 60px;}

</style>

<body onLoad="document.forms.upload.datafile.focus()">

<? 
if ($do_close) 
	echo "<script>parent.location.href='setting_overview.php';</script>"; 

?>



<div style="width: 275px;">
<h2><?=$_DOCSNAMES_USR_DISPLAY[$d];?></h2>

<form name="upload" action="setting_upload_m.php?d=<?=$d;?>" method="post"  enctype="multipart/form-data" >

<div class="input">
<label>Current version of <?=$_DOCSNAMES_USR_DISPLAY[$d];?></label>
        <div class="input btn btndownload plusleft">
        	<a href="forms/<?=$_DOCSNAMES[$d];?>" target="_blank" class="smalllink">
        	<img src="img/pdficon_large.png" alt="PDF file" width="32" height="32" align="left"><?=$_DOCSNAMES_USR_DISPLAY[$d];?>
        	<br>form Download.</a>
        </div>
        
        <div style="clear:both;"></div>



<label>Select file to upload:</label>
	<input type="file" name="ufile" size="40">
	<input type="hidden" name="stub" value="123">
</div>

<div style="clear:both;"></div>

<p class="clearfix">
<input type="submit" class="btnlfr_m" value="Save &amp; Close">
<a href="#" onclick="parent.SqueezeBox.close();"class="btn lfr">Cancel</a></p>

</form>
</div>