﻿// JScript File
/****************************************************************
//retVal function returns the value of the query string parameter
//that is named as the parameter sName
//-------------------------------------------------------------**/
function retVal(sName){
  /* get last loc. of ?
     right: find first loc. of sName+2
     retrieve value before next &
  */
  
  var sURL = new String(window.location);
  var iQMark= sURL.lastIndexOf('?');
  var iLensName=sName.length;
  
  //retrieve loc. of sName
  var iStart = sURL.indexOf('?' + sName +'=') //limitation 1
  if (iStart==-1)
        {//not found at start
        iStart = sURL.indexOf('&' + sName +'=')//limitation 1
		if (iStart==-1)
		   {//not found at end
		    return 0; //not found
		   }   
        }
        
  iStart = iStart + + iLensName + 2;
  var iTemp= sURL.indexOf('&',iStart); //next pair start
  if (iTemp ==-1)
		{//EOF
		iTemp=sURL.length;
		}  
  var tempString =  sURL.slice(iStart,iTemp ) ;
  
  // replace all the %20 s in the Query String with spaces using a regular expression
  var re = new RegExp ('%20', 'gi') ;
  tempString = tempString.replace(re,' ');
  return tempString;
  sURL=null;//destroy String
  tempString = null;
}
