var qsParm = new Array();
qsParm['id'] = "";
qsParm['ID'] = "";

function qs() {
	var query = window.location.search.substring(1);
	var parms = query.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;
      }
   }
}


function SetCookie(sName, sValue) {
  //date = new Date();
  //document.cookie = sName + "=" + escape(sValue) + "; expires=" + date.toGMTString() + "; path=/;";
  document.cookie=sName +"="+ sValue;
}


function GetCookie(sName){
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0])
      return unescape(aCrumb[1]);
  }

  // a cookie with the requested name does not exist
  return null;
}

qs();

if( qsParm['id'].length > 0 )
{
  // we are going to overwrite the old cookie.
  SetCookie("id", qsParm['id']);
}

if( qsParm['ID'].length > 0 )
{
  // we are going to overwrite the old cookie.
  SetCookie("id", qsParm['ID']);
}
