<?require ("global.php");?>
<?

$userID = 0;
if (isset($_COOKIE['userID'])) { $userID = $_COOKIE['userID']; }
else { header("Location: /tick/login.html"); }

$stageID = 0;
if (isset($_COOKIE['stageID'])) { $stageID = $_COOKIE['stageID']; }
else { header("Location: /tick/stages.php"); }

$query = "SELECT events.name as event_name, stages.* FROM events, stages WHERE events.ID = stages.eventID AND stages.ID = $stageID AND events.userID = $userID";
$result = mysql_query($query, $db);

if ($result)
{
    while ($r = mysql_fetch_array($result))
    {
	$event_name = $r['event_name'];
	$name = $r['name'];
	$popup_link = $r['popup_link'];
	$popup_text = $r['popup_text'];
	$popup_position = $r['popup_position'];
    }
}
mysql_free_result($result);

?>

<html>
<head>
<title>OneTicker :: Popup</title>
<link rel=stylesheet type="text/css" href="tick.css">
<script src="banner.js" type="text/javascript"></script>
</head>

<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4>

<script type="text/javascript">banner(8);</script>

<form name="popup" action="popup_update.php" method="post">
<input type="hidden" name="stageID" value="<? echo $stageID ?>">

<table border=0 cellspacing=2 cellpadding=2 width=640>
<tr><td><div class=text>&nbsp;</div></td></tr>


<tr>
<td><div class=text><span class=smtext>link name</span>
<br><input class=blacktext type=text name="popup_link" value="<? echo $popup_link; ?>" size=50 maxlength=300></td>
</tr>

<tr>
<td ><div class=blacktext><span class=smtext>popup window contents (HTML)</span>
<br><textarea class=blacktext name="popup_text" cols=66 rows=12 wrap="virtual"><? echo $popup_text; ?></textarea>
</div></td>
</tr>

<tr>
<td><div class=text><span class=smtext>position</span>
<br><select name="popup_position" class=blacktext>
<option value="notes"<? if ($popup_position == 'notes') { echo " selected"; } ?>>end of notes</option>
<option value="stages"<? if ($popup_position == 'stages') { echo " selected"; } ?>>stages section</option>
</select>
</div></td>
</tr>

<tr><td colspan=2><div class=text>&nbsp;</div></td></tr>

<tr>
<td colspan="2" align=center>
<input class=boldtext type="submit" name="submit" value="update popup for <? echo "$event_name $name"; ?>"></td>
</tr>

</table>
</form>

</body>
</html>
