Index: /trunk/htdocs/ArchiveScruncher.php
===================================================================
--- /trunk/htdocs/ArchiveScruncher.php	(revision 292)
+++ /trunk/htdocs/ArchiveScruncher.php	(revision 293)
@@ -3,6 +3,6 @@
 
 
-require_once 'File.php';
-require_once 'strutils.php';
+require_once 'Classes/General/File.php';
+require_once 'Utils/strutils.php';
 
 
Index: /trunk/htdocs/TarBuilder.php
===================================================================
--- /trunk/htdocs/TarBuilder.php	(revision 292)
+++ /trunk/htdocs/TarBuilder.php	(revision 293)
@@ -3,5 +3,5 @@
 
 
-require_once 'File.php';
+require_once 'Classes/General/File.php';
 
 
Index: /trunk/htdocs/index.php
===================================================================
--- /trunk/htdocs/index.php	(revision 292)
+++ /trunk/htdocs/index.php	(revision 293)
@@ -1,105 +1,25 @@
-<?php	session_start(); ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html>
 <?php
- // index.php
- // Matthew Whiting Nov 2007
- // From the original by Albert Teoh 
- // 
- // The opening page for the ATNF Pulsar Data Archive
- // system. Used to search for observation archive
- // files.
- 
- // BEGIN Javascript for expansion blocks 
- // Thanks to: 
- // http://assn9.blogspot.com/ 
- // Douglas Bowman
- // URL:      www.stopdesign.com
- // Used in: http://www.bloggerforum.com/modules/newbb/viewtopic.php?topic_id=8725&forum=6
- // Date:     26 Feb 2004
- // 
-
-?>
-<head>
-<link rel="stylesheet" type="text/css" href="styles/opal.css" />
-<link rel="stylesheet" type="text/css" href="styles/style.css" />
-<link rel="stylesheet" type="text/css" href="styles/query.css" />
-<link rel="stylesheet" type="text/css" href="styles/results.css" />
-<link rel="stylesheet" type="text/css" href="styles/atnf.css" />
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8759-1" />
-<meta name="DC.Creator" lang="en" content="personalName=Teoh,Albert" />
-<meta name="ATNF.Maintainer" content="contactName=Webmaster,the" />
-<meta name="DC.Title.alt" lang="en" content="" />
-<meta name="DC.Subject" lang="en" content="pulsar" />
-<meta name="DC.Description" lang="en" content="Searches the data archives at the ATNF" />
-<meta name="DC.Date.created" scheme="ISO8601" content="2002-12-12" />
-<meta name="ATNF.Site" content="Marsfield" />
-<meta name="ATNF.AccessPermission" content="Public" />
-    <meta name="ATNF.MetaVersion" content="1.0" />
-    
-    <script type="text/javascript" src="scripts/atnf-oo-utils.js"></script>
-    <script type="text/javascript" src="scripts/atnf-string-utils.js"></script>
-    <script type="text/javascript" src="scripts/atnf-dom-utils.js"></script>
-    <script type="text/javascript" src="scripts/atnf-validation.js"></script>
-    <script type="text/javascript" src="scripts/atoa-query.js"></script>
-    <script type="text/javascript" src="scripts/tooltips.js"></script>
-
-<!--
-   <script type="text/javascript" src="scripts/atnf-dom-utils.js"></script>
-   <script type="text/javascript" src="scripts/atoa-query.js"></script>
-   <script type="text/javascript" src="scripts/process.js"></script>
--->
-
-
-<script type="text/javascript" language="javascript1.2">
-
-
-
-function togglecomments (id1,id2) {
-
-		var obj1 = document.getElementById(id1);
-		var obj2 = document.getElementById(id2);
-		(obj1.className=="commentshown") ? obj1.className="commenthidden" : obj1.className="commentshown"; 
-		(obj1.className=="commentshown") ? obj2.innerHTML="<< Hide" : obj2.innerHTML="Show all >>"; 
-
-}
-
-function checkAll(objName, FormName, FieldName ) {
-
-	var obj = document.getElementsByName(objName);
-	var CheckValue = obj[0].checked;
-
-	if(!document.forms[FormName])
-		return;
-	var objCheckBoxes = document.forms[FormName].elements[FieldName];
-	if(!objCheckBoxes)
-		return;
-	var countCheckBoxes = objCheckBoxes.length;
-	if(!countCheckBoxes)
-		objCheckBoxes.checked = CheckValue;
-	else
-		// set the check value for all check boxes
-		for(var i = 0; i < countCheckBoxes; i++)
-			objCheckBoxes[i].checked = CheckValue;
-}
-
-function updateSelectAll(objId, allId) {
-	var obj = document.getElementById(objId);
-	var allCheckbox = document.getElementById(allId);	
-	
-	if (!objId.checked && allCheckbox.checked) {
-		allCheckbox.checked = false;
-	}
-		
-		
-}
-</script>
-
-</head>
-
-<title>ATNF Pulsar Data Archive Home</title>
-
-<!-- Start Content -->
-<?php
-	
+// index.php
+// Matthew Whiting Nov 2007
+// From the original by Albert Teoh 
+// 
+// The opening page for the ATNF Pulsar Data Archive
+// system. Used to search for observation archive
+// files.
+
+// BEGIN Javascript for expansion blocks 
+// Thanks to: 
+// http://assn9.blogspot.com/ 
+// Douglas Bowman
+// URL:      www.stopdesign.com
+// Used in: http://www.bloggerforum.com/modules/newbb/viewtopic.php?topic_id=8725&forum=6
+// Date:     26 Feb 2004
+
+
+
+session_start();
+
+
+
 require_once 'constants.php';
 require_once 'security.php';
