function switchLanguage()
{
var newLanguage=document.lang.langselect.options[document.lang.langselect.selectedIndex].value;
var thisPage=window.location.href;
var pos=thisPage.lastIndexOf("lang=");
if (pos>0)  
  { // already set, just replace the language
	thisPage=thisPage.substring(0,pos+5)+newLanguage+thisPage.substring(pos+7);
	routeTo(thisPage)
  }
  else
  {  //  not set, add it
	pos2=thisPage.indexOf("?");
	var connector='&';
	if (pos2<=0)
	  connector='?';
	thisPage=thisPage+connector+"lang="+newLanguage;
	routeTo(thisPage)
  }
 }

function dataLanguage()
{
var newLanguage="LL";
if (document.datalang.datalanguage.checked)
 newLanguage="EN";
var thisPage=window.location.href;
var pos=thisPage.lastIndexOf("datalng=");
if (pos>0)  
  { // already set, just replace the language
	thisPage=thisPage.substring(0,pos+8)+newLanguage+thisPage.substring(pos+10);
	routeTo(thisPage)
  }
  else
  {  //  not set, add it
	pos2=thisPage.indexOf("?");
	var connector='&';
	if (pos2<=0)
	  connector='?';
	thisPage=thisPage+connector+"datalng="+newLanguage;
	routeTo(thisPage)
  }
 }

 
function routeTo(newPage, sExtraAction)
{
if (document.getElementById("actiontab"))
  {
  document.main.actiontab.value=newPage;
  if (sExtraAction!=null)
   if (sExtraAction.length>0)
     eval(sExtraAction);
  document.main.action=newPage;
  document.main.submit();
  }
else
  {
  window.location=newPage;
  }
return true;
}


function doHelp()
{

var thisPage=window.location.href;
if (thisPage.indexOf("/main.jsp")>0)
  window.location="/DesInventar/help/main.jsp"
else if (thisPage.indexOf("/results.jsp")>0)
  window.location="/DesInventar/help/results.jsp"
else 
    window.location="/DesInventar/help/main.jsp";
}
