<?php session_start();  //Developed by ITechScripts
error_reporting(0);
require 'include/announcements.php'; // ITECHBIDS Configuration File
require 'include/itechbids.php'; // Server compatibility Patch
if(empty($_SESSION[userid]))
{
 echo '<meta http-equiv="refresh" content="0;url=signin.php?url=watchlist.php&productid='.$productid.'">';
 echo "<font size=+1 color=#003366>$lang_676....</font>"; 
 exit();
}
?>
<script language="javascript">
function selectall()
 {
	len=document.watch_form.len.value;
	if(len==1)
	 {
	if(document.watch_form.chkMain.checked==true) 
				document.watch_form.chkbox.checked=true;
		if(document.watch_form.chkMain.checked==false)
			document.watch_form.chkbox.checked=false;
	}
		else
	 {
		for(i=0;i<len;i++)
		 {
	if(document.watch_form.chkMain.checked==true)
			document.watch_form.chkbox[i].checked=true;
		if(document.watch_form.chkMain.checked==false)
			document.watch_form.chkbox[i].checked=false;     
			  				}
	}
	
}
function del()
{
var where_to= confirm("Are You Sure You Want to delete the item[s]?");
if (where_to== true)
 {
document.watch_form.delete1.value="del";
document.watch_form.submit();
  }
else
 {
  window.location="watchlist.php";
  document.watch_form.submit();
  }

}
function com()
{
document.watch_form.action="compare.php";
document.watch_form.submit();
}
function delete_all()
{
var where_to= confirm("Are U Sure U Want to delete all the items?");
if(where_to==true)
 {
document.watch_form.delete1.value="all";
document.watch_form.action="watchlist.php";
document.watch_form.submit();
   }
else
 {
  window.location="watchlist.php";
  document.watch_form.submit();
  }
}
function watch_all()
{
//document.watch_form.delete1.value="all";
document.watch_form.action="watchall.php";
document.watch_form.submit();
}
</script>
<body >
<? 

//require'include/datemanu.php'; 
$user_id=$_SESSION[userid];
$mode=$_GET[delete1];
if($mode=="all")
{
 $del="delete from watch_list ";
 mysql_query($del);

 $dis_all=$err_2;
}
if($mode=="del")
{
  $items=$_GET[chkbox];
  $count=count($items);
  if($count!=0)
   {
   foreach($items as $item)
    {
$del="delete from watch_list where productid=".$item;
mysql_query($del);
$conf=$err_32;
    }
	echo '<meta http-equiv="refresh" content"=0; url=watchlist.php">';
    //exit();
   }
  else // if($count!=0)
  {
  $war=$err_33;

  }
// }  
}
$watch_sql="select * from watch_list where user_id=$user_id";
$watch=mysql_query($watch_sql);
$wat_total=mysql_num_rows($watch);
require 'themes/watchlist.tpl';
?>