@@ -109,4 +29,163 @@
 
 include 'header.html';
+
+
+
+function OutputHeader()
+{
+  echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html>';
+  echo '<head>';
+  echo '<link rel="stylesheet" type="text/css" href="styles/opal.css" />';
+  echo '<link rel="stylesheet" type="text/css" href="styles/style.css" />';
+  echo '<link rel="stylesheet" type="text/css" href="styles/query.css" />';
+  echo '<link rel="stylesheet" type="text/css" href="styles/results.css" />';
+  echo '<link rel="stylesheet" type="text/css" href="styles/atnf.css" />';
+  echo '<meta http-equiv="Content-Type" content="text/html; charset=iso-8759-1" />';
+  echo '<meta name="DC.Creator" lang="en" content="personalName=Teoh,Albert" />';
+  echo '<meta name="ATNF.Maintainer" content="contactName=Webmaster,the" />';
+  echo '<meta name="DC.Title.alt" lang="en" content="" />';
+  echo '<meta name="DC.Subject" lang="en" content="pulsar" />';
+  echo '<meta name="DC.Description" lang="en" content="Searches the data archives at the ATNF" />';
+  echo '<meta name="DC.Date.created" scheme="ISO8601" content="2002-12-12" />';
+  echo '<meta name="ATNF.Site" content="Marsfield" />';
+  echo '<meta name="ATNF.AccessPermission" content="Public" />';
+  echo '<meta name="ATNF.MetaVersion" content="1.0" />';
+
+  echo '<script type="text/javascript" src="scripts/atnf-oo-utils.js"></script>';
+  echo '<script type="text/javascript" src="scripts/atnf-string-utils.js"></script>';
+  echo '<script type="text/javascript" src="scripts/atnf-dom-utils.js"></script>';
+  echo '<script type="text/javascript" src="scripts/atnf-validation.js"></script>';
+  echo '<script type="text/javascript" src="scripts/atoa-query.js"></script>';
+  echo '<script type="text/javascript" src="scripts/tooltips.js"></script>';
+  echo '<script type="text/javascript" src="scripts/pulsarvo.js"></script>';
+
+//    <script type="text/javascript" src="scripts/atnf-dom-utils.js"></script>
+//    <script type="text/javascript" src="scripts/atoa-query.js"></script>
+//    <script type="text/javascript" src="scripts/process.js"></script>
+
+  echo '</head>';
+  echo '<title>ATNF Pulsar Data Archive Home</title>';
+}
+
+
+
+function OutputLoginForm()
+{
+  global $_SERVER;
+  
+  echo '<body class="front_page">';
+
+  echo '<div class="bodycontents">';
+
+  echo '<h1>The ATNF Pulsar Data Archive</h1>';
+
+  echo '<p>The ATNF Pulsar Data Archive provides access to pulsar observations';
+  echo 'made with the Parkes radio Telescope. Data older than <b>';
+  echo '<?php echo PROPRIETRY_PERIOD_MONTH ?> months</b> is';
+  echo 'publicly available, and can be accessed by simply providing your email';
+  echo 'address. More recent data is proprietry, and can only be accessed by';
+  echo 'those who were involved in the proposal. We plan to do this via the';
+  echo '<a href="http://opal.atnf.csiro.au">OPAL system</a>, but this is';
+  echo 'currently not enabled. In the interim, those who have previously';
+  echo 'obtained a login for the Data Archive can use that option below';
+  echo '(making sure to check the "Data Archive login" button!). </p>';
+
+  echo '<p>A <a href="pulsar_archive_guide.html">Users Guide</a> to the archive is available.</p> ';
+
+  echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST">';
+  echo '<table width="700" style="border: 0px;">';
+
+  echo '<tr>';
+  echo '<td><input type="radio" name="authenticateType" checked value="anon">Non-proprietry access<br> ';
+  echo '<table class="login" width="500" style="border: 0px;">'; 
+  echo '<tr>';
+  echo '<td class="form_field">Email: </td>';
+  echo '<td><input type="text" name="email"></td>';
+  echo '</tr>';
+  echo '</table>';
+  echo '<br>';
+  echo '</td>';
+  echo '</tr>';
+
+  echo '<tr>';
+
+  echo '<td><input type="radio" name="authenticateType" value="opal">Data Archive login<br>';
+  echo '<table class="login" width="500" style="border: 0px;">';
+  echo '<tr><td class="form_field">Username: </td><td><input type="text" name="opalEmail"></td></tr>';
+  echo '<tr><td class="form_field">Password: </td><td><input type="password" name="opalPassword"></td></tr>';
+  echo '</table>';
+  echo '<br>';
+  echo '</td>';
+  echo '</tr>';
+
+  echo '<tr>';
+  echo '<td><input type="submit" value="Login" name="action"><input type="reset" value="Reset"></td>';
+  echo '</tr>';
+  echo '</table>';
+
+  echo '</form>';
+}
+
+
+
+function OutputQueryFormHeader( $min_date_text, $max_date_text )
+{
+  global $PHP_SELF;
+  
+  echo '<body class="atoa">';
+  echo '<div class="bodycontents">';
+
+  echo '<h1>ATNF Pulsar Data Archive</h1>';
+
+  echo '<p>This archive provides access to pulsar observations taken at the Parkes radio telescope between the dates of ';
+  echo '<b>' . $min_date_text . '</b> and <b>' . $max_date_text . '</b>.</p>';
+
+  echo '<p>See the Users Guide link for more details. </p>';
+
+  echo '<table width="700" style="border: 0px;">';
+  echo '<tr align="center">';
+  echo '<td>';
+  echo '<a class="top_menu" href="' . $PHP_SELF . '?command=logout">Logout</a>';
+  echo '<!--a href="login?_action=logout">Logout</a-->';
+
+  echo '</td>';
+  echo '<td>';
+  echo '<a href="#" onClick="toggleInstructions();return false;">Instructions</a>';
+  echo '</td>';
+  echo '<td size="30">';
+  echo '&nbsp;';
+  echo '</td>';
+  echo '<td>';
+  echo '<a href="pulsar_archive_guide.html">Users Guide</a>';
+  echo '</td>';
+  echo '</tr>';
+
+  echo '</table>';
+
+  echo '<div id="divInstructions" style="display:none" >';
+  echo '<dl class="top">';
+  echo '<h2>Instructions</h2>';
+  echo '<i>To hide, click "Instructions" again. </i>';
+  echo '<dt> Display Parameters </dt>';
+  echo '<dd> Check the fields you want shown in the results table. Suggested columns are checked by default</dd>';
+  echo '<dd> The results can be ordered by one of the parameters in the "Order By" drop-down list</dd>';
+  echo '<dt> Coordinates </dt>';
+  echo '<dd> The sky position can be specified by a Pulsar name or a RA/Dec position. ';
+  echo 'The pulsar name takes precedence. The search radius must be given. </dd>'; 
+  echo '<dt> Filter Options </dt>';
+  echo '<dd> Results can be limited to observations just from a particular project - use the Project ID box</dd>';
+  echo '<dd> The date range can be specified - the defaults are the range of dates in the archive.</dd>';
+  echo '<dd> Either timing data (particular pulsar) or survey data can be specified. Or both! </dd> ';
+  echo '<dd> The type of instrument can be specified. Default is any type.</dd>';
+  echo '<dd> More than one frequency band can be specified.';
+  echo '<dt> Display Other </dt>';
+  echo '<dd> Calibraton observations taken within a given time period of the queried observations can also be shown and downloaded. Check the box to do so, and specify the time interval. </dd> ';
+  echo '</dl>';
+  echo '</div>';
+}
+
+
+
+OutputHeader();
 
 
@@ -122,34 +201,27 @@
 // set some form defaults
 
