<?
include_once('hdr_general.php');
/* **************************************************************************************************** */
if (!isset($_REQUEST["module"])) $_REQUEST["module"] = "general";
if (!isset($_REQUEST["task"])) $_REQUEST["task"] = "main";
$pubmodule = $_REQUEST["module"];
$pubtask = $_REQUEST["task"];
$pubitemid = $_REQUEST["itemid"];
/* **************************************************************************************************** */
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="css/general.css" type="text/css" media=all>
<title>CS-SECURE : Select Seed URL</title>

<script type="text/javascript">
function updateSelect(seedurl) {
  opener.document.frm_search.crawlseedurl.value = seedurl;	//.replace(/~/g,'"');
  self.close();
  //return false;
}

function cancelSelect() {
  self.close();
}

function switch_selection() {
  var mysel = document.getElementById('seedoption');
  var myopt = mysel.value;
  if (myopt=="1") {
    document.getElementById('div1').style.cssText="display: block;";
    document.getElementById('div2').style.cssText="display: none;";
    document.getElementById('div3').style.cssText="display: none;";
    document.getElementById('div4').style.cssText="display: none;";
    document.getElementById('div5').style.cssText="display: none;";
    document.getElementById('cancel').value="Cancel";
  } else if (myopt=="2") {
    document.getElementById('div1').style.cssText="display: none;";
    document.getElementById('div2').style.cssText="display: block;";
    document.getElementById('div3').style.cssText="display: none;";
    document.getElementById('div4').style.cssText="display: none;";
    document.getElementById('div5').style.cssText="display: none;";
    document.getElementById('cancel').value="Cancel";
  } else if (myopt=="3") {
    document.getElementById('div1').style.cssText="display: none;";
    document.getElementById('div2').style.cssText="display: none;";
    document.getElementById('div3').style.cssText="display: block;";
    document.getElementById('div4').style.cssText="display: none;";
    document.getElementById('div5').style.cssText="display: none;";
    document.getElementById('cancel').value="Cancel";
  } else if (myopt=="4") {
    document.getElementById('div1').style.cssText="display: none;";
    document.getElementById('div2').style.cssText="display: none;";
    document.getElementById('div3').style.cssText="display: none;";
    document.getElementById('div4').style.cssText="display: block;";
    document.getElementById('div5').style.cssText="display: none;";
    document.getElementById('cancel').value="Cancel";
  } else if (myopt=="5") {
    document.getElementById('div1').style.cssText="display: none;";
    document.getElementById('div2').style.cssText="display: none;";
    document.getElementById('div3').style.cssText="display: none;";
    document.getElementById('div4').style.cssText="display: none;";
    document.getElementById('div5').style.cssText="display: block;";
    document.getElementById('cancel').value="&nbsp;OK&nbsp;";
  }
}

</script>

</head>
<body leftmargin=5 topmargin=5 style="background: #dddddd;">
<table border=0 cellspacing=0 cellpadding=0 width=460>

