/*
New code Added to display Calender 08/27/08
*/

   
    var url = window.location.href;
var queryString = url.replace(/^[^\?]+\??/,'');
var params = parseQuery( queryString );
function parseQuery ( query ) {
   var Params1 = new Object ();
   if ( ! query ) 
   {
   return Params1; // return empty object
   }
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) continue;
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params1[key] = val;
   }
   return Params1;
}








/*
  Code from "Developing Featherweight Web Services with JavaScript"
      http://feather.elektrum.org/
  (c)An Elektrum Press, retain this notice
      License: http://feather.elektrum.org/appendix/licenses.html
*/

// Args object library -------------------------------------------

// constructor ------------------------
function Args () {
  var caller = this._findCaller();
  var qString = caller.src.replace(/^[^\?]+\??/,'');
  if ( qString ) {
     this._queryString = qString;
     this._parseArgs();
  }
}

// -----------------------------------
Args.prototype._parseArgs = function () {
   if ( ! this._queryString ) return false;
   var Pairs = this._queryString.split(/;/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal.length == 2 ) continue;
      if ( ! ( KeyVal[0] || KeyVal[1] ) ) continue;
      if ( KeyVal[0].match(/^_/) ) continue;
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      val = val.replace(/&/g, '&amp;');
      val = val.replace(/>/g, '&gt;');
      val = val.replace(/</g, '&lt;');
      this[key] = val;
   }
}

// -----------------------------------
Args.prototype.getKeys = function () {
  var keys = new Object();
  for ( var attr in this ) {
    if ( attr.match(/^(_|getKeys)/) ) continue;
    keys[attr] = undefined;
  }
  return keys;
}

// a cache for use inside _findCaller()
if ( ! Args._SeenScriptCache ) Args._SeenScriptCache = new Array();
// -----------------------------------
Args.prototype._findCaller = function () {
  var scripts = document.getElementsByTagName('script');
  for ( var i = scripts.length - 1; i >= 0; i-- ) {
    var src = scripts[i].src;

    var rx = new RegExp(/^http:\/\/elektrum.org/i);
    if ( ! src.match(rx) ) continue; // ignore other sites' scripts

    if ( src.match(/^[^\?]+\?/) && ! Args._SeenScriptCache[i] ) {
      Args._SeenScriptCache[i] = 1;
      return scripts[i];
    }
    else
    {
      Args._SeenScriptCache[i] = 1; // mark it seen anyway
    }
  }
  // none has a query string, so default to most recently seen
  return scripts[ scripts.length - 1 ];
}