-$radius = 60;
-$bandname = Array();
-$cals = 'cals';
-$cals_within_mins = 30;
-$orderDir = 'asc';
-
-
-if( isset($_SESSION['pulsar_name']) ) $pulsar_name = $_SESSION['pulsar_name'];
-if( isset($_SESSION['project_id']) )  $project_id = $_SESSION['project_id'];
-if( isset($_SESSION['obs_mode']) )  $obs_mode = $_SESSION['obs_mode'];
-if( isset($_SESSION['data_type']) )  $data_type = $_SESSION['data_type'];
-if( isset($_SESSION['orderBy']) )  $orderBy = $_SESSION['orderBy'];
-if( isset($_SESSION['orderDir']) ) $orderDir = $_SESSION['orderDir'];
-if( isset($_SESSION['survey']) )  $survey = $_SESSION['survey'];
-if( isset($_SESSION['rahour']) )  $rahour = $_SESSION['rahour'];
-if( isset($_SESSION['ramin']) )  $ramin = $_SESSION['ramin'];
-if( isset($_SESSION['rasec']) )  $rasec = $_SESSION['rasec'];
-if( isset($_SESSION['decdeg']) )  $decdeg = $_SESSION['decdeg'];
-if( isset($_SESSION['decmin']) )  $decmin = $_SESSION['decmin'];
-if( isset($_SESSION['decsec']) )  $decsec = $_SESSION['decsec'];
-if( isset($_SESSION['radius']) )  $radius = $_SESSION['radius'];
-if( isset($_SESSION['bandname']) )  $bandname = $_SESSION['bandname'];
-if( isset($_SESSION['from_day']) )  $from_day = $_SESSION['from_day'];
-if( isset($_SESSION['from_month']) ) $from_month = $_SESSION['from_month'];
-if( isset($_SESSION['from_year']) )  $from_year = $_SESSION['from_year'];
-if( isset($_SESSION['to_day']) )  $to_day = $_SESSION['to_day'];
-if( isset($_SESSION['to_month']) )  $to_month = $_SESSION['to_month'];
-if( isset($_SESSION['to_year']) )  $to_year = $_SESSION['to_year'];
-if( isset($_SESSION['cals_within_mins']) ) $cals_within_mins = $_SESSION['cals_within_mins'];
-if( isset($_SESSION['cals']) ) $cals = $_SESSION['cals'];
+isset($_SESSION['pulsar_name']) ? $pulsar_name = $_SESSION['pulsar_name'] : $pulsar_name = '';
+isset($_SESSION['project_id']) ? $project_id = $_SESSION['project_id'] : $project_id = '';
+isset($_SESSION['obs_mode']) ? $obs_mode = $_SESSION['obs_mode'] : $obs_mode = '';
+isset($_SESSION['data_type']) ? $data_type = $_SESSION['data_type'] : $data_type = '';
+isset($_SESSION['orderBy']) ? $orderBy = $_SESSION['orderBy'] : $orderBy = '';
+isset($_SESSION['orderDir']) ?$orderDir = $_SESSION['orderDir'] : $orderDir = 'asc';
+isset($_SESSION['survey']) ? $survey = $_SESSION['survey'] : $survey = '';
+isset($_SESSION['rahour']) ? $rahour = $_SESSION['rahour'] : $rahour = '';
+isset($_SESSION['ramin']) ? $ramin = $_SESSION['ramin'] : $ramin = '';
+isset($_SESSION['rasec']) ? $rasec = $_SESSION['rasec'] : $rasec = '';
+isset($_SESSION['decdeg']) ? $decdeg = $_SESSION['decdeg'] : $decdeg = '';
+isset($_SESSION['decmin']) ? $decmin = $_SESSION['decmin'] : $decmin = '';
+isset($_SESSION['decsec']) ? $decsec = $_SESSION['decsec'] : $decsec = '';
+isset($_SESSION['radius']) ? $radius = $_SESSION['radius'] : $radius = 60;
+isset($_SESSION['bandname']) ? $bandname = $_SESSION['bandname'] : $bandname = Array();
+isset($_SESSION['from_day']) ? $from_day = $_SESSION['from_day'] : $from_day = '';
+isset($_SESSION['from_month']) ?$from_month = $_SESSION['from_month'] : $from_month = '';
+isset($_SESSION['from_year']) ? $from_year = $_SESSION['from_year'] : $from_year = '';
+isset($_SESSION['to_day']) ? $to_day = $_SESSION['to_day'] : $to_day = '';
+isset($_SESSION['to_month']) ? $to_month = $_SESSION['to_month'] : $to_month = '';
+isset($_SESSION['to_year']) ? $to_year = $_SESSION['to_year'] : $to_year = '';
+isset($_SESSION['cals_within_mins']) ? $cals_within_mins = $_SESSION['cals_within_mins'] : $cals_within_mins = 30;
+isset($_SESSION['cals']) ? $cals = $_SESSION['cals'] : $cals = 'cals';
 
 
@@ -282,96 +354,58 @@
     $_SESSION = array();
   }