<tr valign=top>
<td valign=top width=100%>

  <table border=1 cellspacing=1 cellpadding=2 width=460>
  <tr valign=top>
  <td valign=top width=120 class=formlabel>Option</td>
  <td valign=top width=340 class=listcontent>
  <select name="seedoption" id="seedoption" onChange="javascript:switch_selection();">
  <option value="1">Designated Seed URLs</option>
  <option value="2">Popular Web Directories</option>
  <option value="3">Previously Crawled URLs</option>
  <option value="4">High-Relevance URLs</option>
  <option value="5">Random Seed URL</option>
  </select>
  </td>
  </tr>
  </table>

  <div name="div1" id="div1" style="display: block;">
  <table border=1 cellspacing=1 cellpadding=2 width=460>
  <tr valign=top>
  <td valign=top width=30 class=listheader>No</td>
  <td valign=top width=405 class=listheader>URL</td>
  <td valign=top width=25 class=listheader>&nbsp;</td>
  </tr>
  <?
  $myno=0;
  $myquery="Select * from crawl_seeds order by seed_url";
  $myresult =& $db->query($myquery);
  $mycount=$myresult->numRows();
  if ($mycount!=0) {
    while($myrow=$myresult->fetchRow()) {
      $myno++;
      ?>
      <tr valign=top>
      <td valign=top width=30 class=listnumber><?=$myno;?></td>
      <td valign=top width=405 class=listcontent><?=substr($myrow['seed_url'],0,40)."..";?></td>
      <td valign=top width=25 class=listcontent><button name="select" id="select" onClick="updateSelect('<?=$myrow['seed_url'];?>');">&nbsp;›&nbsp;</button></td>
      </tr>
      <?
    }
  }
  ?>
  </table>
  </div>

  <div name="div2" id="div2" style="display: none;">
  <table border=1 cellspacing=1 cellpadding=2 width=460>
  <tr valign=top>
  <td valign=top width=30 class=listheader>No</td>
  <td valign=top width=405 class=listheader>URL</td>
  <td valign=top width=25 class=listheader>&nbsp;</td>
  </tr>
  <tr valign=top>
  <td valign=top width=30 class=listnumber>1</td>
  <td valign=top width=405 class=listcontent>http://www.altavista.com</td>
  <td valign=top width=25 class=listcontent><button name="select" id="select" onClick="updateSelect('http://www.altavista.com');">&nbsp;›&nbsp;</button></td>
  </tr>
  <tr valign=top>
  <td valign=top width=30 class=listnumber>2</td>
  <td valign=top width=405 class=listcontent>http://www.excite.com</td>
  <td valign=top width=25 class=listcontent><button name="select" id="select" onClick="updateSelect('http://www.excite.com');">&nbsp;›&nbsp;</button></td>
  </tr>
  <tr valign=top>
  <td valign=top width=30 class=listnumber>3</td>
  <td valign=top width=405 class=listcontent>http://www.google.com</td>
  <td valign=top width=25 class=listcontent><button name="select" id="select" onClick="updateSelect('http://www.google.com');">&nbsp;›&nbsp;</button></td>
  </tr>
  <tr valign=top>
  <td valign=top width=30 class=listnumber>4</td>
  <td valign=top width=405 class=listcontent>http://www.hotbot.com</td>
  <td valign=top width=25 class=listcontent><button name="select" id="select" onClick="updateSelect('http://www.hotbot.com');">&nbsp;›&nbsp;</button></td>
  </tr>
  <tr valign=top>
  <td valign=top width=30 class=listnumber>5</td>
  <td valign=top width=405 class=listcontent>http://www.infoseek.com</td>
  <td valign=top width=25 class=listcontent><button name="select" id="select" onClick="updateSelect('http://www.infoseek.com');">&nbsp;›&nbsp;</button></td>
  </tr>
  <tr valign=top>
  <td valign=top width=30 class=listnumber>6</td>
  <td valign=top width=405 class=listcontent>http://www.lycos.com</td>
  <td valign=top width=25 class=listcontent><button name="select" id="select" onClick="updateSelect('http://www.lycos.com');">&nbsp;›&nbsp;</button></td>
  </tr>
  <tr valign=top>
  <td valign=top width=30 class=listnumber>7</td>
  <td valign=top width=405 class=listcontent>http://www.webcrawler.com</td>
  <td valign=top width=25 class=listcontent><button name="select" id="select" onClick="updateSelect('http://www.webcrawler.com');">&nbsp;›&nbsp;</button></td>
  </tr>
  </table>
  </div>

  <div name="div3" id="div3" style="display: none;">
  <table border=1 cellspacing=1 cellpadding=2 width=460>
  <tr valign=top>
  <td valign=top width=30 class=listheader>No</td>
  <td valign=top width=405 class=listheader>URL</td>
  <td valign=top width=25 class=listheader>&nbsp;</td>
  </tr>
  <?
  $myno=0;
  $myquery="Select * from crawl_result order by crawl_url limit 0,7";
  $myresult =& $db->query($myquery);
  $mycount=$myresult->numRows();
  if ($mycount!=0) {
    while($myrow=$myresult->fetchRow()) {
      $myno++;
      ?>
      <tr valign=top>
      <td valign=top width=30 class=listnumber><?=$myno;?></td>
      <td valign=top width=405 class=listcontent><?=substr($myrow['crawl_url'],0,40)."..";?></td>
      <td valign=top width=25 class=listcontent><button name="select" id="select" onClick="updateSelect('<?=$myrow['crawl_url'];?>');">&nbsp;›&nbsp;</button></td>
      </tr>
      <?
    }
  }
  ?>
  </table>
  </div>

  <div name="div4" id="div4" style="display: none;">
  </div>

  <div name="div5" id="div5" style="display: none;">
  <table border=1 cellspacing=1 cellpadding=2 width=460>
  <tr valign=top>
  <td valign=top width=460 class=listcontent>
  <font color="#0000ff"><b><i>* A random Seed URL will be selected based on previous crawls!</i></b></font>
  </td>
  </tr>
  </table>
  </div>

  <table border=1 cellspacing=1 cellpadding=2 width=460>
  <tr valign=top>
  <td valign=top width=460 class=listcontent>
  <button name="cancel" id="cancel" onClick="cancelSelect();">Cancel</button>
  </td>
  </tr>
  </table>

</td>
</tr>
</table>

</body>
</html>