// lu, 03.09.2003: auslesen eines tokens mit trennzeichen und tokennummer angabe
// tokennr beginnt bei null
function split(_str, _char, tokennr)
 {
 var sRet="";
 var i=0;
 var iFound=-1;
 var iCount=0;
 while (i < _str.length && i != -1)
  {
  i = _str.indexOf (_char, i)
  if (iCount == tokennr || (i==-1 && iFound != -1))
   {
   sRet=_str.substring(iFound+_char.length, i)
   break;
   }
  if (i != -1) 
   {
   iCount=iCount+1;
   iFound = i;
   }
  if(i!= -1) i=i+1;
  }
 return sRet;
 }

function convertAdress(_str) {
	var strTxt=_str;
	if (strTxt=="" || strTxt==null) return strTxt;
	strTxt=MyReplace(strTxt," ","%20");
	return strTxt;
}

function prepareToSend(_str) {
		var strTxt=_str;
	if (strTxt=="" || strTxt==null) return strTxt;
	strTxt=MyReplace(strTxt," ","%20");
	strTxt=MyReplace(strTxt,"\'","%99");
	strTxt=MyReplace(strTxt,"!","%21");
	strTxt=MyReplace(strTxt,"\"","%22");
	strTxt=MyReplace(strTxt,"&","%26");
	strTxt=MyReplace(strTxt,"(","%28");
	strTxt=MyReplace(strTxt,")","%29");
	strTxt=MyReplace(strTxt,"/","%2F");
	strTxt=MyReplace(strTxt,":","%3A");
	strTxt=MyReplace(strTxt,";","%3B");
	strTxt=MyReplace(strTxt,"?","%3F");
	strTxt=MyReplace(strTxt,"+","%2B");
	strTxt=MyReplace(strTxt,"=","%3D");
	strTxt=MyReplace(strTxt,"ä","%E4");
	strTxt=MyReplace(strTxt,"Ä","%C4");
	strTxt=MyReplace(strTxt,"ö","%F6");
	strTxt=MyReplace(strTxt,"Ö","%D6");
	strTxt=MyReplace(strTxt,"ß","%DF");
	strTxt=MyReplace(strTxt,"ü","%FC");
	strTxt=MyReplace(strTxt,"Ü","%DC");
	strTxt=MyReplace(strTxt,"§","%A7");
	strTxt=MyReplace(strTxt,">","%3E");
	strTxt=MyReplace(strTxt,"<","%3C");
	strTxt=MyReplace(strTxt,"|","%7C");
	strTxt=MyReplace(strTxt,"^","%5E");
	strTxt=MyReplace(strTxt,"°","%B0");
	strTxt=MyReplace(strTxt,"`","%60");
	strTxt=MyReplace(strTxt,"´","%B4");
	strTxt=MyReplace(strTxt,"#","%23");
	strTxt=MyReplace(strTxt,"~","%7E");
	strTxt=MyReplace(strTxt,'"',"%22");
		return strTxt;
}

function prepareToGet(_str) {
	var strTxt=_str;
	if (strTxt=="" || strTxt==null) return strTxt;
	strTxt=MyReplace(strTxt,"%20"," ");
	strTxt=MyReplace(strTxt,"%99","\'");
	strTxt=MyReplace(strTxt,"%21","!");
	strTxt=MyReplace(strTxt,"%28","");
	strTxt=MyReplace(strTxt,"%29",")");
	strTxt=MyReplace(strTxt,"%2F","/");
	strTxt=MyReplace(strTxt,"%3A",":");
	strTxt=MyReplace(strTxt,"%3B",";");
	strTxt=MyReplace(strTxt,"%3F","?");
	strTxt=MyReplace(strTxt,"%2B","+");
	strTxt=MyReplace(strTxt,"%3D","=");
	strTxt=MyReplace(strTxt,"%E4","ä");
	strTxt=MyReplace(strTxt,"%C4","Ä");
	strTxt=MyReplace(strTxt,"%F6","ö");
	strTxt=MyReplace(strTxt,"%D6","Ö");
	strTxt=MyReplace(strTxt,"%DF","ß");
	strTxt=MyReplace(strTxt,"%FC","ü");
	strTxt=MyReplace(strTxt,"%DC","Ü");
	strTxt=MyReplace(strTxt,"%A7","§");
	strTxt=MyReplace(strTxt,"%3E",">");
	strTxt=MyReplace(strTxt,"%3C","<");
	strTxt=MyReplace(strTxt,"%7C","|");
	strTxt=MyReplace(strTxt,"%5E","^");
	strTxt=MyReplace(strTxt,"%B0","°");
	strTxt=MyReplace(strTxt,"%60","`");
	strTxt=MyReplace(strTxt,"%B4","´");
	strTxt=MyReplace(strTxt,"%23","#");
	strTxt=MyReplace(strTxt,"%7E","~");
	strTxt=MyReplace(strTxt,"%22",'"');
	strTxt=MyReplace(strTxt,"%26","&");
	return strTxt;
}



function MyReplace(str0, str1, str2) {
	var theString;
	theString=str0;
	while (theString.indexOf(str1) > -1){
		theString=theString.replace(str1,str2);}
	return theString;
}

