function parm_val(fullS,parmS)
//
// Name:	parm_val (source_output)
//
// Date:	7. Marts 1997
//
// Purpose:	This function gets specific data in the searchstring of the URL
//
// Variables:	The first input should be the string to be manipulated (which could
// 		be location.search). The second input should be the part of the
//		string that we're searching for. E.g. we want to know what the user
// 		typed as paramters in this string "?user_typed=ABC". To get ABC as
//		result from the function call it with theese parameters:
//		parm_val(location.search, "user_typed")
//
// Author(s):	Joachim Fuglsang-Frederiksen (JFF), Werner Knudsen (WEK)
//
// History:
// 07-03-97  JFF  Created
// 19-03-97  JFF  Changed for-loops to while, function working as of now
// 19-03-97  JFF  Comments added
// May 1997  WEK  Various changes
// Jun 1997  WEK  Now works with Netscape 2.02
//           WEK  Now handles empty parameters: ?x=&y=5 denotes x empty
//

{

   if ((fullS == "0") || (fullS == ""))
   {
     return "";
   }
   if (parmS == "")
   {
     return fullS.substring(1, fullS.length);
   }

   fullS = fullS + "&";
   var v_fra;
   var v_til;
   var term = "&";
   var flag = 0;
   var del = "";
   var til = 0;

   if (parmS != "" )
   {
     parmS = parmS + "=";
     for (var i=0; i<fullS.length; i++)
     {
        til = i+parmS.length;
        del = fullS.substring(i, til);
        if (del == parmS)
        {
           v_fra = i+parmS.length;
		   flag = 1;
         }
      }
	if (flag == 0) {
	  return "";
	}
      var fra = v_fra;
      var v_til = 0;
      til = fra + term.length;
      del = fullS.substring(fra, til);
      while (del != term)
      {
        ++fra;
        v_til = fra;
        til = fra + term.length;
        del = fullS.substring(fra, til);
      }
      var out = "";
      if (v_til > 0) {
        out = fullS.substring(v_fra, v_til);
      }
      return out;
    }
}

function substPlus(S)
//
// Name:	substPlus (string)
//
// Date:	20. januar 1998
//
// Purpose:	This function substitutes "+" with space

{
   if ((S == "0") || (S == ""))
   {
     return "";
   }

   var nyS = "";

   for (var i=0; i<S.length; i++)
   {
      if (S.substring(i, i+1) == "+")
      {
         nyS = nyS + " ";
      } else {
         nyS = nyS + S.substring(i, i+1);
      }
    }
    return nyS;
}

// Kommandolinie-parametre
var parm = location.search;
// eksempel: var sidenavn = parm_val(parm,"sidenavn");

