function getWebQuery(){
	if (document.forms.webassistant.webassistant.value != "") {
		var query = urlEncode(document.forms.webassistant.webassistant.value);
		openWebassistant(query);
	}
	else {
		openWebassistant();
	}
} 

function urlEncode(rawText){
      // this converts the rawText into x-www-form-urlencoded format (and space to "%20")
      var encoded = "";
      for(var n=0; n<rawText.length; n++) {
        var c=rawText.charCodeAt(n);
        // all chars in range 0-127 => 1byte   without (A-Z, a-z, 0-9, *, -, ., _)
        if (c<128) {
            if ((c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || (c==42) || (c==45) || (c==46) || (c==95))
                encoded += String.fromCharCode(c);
            else 
                encoded += '%' + c.toString(16);
        }
        // all chars in range 127 to 2047 => 2byte
        else if((c>127) && (c<2048)) {
          encoded += '%' + ((c>>6)|192).toString(16);
          encoded += '%' + ((c&63)|128).toString(16);
        }
        // all chars in range 2048 to 66536 => 3byte
        else {
          encoded += '%' + ((c>>12)|224).toString(16);
          encoded += '%' + (((c>>6)&63)|128).toString(16);
          encoded += '%' + ((c&63)|128).toString(16);
        }
      }
      return encoded;
    }
	
function utf8Encode (str) {
	    //this converts the str into hexadecimal-unicode format (\uXXXX) - utf-8-encoded
      len = str.length; 
      res = new String(); 
      charOrd = new Number(); 
     
      for (i = 0; i < len; i++) { 
        charOrd = str.charCodeAt(i); 
        if ((charOrd >= 65 && charOrd <= 90) || (charOrd >= 97 && charOrd <= 122) || (charOrd >= 48 && charOrd <= 57) || (charOrd == 33) || (charOrd == 36) || (charOrd == 95)) { 
            // das ist alphanumeric oder $-_.+!*'(), was laut RFC1738 nicht escape wird
            res += str.charAt(i); 
        } 
        else { 
          if (charOrd > 255) {
				    res += '\\u'; 
				    hexValStr = charOrd.toString(16); 
            if ((hexValStr.length) % 2 == 1) hexValStr = '0' + hexValStr; 
			    }else{
				    if (charOrd>=128){
					    if(charOrd<=191){
						    res += '%C2%';
					    }else{
						    res += '%C3%';
						    charOrd-=64;
					    }		
				    }else{
					    res+='%';
				    }
				    hexValStr = charOrd.toString(16); 
            if ((hexValStr.length) % 2 == 1) hexValStr = '0' + hexValStr; 
			    }         
          res += hexValStr; 
        } 
      } 
      return res; 
    }