-}
-
-// If the user hasn't logged in before or if the previous
-// session's authentication wasn't successful
-// Then use the submitted username and password
-if (!isset($_SESSION['auth_code']) || $_SESSION['auth_code'] != OK) {
-  // 	$username = $HTTP_POST_VARS["username"];
-// 	$password = $HTTP_POST_VARS["password"];
-  $username = $HTTP_POST_VARS["opalEmail"];
-  $password = $HTTP_POST_VARS["opalPassword"];
-  $type = $HTTP_POST_VARS['authenticateType'];
-  if($type == "anon"){
-    $username = $HTTP_POST_VARS["email"];
-    $auth_code = OK;
-    logger_login( $username, 'Anonymous', 'success' );
+  if ($command == 'Login') {
+    echo 'we are logging in';
+    exit;
   }
-  else{
-    $auth_code = authenticate($username, $password);
-    if( $auth_code == OK )
-      logger_login( $username, 'Opal', 'success' );
+}
+
+
+// if we have already authenticated
+//   use our stored authentication details
+// otherwise
+//   if we have received a login attempt
+//     process it
+
+$auth_code = false;
+if( isset( $_SESSION['auth_code'] ) && $_SESSION['auth_code'] == OK )
+{
+  $auth_code = $_SESSION['auth_code'];
+  $username = $_SESSION['username'];
+}
+else
+{
+  if( isset( $HTTP_POST_VARS['action'] ) && $HTTP_POST_VARS['action'] == 'Login' )
+  {
+    $username = $HTTP_POST_VARS["opalEmail"];
+    $password = $HTTP_POST_VARS["opalPassword"];
+    $type = $HTTP_POST_VARS['authenticateType'];
+    if($type == "anon"){
+      $username = $HTTP_POST_VARS["email"];
+      $auth_code = OK;
+      logger_login( $username, 'Anonymous', 'success' );
+    }
     else
-      logger_login( $username, 'Opal', 'failure' );
-    //$auth_code = newAuthenticate();
+    {
+      $auth_code = authenticate($username, $password);
+      if( $auth_code == OK )
+        logger_login( $username, 'Opal', 'success' );
+      else
+        logger_login( $username, 'Opal', 'failure' );
+      //$auth_code = newAuthenticate();
+    }
   }
 }
-else {
-	$auth_code = $_SESSION['auth_code'];
-	$username = $_SESSION['username'];
-}
 
 // Initial state where no username or password supplied OR bad login state
-if ($auth_code != OK) { ?>
-  <body class="front_page">
-
-
-<div class="bodycontents">
-
-<h1>The ATNF Pulsar Data Archive</h1>
-
-<p>The ATNF Pulsar Data Archive provides access to pulsar observations
-made with the Parkes radio Telescope. Data older than <b>
-<?php echo PROPRIETRY_PERIOD_MONTH ?> months</b> is
-publicly available, and can be accessed by simply providing your email
-address. More recent data is proprietry, and can only be accessed by
-those who were involved in the proposal. We plan to do this via the
-<a href="http://opal.atnf.csiro.au">OPAL system</a>, but this is
-currently not enabled. In the interim, those who have previously
-obtained a login for the Data Archive can use that option below
-(making sure to check the "Data Archive login" button!). </p>
-
-<p>A <a href="pulsar_archive_guide.html">Users Guide</a> to the archive is available.</p> 
-
-<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
-<table width="700" style="border: 0px;">
-
-  <tr>
-    <td><input type="radio" name="authenticateType" checked value="anon">Non-proprietry access<br> 
-      <table class="login" width="500" style="border: 0px;"> 
-	<tr>
-	  <td class="form_field">Email: </td>
-	  <td><input type="text" name="email"></td>
-	</tr>
-      </table>
-      <br>
-    </td>
-  </tr>
-  
-  <tr>
-
-    <td><input type="radio" name="authenticateType" value="opal">Data Archive login<br>
-      <table class="login" width="500" style="border: 0px;">
-	<tr><td class="form_field">Username: </td><td><input type="text" name="opalEmail"></td></tr>
-	<tr><td class="form_field">Password: </td><td><input type="password" name="opalPassword"></td></tr>
-      </table>
-      <br>
-    </td>
-  </tr>
-  
-  <tr>
-    <td><input type="submit" value="Login"><input type="reset" value="Reset"></td>
-  </tr>
-</table>
-
-</form>
-
-
-<?php } else { 
+if ($auth_code != OK) {
+
+OutputLoginForm();
+
+} else { 
 	$_SESSION['username'] = $username;
 	$_SESSION['auth_code'] = $auth_code;
 	$_SESSION['logintype'] = $HTTP_POST_VARS['authenticateType'];
 
-	$actions = $HTTP_GET_VARS['actions'];
+        isset( $HTTP_GET_VARS['actions'] ) ? $actions = $HTTP_GET_VARS['actions'] : $actions = Array();
 	
 	if ($actions == "new_query") {
@@ -381,60 +415,8 @@
 	  //		$date_error = "You are only authorised to access data > 18 months old";
 	}
+        
+        OutputQueryFormHeader( $min_date_text, $max_date_text );
+        
 ?>
-<body class="atoa">
-    <div class="bodycontents">
-
-    <h1>ATNF Pulsar Data Archive</h1>
-
-    <p>This archive provides access to pulsar observations taken at the Parkes radio telescope between the dates of <b><?php echo $min_date_text."</b> and <b>".$max_date_text?></b>.</p>
-    <?php 
-    // TODO - This code needs to be replaced with opal based code
-// // //    if (!atnf_staff($_SESSION['username'])) {
-// // //      //if($_SESSION['logintype']=="anon") {
-// // //      echo "<p>Note that you do not have access to data more recent than <b>".$prop_date_text."</b>.</p>\n"; 
-// // //    }?>
-<p>See the Users Guide link for more details. </p>
-    
-    <table width="700" style="border: 0px;">
-    <tr align="center">
-    <td>
-    <a class="top_menu" href="<?php echo $PHP_SELF; ?>?command=logout">Logout</a>
-    <!--a href="login?_action=logout">Logout</a-->
-
-    </td>
-	<td>
-	<a href="#" onClick="toggleInstructions();return false;">Instructions</a>
-	</td>
-	<td size="30">
-	&nbsp;
-    </td>
-	<td>
-	<a href="pulsar_archive_guide.html">Users Guide</a>
-	</td>
-	</tr>
-
-	</table>
-
-	<div id="divInstructions" style="display:none" >
-	  <dl class="top">
-	    <h2>Instructions</h2>
-	<i>To hide, click "Instructions" again. </i>
-	      <dt> Display Parameters </dt>
-                <dd> Check the fields you want shown in the results table. Suggested columns are checked by default</dd>
-                <dd> The results can be ordered by one of the parameters in the "Order By" drop-down list</dd>
-	      <dt> Coordinates </dt>
-	        <dd> The sky position can be specified by a Pulsar name or a RA/Dec position. 
-	              The pulsar name takes precedence. The search radius must be given. </dd> 
-	      <dt> Filter Options </dt>
-                <dd> Results can be limited to observations just from a particular project - use the Project ID box</dd>
-	        <dd> The date range can be specified - the defaults are the range of dates in the archive.</dd>
-         	<dd> Either timing data (particular pulsar) or survey data can be specified. Or both! </dd> 
-	        <dd> The type of instrument can be specified. Default is any type.</dd>
-                <dd> More than one frequency band can be specified.
-	      <dt> Display Other </dt>
-	<dd> Calibraton observations taken within a given time period of the queried observations can also be shown and downloaded. Check the box to do so, and specify the time interval. </dd> 
-	    </dl>
-	</div>
-
 
 
@@ -473,4 +455,6 @@
 				<?php
 				foreach ($fields as $field) {
+                                                                                if( isset( $field_names[$field['Field']] ) )
+                                                                                {
 				  echo "<input
 onClick=\"updateSelectAll('".$field['Field']."', '$all_params_id')\" type=\"checkbox\" name=\"params[]\" value=\"".$field['Field']."\" id=\"".$field['Field']."\"";
@@ -478,4 +462,5 @@
 				    echo ' checked="true"';
 				  echo " >".$field_names[$field['Field']]."<br>\n";
+                                                                                }
 				}
 				?>
@@ -571,5 +556,5 @@
 			    for ($i = 1; $i <= 31; $i++) {
 			      echo "\t\t\t<option";
-			      if ($i == $from_day || $from_day == '' && $i == minDay) { echo " selected"; }
+			      if ($i == $from_day || $from_day == '' && $i == $minDay) { echo " selected"; }
 			      echo " value=\"$i\">$i</option>\n";
 			    }
@@ -581,6 +566,6 @@
 				for ($i = 1; $i <= 12; $i++) {
 				  echo "\t\t\t<option";
-				  $month = $monthlist[abbrevmonths][$i];
-				  if ($i == $from_month || $from_month == '' && $i == minMonth) { echo " selected"; }
+				  $month = $monthlist['abbrevmonths'][$i];
+				  if ($i == $from_month || $from_month == '' && $i == $minMonth) { echo " selected"; }
 				  echo " value=\"$i\">$month</option>\n";
 				}
@@ -592,5 +577,5 @@
 				      for ($i = $minYear; $i <= $maxYear; $i++) {
 					echo "\t\t\t<option";
-					if ($i == $from_year || $from_year == '' && $i == minYear ) { echo " selected"; }
+					if ($i == $from_year || $from_year == '' && $i == $minYear ) { echo " selected"; }
 				  echo " value=\"$i\">$i</option>\n";
 				}
@@ -612,5 +597,5 @@
 			    for ($i = 1; $i <= 12; $i++) {
 			      echo "\t\t\t<option";
-			      $month = $monthlist[abbrevmonths][$i];
+			      $month = $monthlist['abbrevmonths'][$i];
 			      if ($i == $to_month || $to_month == '' && $i == $maxMonth) { echo " selected"; }
 			      echo " value=\"$i\">$month</option>\n";
Index: /trunk/htdocs/logger.php
===================================================================
--- /trunk/htdocs/logger.php	(revision 292)
+++ /trunk/htdocs/logger.php	(revision 293)
@@ -1,5 +1,4 @@
 <?php	
 
-  session_start();
 
   // logger.php
Index: /trunk/htdocs/query.php
===================================================================
--- /trunk/htdocs/query.php	(revision 292)
+++ /trunk/htdocs/query.php	(revision 293)
@@ -13,5 +13,5 @@
 require_once 'MysqlDB.php';
 require_once 'ArchiveScruncher.php';
-require_once 'strutils.php';
+require_once 'Utils/strutils.php';
 
 
Index: /trunk/htdocs/utils.php
===================================================================
--- /trunk/htdocs/utils.php	(revision 292)
+++ /trunk/htdocs/utils.php	(revision 293)
@@ -1,3 +1,3 @@
-<?php session_start(); 
+<?php
 
 // A set of commonly used functions
@@ -7,5 +7,5 @@
 include_once 'constants.php';
 include_once 'MysqlDB.php';
-require_once 'File.php';
+require_once 'Classes/General/File.php';
 require_once 'ArchiveScruncher.php';
 require_once 'TarBuilder.php';
@@ -41,5 +41,6 @@
 		
   }
-  else {
+  else if(isset( $_SESSION['$param_name'] ) )
+  {
     $param = $_SESSION[$param_name];
   }
Index: /trunk/htdocs/view_profiles.php
===================================================================
--- /trunk/htdocs/view_profiles.php	(revision 292)
+++ /trunk/htdocs/view_profiles.php	(revision 293)
@@ -1,4 +1,2 @@
-<?php	session_start(); ?>
-
 <html>
 <body>
