/*
Unless otherwise indicated, this code is copyrighted
and cannot be used without permission.

Copyright (C) 2008 by Yakov Shafranovich.
*/

/* 
Client side query parser
Adopted from an example found on the Internet
*/
function parseQuery() {
   // Split the query string
   qsParm = new Array();
   var q = window.location.search.substring(1);
   var parms = q.split('&');
   for (var i=0; i<parms.length; i++) {
      var pos = parms[i].indexOf('=');
  if (pos > 0) {
       var key = parms[i].substring(0,pos);
       var val = parms[i].substring(pos+1);
       qsParm[key] = val;
      }
   }
       
   // Set variables
   query = qsParm['q'];
   if(query) {
     queryUnescaped = unescape(query);
     queryUnescaped = queryUnescaped.replace('+', ' ');
   } else {
     query = '';
     queryUnescaped = '';
   }
}

