<?
	include("head.php");
	include("../include/db.inc.php");
	include("../include/pager.php");
	$db1=new db;
    $db1->open();mysql_query("SET NAMES 'utf8'");

	if($_SESSION['uid']=='' || $_SESSION['pwd']=='')
	{
		//header("location:login.php");
	}
	
	$hid=$_GET['hotid'];
	 //$hid=3;
	 $del=$_POST['delete'];
	 $len=sizeof($del);
	
	 if(isset($_POST['save']))
{
	
	for($x=0;$x<$len;$x++)
	{
	$q="delete from hotspot_img where id='$del[$x]'";
	mysql_query($q);
	}
  	$q3="update hotspot_img set def='1' where id='$_POST[default]'";
	$q4="update hotspot_img set def='0' where id!='$_POST[default]' and hotid='$hid'";
	mysql_query($q3);
	mysql_query($q4);
		
}


	
	  $sql="select id,img,def from hotspot_img where hotid='$hid'";
      $num=mysql_num_rows(mysql_query($sql));
	  $res11=mysql_query(dopaging($sql,10));

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Hotspots for the site</title>

<style>
.a1{color:#000000}
a:hover {text-decoration: none; color:#000000}
.style3 {
	font-family: "Times New Roman", Times, serif;
	font-size: 24px;
	font-style: italic;
	color: #FFFFFF;
}
</style>


<body bgcolor="#ffffff">
<div class="admin_wrapper">
<div class="logo_show"><? include("minorlogout.php");?></div>
<div style="float:left; width:200px">
<div class="topg_links_show"><? include("left.php");	?></div>
<div class="top_links_show"><? include("belowleft1.php");	?></div></div>
<div style="float:left; width:800px">
<div class="maximum">

<!-- ImageReady Slices (apanel.psd) -->

<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
	
	<tr>
		<td  width="15%"  >
		<!--Start Left Panel-->
		
		<?
			include("left.php");
		?>
		<!--End Left Panel-->
		
		</td>
		<td  width="85%" >
		<!--Start Main Body-->
			 
			 <div align="center" style="margin-right:30px"><a href="img_hotspot.php?hotid=<?=$hid?>">Add photos</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?=rightpaging();?></div>
			 <br>
<form action="" name="caption1" method="post">

<div style="margin-left:70px"><table width="62%" border="0" cellspacing="0" cellpadding="0">
<?
 while($row=mysql_fetch_array($res11)) {?>
	
  <tr>
    <td><img src="../hotspot/<?=$row['img']?>" width="100" height="80"><br>&nbsp;</td>
	<td>
	<table border="0" cellpadding="2" cellspacing="2" width="150px" bgcolor="#E6F2FF">
	  <tr bgcolor="#FFFFFF">	  
	    <td><input type="radio" name="default"  value="<?=$row['id']?>" <? if($row['def']==1)echo"checked";?>/></td>
        <td>Set As Default</td>
	  </tr>
	  <tr bgcolor="#FFFFFF">
	    <td><input type="checkbox" name="delete[]" value="<?=$row['id']?>"></td>
		<td>Delete this photo.</td>
	  </tr>
	 </table>	
	<br>
	</td>
  </tr>
  
  <? }
  if($num>0){
  ?>
   <tr height="30px">
   <td colspan="2" valign="middle"><div align="center">
     <input name="save" type="submit" class="inputsubmit" value="Save Changes">
   </div></td>
  </tr>
  <? }
  else { ?>
  <tr>
   <td colspan="2" align="center"><br /><strong class="normaltextblack">Sorry ! There is no photo for editing, please upload first.</strong></td>
  </tr>
  <? }?>
</table>
</div>
</form>
		<!--End Main Body--></td>
	</tr>
	
	
</table>
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::center ends:::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::footer starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->

</div></div>
<div class="bottom_links_show"><? include("footer.php");	?></div>
</div>
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::footer ends:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
</body>
</html>




