/*  Dictionarium JavaScript framework, version 0.9.4
 *  (c) 2011 Peter Bartels <bartels.peter@web.de>
/*---------------------------------------------*/
function urlGet(){
            document.$_GET = [];
            var urlSplit = String(document.location).split('?');
            if (urlSplit[1]) {
                var urlGet = urlSplit[1].split('&');
                for (var i = 0; i <= (urlGet.length); i++) {
                    if (urlGet[i]) {
                        var urlGetPair = urlGet[i].split('=');
                        document.$_GET[urlGetPair[0]] = urlGetPair[1];
                    }
                }
            }
        }
 function checkBrowserName(name){   
   var agent = navigator.userAgent.toLowerCase();   
   //alert("handleResponse "+name+": "+agent);
   if (agent.indexOf(name.toLowerCase())>-1) {   
     return true;   
   }   
   return false;   
 }   

urlGet();
var lang = document.$_GET['lang'];
var dict = document.$_GET['dict'];
var feed = document.$_GET['feed'];  
var id_wort = document.$_GET['id_wort'];
var dt_wort = document.$_GET['dt_wort'];
var al_wort = document.$_GET['wort'];
id_wort = typeof(id_wort) != 'undefined' ? id_wort.replace("%20"," ").replace("%20"," ").replace("%C3%BC","_uuml|").replace("%C3%B6","_ouml|").replace("%C3%A4","_auml|") : "";
dt_wort = typeof(dt_wort) != 'undefined' ? dt_wort.replace("%20"," ").replace("%20"," ").replace("%C3%BC","_uuml|").replace("%C3%B6","_ouml|").replace("%C3%A4","_auml|") : "";
al_wort = typeof(al_wort) != 'undefined' ? al_wort.replace("%20"," ").replace("%20"," ").replace("%C3%BC","_uuml|").replace("%C3%B6","_ouml|").replace("%C3%A4","_auml|") : "";
var wort = id_wort+dt_wort+al_wort;
var id = document.$_GET['id'];
var bNext = false;
if(feed == "searchengine_de" && !checkBrowserName('MSIE')){   
	window.external.AddSearchProvider('http://www.dictionarium.de/search.xml');  
}
if(feed == "searchengine_en" && !checkBrowserName('MSIE')){   
	window.external.AddSearchProvider('http://www.dictionarium.de/search_en.xml');  
}
if(feed == "searchengine_id" && !checkBrowserName('MSIE')){   
	window.external.AddSearchProvider('http://www.dictionarium.de/search_id.xml');  
}
window.onload = function () {
  var wert = typeof(lang) != 'undefined' ? lang : "Lade Startseite";
  feed = typeof(feed) != 'undefined' ? feed : "ajax";
  if(wert=="eng"){wert = "Load homepage"}
  if(wert=="ind"){wert = "Unduh homepage"}
  if(wert=="deu"){wert = "Lade Startseite"}
  dict = typeof(dict) != 'undefined' ? dict : wert;
  if(wort != "") dict = wort;

  if(feed != "ajax"){ 
	var link = 'TB';
			 if (lang=="ind"){link = 'TI';
	  } else if (lang=="eng"){link = 'TE';}
		var ddmenuitem	= 0;
		ddmenuitem = document.getElementById("loading");
		if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
  } else {
    document.getElementById('post_wort').value = dict;
	sendRequest(1);
  }
}

function pson(ret,bool){
    ret = ret.replace(/\?/g,"");
	var entity=new Array(
    "_nbsp|","_iexcl|","_cent|","_pound|","_curren|","_yen|","_brvbar|","_sect|","_uml|","_copy|","_ordf|","_laquo|","_not|","_shy|","_reg|","_macr|",
    "_deg|","_plusmn|","_sup2|","_sup3|","_acute|","_micro|","_para|","_middot|","_cedil|","_sup1|","_ordm|","_raquo|","_frac14|","_frac12|","_frac34|","_iquest|",
    "_Agrave|","_Aacute|","_Acirc|","_Atilde|","_Auml|","_Aring|","_AElig|","_Ccedil|","_Egrave|","_Eacute|","_Ecirc|","_Euml|","_Igrave|","_Iacute|","_Icirc|","_Iuml|",
    "_ETH|","_Ntilde|","_Ograve|","_Oacute|","_Ocirc|","_Otilde|","_Ouml|","_times|","_Oslash|","_Ugrave|","_Uacute|","_Ucirc|","_Uuml|","_Yacute|","_THORN|","_szlig|",
    "_agrave|","_aacute|","_acirc|","_atilde|","_auml|","_aring|","_aelig|","_ccedil|","_egrave|","_eacute|","_ecirc|","_euml|","_igrave|","_iacute|","_icirc|","_iuml|",
    "_eth|","_ntilde|","_ograve|","_oacute|","_ocirc|","_otilde|","_ouml|","_divide|","_oslash|","_ugrave|","_uacute|","_ucirc|","_uuml|","_yacute|","_thorn|","_yuml|"
    );
    for (var i in entity) {
            if(bool){
				ret = ret.replace(String.fromCharCode(i * 1 + 160), "" + entity[i]);
			} else {
				ret = ret.replace("" + entity[i].replace("_","&").replace("|",";"), String.fromCharCode(i * 1 + 160));
			}			
    }
    return ret;
}

function createXMLHttpRequest() {

var o_request;

if(window.XMLHttpRequest) {
    try {
      o_request = new XMLHttpRequest();
    } catch(e) {
      o_request = false;
    }
  } else if(window.ActiveXObject) {
    try {
      o_request = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(e) {
      o_request = false;
    }
  }
  return o_request;
}

var req = createXMLHttpRequest();

function history(word) {
	var pre = "";
	if(document.getElementById("hold_Info").innerHTML == ""){
						 pre = '<font face="arial" size="2">Gesuchte W&ouml;rter:</font>';
		if (lang=="ind") pre = '<font face="arial" size="2">Kata-kata yang di cari:</font>';
		if (lang=="eng") pre = '<font face="arial" size="2">Recent searches:</font>';
	}
	var txt = '<a id="tabH" onclick="acRequest(\''+word+'\');">' + (word.replace("_","&").replace("|",";")) + '</a>&nbsp;';
	document.getElementById("hold_Info").innerHTML = pre + document.getElementById("hold_Info").innerHTML+" "+txt + " |";
}

function acRequest(str) {
	str = str.replace("_","&").replace("|",";");
	document.getElementById('post_wort').value = pson(str, false);
	history(str);
	sendRequest(1);
}


function sendReqHist(iHold) {
	word = document.getElementById('post_wort').value;
	history(word);
	sendRequest(iHold);
}

function sendRequest(iHold) {
  var holder = 'hold_'+String(iHold);
  document.getElementById(holder).innerHTML = "";
  val = document.getElementById('post_wort').value;
  var link = 'TB';
         if (lang=="ind"){link = 'TI';
  } else if (lang=="eng"){link = 'TE';}
  if (iHold == 0){
	link = 'AC';
  }
  req.open('get', 'bremis.php?pid='+iHold+'&id='+link+'_'+pson(val, true)); 
  req.onreadystatechange = handleResponse;
  req.send(null);
  var ddmenuitem = 0;
  ddmenuitem = document.getElementById("loading");
  if (ddmenuitem) ddmenuitem.style.visibility = 'visible';
	if(checkBrowserName('chrome')){ 
	    window.scrollBy(0,1000);
	    window.scrollBy(0,-1000);
	}
}

function handleResponse() {
  if(req.readyState == 4){
	  var strReq = req.responseText;
	  var holder = 'hold_'+strReq.substring(3, 4);
	  var i_ID = Number(strReq.substring(3, 4));
	  if(i_ID > 0 && i_ID <= 5){
		//alert("handleResponse "+holder+": "+strReq);
	    var strRsp = dialog(strReq, holder);
		if(strRsp!="<keep>"){
			document.getElementById(holder).innerHTML = strRsp;
		}
	  } else {
		document.getElementById('hold_0').innerHTML = fillAC(strReq);
		//alert("handleResponse "+holder+": "+strReq);
	  }
	  if(i_ID > 0 && i_ID <= 5 && strRsp!="<keep>" && bNext == true){
	     var holasader = i_ID+1;
		sendRequest(i_ID+1);
	  } else {
		var ddmenuitem	= 0;
		ddmenuitem = document.getElementById("loading");
		if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
	  }
  }
	if(checkBrowserName('chrome')){ 
	    window.scrollBy(0,1000);
	    window.scrollBy(0,-1000);
	}
}

// button
function buttonEvent(obj, pathToImage){
var eve=window.event? event.srcElement: obj.target
if (eve.tagName=="INPUT"&&eve.type=="button")
eve.style.backgroundImage="url"+"('"+pathToImage+"')"
}
	function dialog (desc, holder) {
		var def = "TBL1~a~<a href='bremis.php?pid=1&id=TB_weiter'>weiter...</a>~c~d~";
		desc = typeof(desc) != 'undefined' ? desc : def;//item.desc;
		//alert("go "+desc);
		var holdAkt = document.getElementById('hold_1');
		var cntA = 0;
			cntA++;
		var d=new Date();
		var content = '';
		if (holder == 'hold_1'){
				document.getElementById('hold_2').innerHTML = "";
				document.getElementById('hold_3').innerHTML = "";
				document.getElementById('hold_4').innerHTML = "";
				document.getElementById('hold_5').innerHTML = "";
		}
		//$('hold_3').innerHTML = "S:<script type='text/javascript' language='JavaScript'>window.location.href = 'bremis.php?pid=815&id=TB_hallo';</script>";
		if ((desc.substring(0, 3) == "TBL" || desc.substring(0, 3) == "TBS" || desc.substring(0, 3) == "LST")){
				var words = desc.split('#');
				var prep = '<div class="content"><div class="wrapper"><div class="t"></div><div class="bd"><p>';
				var pre1 = '<div class="bg01">'+prep;
				var pre2 = '<div class="bg02">'+prep;
				var pre3 = '<div class="bg03">'+prep;
				var post = '</p></div><!-- --></div></div><div class="b"><div></div></div></div>';
				var post2= '</p></div></div></div><div class="b"><div></div></div></div>';
				var posD = '</p></div><!-- --></div></div><div class="b"><div><table border="0" width="95"><tr><td align="right">Dictionarium v0.9.5</td></tr></table></div></div></div>';
				var preT = '<table id="tab">';
				var pBsp = '<table id="bsp">';
				var postT= '</table>';
				// lang=="deu";
				//var tdID = "<th id='tab'><A onclick='sortTable(0, \"hold_1\");'><b>Indonesisch </b></A></th>";
				//var tdAT = "<th id='tab'><A onclick='sortTable(1, \"hold_1\");'><b>Art.</b></A></th>";
				//var tdDT = "<th id='tab'><A onclick='sortTable(2, \"hold_1\");'><b>Deutsch</b></A></th>";
				//var tdSW = "<th id='tab'><A onclick='sortTable(3, \"hold_1\");'><b>Stamm</b><!--/font--></A></th></TR>";
				var tdID = "<th id='tab'><b>Indonesisch </b></A></th>";
				var tdAT = "<th id='tab'><b>Art.</b></A></th>";
				var tdDT = "<th id='tab'><b>Deutsch</b></A></th>";
				var tdSW = "<th id='tab'><b>Stamm</b><!--/font--></A></th></TR>";
				var tdBI = "<th id='bsp'><b>Indonesischer Beispielsatz</b></A></th>";
				var tdBD = "<th id='bsp'><b>Deutscher Beispielsatz</b></A></th>";
				if (lang=="ind"){
				tdID = "<th id='tab'><b>Bahasa Indonesia </b>		</th>";
				tdAT = "<th id='tab'><b>Art.</b>				</th>";
				tdDT = "<th id='tab'><b>Bahasa Jerman </b>			</th>";
				tdBI = "<th id='tab'><b>Contoh kalimat dalam Bahasa Indonesia</b>	</th>";
				tdBD = "<th id='tab'><b>Contoh kalimat dalam Bahasa Jerman</b>		</th>";
				tdSW = "<th id='tab'><b>Kata dasar</b><!--/font-->		</th>";
				} else
				if (lang=="eng"){
				tdID = "<th id='tab'><b>Indonesian</b>		</th>";
				tdAT = "<th id='tab'><b>Art.</b>				</th>";
				tdDT = "<th id='tab'><b>German</b>			</th>";
				tdBI = "<th id='tab'><b>Indonesian example sentence </b>	</th>";
				tdBD = "<th id='tab'><b>German example sentence</b>		</th>";
				tdSW = "<th id='tab'><b>Root</b><!--/font-->		</th>";
				}
				var iCnt = 0;
				var iCntBsp = 0;
				var bLeer   = false;
				var bLass   = false;
				content  ='<tr id="tab">'+tdID+tdAT+tdDT+tdSW+'</tr>';
				var beispiel ='<tr id="bsp">'+tdBI+tdBD+'</tr>';
				var hdrTxt   ='hdr';
				for (var i = 0; i < words.length; i++){
						if (words[i].length > 0) {
								var part = words[i].substring(4);part = part.split ('~');
								var iInfo = 0;
								var iID   = 1;
								var iDT   = 2;
								var iBsp  = 4;
								var dBsp  = 5;
								bNext = true;
								if (part[iID] == "clearAC"){
										document.getElementById('post_wort').value = wort;
										part[iID] = "stp";
										//alert("clearAC "+desc);
								}
								if (part[iID] == "del"){
										bLeer = true;
										bNext = false;
										//alert("del "+desc);
								}
								if (part[iID] == "delSend"){
										bLeer = true;
										part[iID] = "del";
										//alert("delSend "+desc);
								}
								if (part[iID] == "stpSend"){
										bNext = false;
										part[iID] = "stp";
										//alert("stp "+desc);
								}
								if (part[iID] == "stpAC"){
										document.getElementById('post_wort').value = wort;
										bNext = false;
										part[iID] = "stp";
										//alert("stpAC "+desc);
								}
									
								content  = content  + '<tr id="tab">';
								if (part[iBsp] + part[dBsp] != "") {
										beispiel = beispiel + '<tr id="bsp">';
								}
								for (var j = 0; j < part.length; j++) {
										if(j !== iInfo && j !== iBsp && j !== dBsp){
												if(part[j]!=""){
												        var pos = part[j].search("_audio_");
														var audio = ""
														if (pos > 0){
															audio = part[j].substr(pos);
															part[j] = part[j].substr(0,pos);
														}
														var subpart = part[j].split(" ");
														var partHref = "";
														for (var cnt = 0; cnt < subpart.length; cnt++) {
																if(subpart[cnt]!="/" && subpart[cnt]!="..."){
																		var partEntity = subpart[cnt].replace("&quot;","").replace("&quot;","").replace("\"","").replace("[","").replace("]","").replace("(","").replace(")","").replace("&","_").replace(";","|").replace(/_fat_/g , "").replace(/_fatx_/g , "");
																		partHref = partHref + '<a id="tab" onclick="acRequest(\''+partEntity+'\');">' + subpart[cnt] + '</a>&nbsp;';
																} else{
																		partHref = partHref + subpart[cnt] + '&nbsp;';
																}
																if (cnt%6 == 5 && cnt+1 < subpart.length) {
																	partHref = partHref + '<br>';
																}
														}
														partHref = '<table><tr><td nowrap>'+partHref+''+ audio +'</td><td width = "100%" onclick="acRequest(\''+part[j].replace(/_fat_/g , "").replace(/_fatx_/g , "")+'\');">&nbsp;</td></tr></table>';
														content  = content  + '<td id="tab">' + partHref +'</td>';
														iCnt++;
														if(part[j].substring(0, 6) == "-LEER-"){
																bLeer   = true;
														}
												}else{
														content  = content  + '<td id="tab">&nbsp;</td>';

												}
										} else {
												if (j != iInfo && part[iBsp] + part[dBsp] != "") {
														subpart = part[j].split(" ");
														partHref = "";
														for (cnt = 0; cnt < subpart.length; cnt++) {
																if(subpart[cnt]!="/" && subpart[cnt]!="..."){
																		partEntity = subpart[cnt].replace("[","").replace("]","").replace("(","").replace(")","").replace("&","_").replace(";","|").replace(/_fat_/g , "").replace(/_fatx_/g , "");
																		partHref = partHref + '<a id="tabB" onclick="acRequest(\''+partEntity+'\');">' + subpart[cnt] + '</a>&nbsp;';
																} else{
																		partHref = partHref + subpart[cnt] + '&nbsp;';
																}
														}
														beispiel = beispiel + '<td id="bsp">&nbsp;' + partHref + '&nbsp;</td>';
														iCntBsp++
												}
										}
								}
								content  = content  + '</tr>';
								if (part[iBsp] + part[dBsp] != "") {
										beispiel = beispiel + '</tr>';
								}
						}
				}
				var hits = words.length-1;
				if (hits && part[iID] != "stp" && part[iID] != "del" && part[iID] != "let") {

					hdrTxt = part[iInfo];
					if(hdrTxt.substring(0, 2) == "I-"){
						hdrTxt = hdrTxt.substring(2);
					} else {
										 hdrSubTxt = '<font color="#ffffff"><br>Es wurde ein Eintrag gefunden:';
						if (lang=="eng") hdrSubTxt = '<font color="#ffffff"><br>One entrie was found:';
						if (lang=="ind") hdrSubTxt = '<font color="#ffffff"><br>Ada hasil ditemukan:';
						
						if (hits > 1){
												 hdrSubTxt = '<font color="#ffffff"><br>Es wurden ' + (words.length - 1) + ' Eintragungen gefunden:';
								if (lang=="eng") hdrSubTxt = '<font color="#ffffff"><br>' + (words.length - 1) + ' entries were found:';
								if (lang=="ind") hdrSubTxt = '<font color="#ffffff"><br>Ada ' + (words.length - 1) + ' hasil ditemukan:';
						}
					}
					post = post.replace("<!-- -->", hdrSubTxt);
				} else {
						hdrSubTxt = part[iDT];
						hdrTxt = part[iInfo];
						post = post.replace("<!-- -->", hdrSubTxt);
						content = "";
						if (part[iID] == "del"){
								bLeer = true;
						}
						if (part[iID] == "let"){
								bLass = true;
						}
				}
				if (holder == 'hold_1' && content != "") {
						content = pre1+"<br>"+
										  pre3+"<br><p style='font-size:14px'>"+hdrTxt+"</p>"+post+
										  '<div style="max-height:600px; overflow:auto; border:0px;">'+
										  preT+content+postT+'</div>';
				} else {
						content = pre1+"<br>"+
										  "<br><p style='font-size:14px'>"+hdrTxt+"</p>"+hdrSubTxt+
										  '<div style="max-height:600px; overflow:auto; border:0px;">'+
										  preT+content+postT+'</div>';
				}
				if(iCntBsp!=0){
						content = content+"<br>"+pre2+"<br>"+'<div style="max-height:200px; overflow:auto;">'+
										  pBsp+beispiel+postT+"</div>"+post2+"<br>";
				}
				content = content + posD;
				if (desc.substring(0, 3) == "TBS") {
					bNext = false;
				}
				if(bLass){
					return "<keep>";
				}
				if(bLeer){
					return "";
				} else {
					return replaceCont((content));// DEBUG: htmlentities // replaceCont
				}
		}
	}
function htmlentities (string, quote_style) {
    // Convert all applicable characters to HTML entities  
    // 
    // version: 1008.1718
    // discuss at: http://phpjs.org/functions/htmlentities
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: nobbler
    // +    tweaked by: Jack
    // +   bugfixed by: Onno Marsman
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    bugfixed by: Brett Zamir (http://brett-zamir.me)
    // +      input by: Ratheous
    // -    depends on: get_html_translation_table
    // *     example 1: htmlentities('Kevin & van Zonneveld');
    // *     returns 1: 'Kevin &amp; van Zonneveld'
    // *     example 2: htmlentities("foo'bar","ENT_QUOTES");
    // *     returns 2: 'foo&#039;bar'
    var hash_map = {}, symbol = '', tmp_str = '', entity = '';
    tmp_str = string.toString();
    
    if (false === (hash_map = this.get_html_translation_table('HTML_ENTITIES', quote_style))) {
        return false;
    }
    hash_map["'"] = '&#039;';
    for (symbol in hash_map) {
        entity = hash_map[symbol];
        tmp_str = tmp_str.split(symbol).join(entity);
    }
    
    return tmp_str;
}
function get_html_translation_table (table, quote_style) {
    // Returns the internal translation table used by htmlspecialchars and htmlentities  
    // 
    // version: 1008.1718
    // discuss at: http://phpjs.org/functions/get_html_translation_table
    // +   original by: Philip Peterson
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: noname
    // +   bugfixed by: Alex
    // +   bugfixed by: Marco
    // +   bugfixed by: madipta
    // +   improved by: KELAN
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Brett Zamir (http://brett-zamir.me)
    // +      input by: Frank Forte
    // +   bugfixed by: T.Wild
    // +      input by: Ratheous
    // %          note: It has been decided that we're not going to add global
    // %          note: dependencies to php.js, meaning the constants are not
    // %          note: real constants, but strings instead. Integers are also supported if someone
    // %          note: chooses to create the constants themselves.
    // *     example 1: get_html_translation_table('HTML_SPECIALCHARS');
    // *     returns 1: {'"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;'}
    
    var entities = {}, hash_map = {}, decimal = 0, symbol = '';
    var constMappingTable = {}, constMappingQuoteStyle = {};
    var useTable = {}, useQuoteStyle = {};
    
    // Translate arguments
    constMappingTable[0]      = 'HTML_SPECIALCHARS';
    constMappingTable[1]      = 'HTML_ENTITIES';
    constMappingQuoteStyle[0] = 'ENT_NOQUOTES';
    constMappingQuoteStyle[2] = 'ENT_COMPAT';
    constMappingQuoteStyle[3] = 'ENT_QUOTES';
 
    useTable       = !isNaN(table) ? constMappingTable[table] : table ? table.toUpperCase() : 'HTML_SPECIALCHARS';
    useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT';
 
    if (useTable !== 'HTML_SPECIALCHARS' && useTable !== 'HTML_ENTITIES') {
        throw new Error("Table: "+useTable+' not supported');
        // return false;
    }
 
    entities['38'] = '&amp;';
    if (useTable === 'HTML_ENTITIES') {
        entities['160'] = '&nbsp;';
        entities['161'] = '&iexcl;';
        entities['162'] = '&cent;';
        entities['163'] = '&pound;';
        entities['164'] = '&curren;';
        entities['165'] = '&yen;';
        entities['166'] = '&brvbar;';
        entities['167'] = '&sect;';
        entities['168'] = '&uml;';
        entities['169'] = '&copy;';
        entities['170'] = '&ordf;';
        entities['171'] = '&laquo;';
        entities['172'] = '&not;';
        entities['173'] = '&shy;';
        entities['174'] = '&reg;';
        entities['175'] = '&macr;';
        entities['176'] = '&deg;';
        entities['177'] = '&plusmn;';
        entities['178'] = '&sup2;';
        entities['179'] = '&sup3;';
        entities['180'] = '&acute;';
        entities['181'] = '&micro;';
        entities['182'] = '&para;';
        entities['183'] = '&middot;';
        entities['184'] = '&cedil;';
        entities['185'] = '&sup1;';
        entities['186'] = '&ordm;';
        entities['187'] = '&raquo;';
        entities['188'] = '&frac14;';
        entities['189'] = '&frac12;';
        entities['190'] = '&frac34;';
        entities['191'] = '&iquest;';
        entities['192'] = '&Agrave;';
        entities['193'] = '&Aacute;';
        entities['194'] = '&Acirc;';
        entities['195'] = '&Atilde;';
        entities['196'] = '&Auml;';
        entities['197'] = '&Aring;';
        entities['198'] = '&AElig;';
        entities['199'] = '&Ccedil;';
        entities['200'] = '&Egrave;';
        entities['201'] = '&Eacute;';
        entities['202'] = '&Ecirc;';
        entities['203'] = '&Euml;';
        entities['204'] = '&Igrave;';
        entities['205'] = '&Iacute;';
        entities['206'] = '&Icirc;';
        entities['207'] = '&Iuml;';
        entities['208'] = '&ETH;';
        entities['209'] = '&Ntilde;';
        entities['210'] = '&Ograve;';
        entities['211'] = '&Oacute;';
        entities['212'] = '&Ocirc;';
        entities['213'] = '&Otilde;';
        entities['214'] = '&Ouml;';
        entities['215'] = '&times;';
        entities['216'] = '&Oslash;';
        entities['217'] = '&Ugrave;';
        entities['218'] = '&Uacute;';
        entities['219'] = '&Ucirc;';
        entities['220'] = '&Uuml;';
        entities['221'] = '&Yacute;';
        entities['222'] = '&THORN;';
        entities['223'] = '&szlig;';
        entities['224'] = '&agrave;';
        entities['225'] = '&aacute;';
        entities['226'] = '&acirc;';
        entities['227'] = '&atilde;';
        entities['228'] = '&auml;';
        entities['229'] = '&aring;';
        entities['230'] = '&aelig;';
        entities['231'] = '&ccedil;';
        entities['232'] = '&egrave;';
        entities['233'] = '&eacute;';
        entities['234'] = '&ecirc;';
        entities['235'] = '&euml;';
        entities['236'] = '&igrave;';
        entities['237'] = '&iacute;';
        entities['238'] = '&icirc;';
        entities['239'] = '&iuml;';
        entities['240'] = '&eth;';
        entities['241'] = '&ntilde;';
        entities['242'] = '&ograve;';
        entities['243'] = '&oacute;';
        entities['244'] = '&ocirc;';
        entities['245'] = '&otilde;';
        entities['246'] = '&ouml;';
        entities['247'] = '&divide;';
        entities['248'] = '&oslash;';
        entities['249'] = '&ugrave;';
        entities['250'] = '&uacute;';
        entities['251'] = '&ucirc;';
        entities['252'] = '&uuml;';
        entities['253'] = '&yacute;';
        entities['254'] = '&thorn;';
        entities['255'] = '&yuml;';
    }
 
    if (useQuoteStyle !== 'ENT_NOQUOTES') {
        entities['34'] = '&quot;';
    }
    if (useQuoteStyle === 'ENT_QUOTES') {
        entities['39'] = '&#39;';
    }
    entities['60'] = '&lt;';
    entities['62'] = '&gt;';
 
 
    // ascii decimals to real symbols
    for (decimal in entities) {
        symbol = String.fromCharCode(decimal);
        hash_map[symbol] = entities[decimal];
    }
    
    return hash_map;
}
	function fillAC(desc) {
				var content = '';
				if (desc.substring(0, 3) == "AUC"){ // item.id == 0 &&
					var words = desc.substring(4).split('#');
					for (var i = 0; i < words.length; i++) {
						if (words[i].length > 0) {
							var partA = words[i].substring(0, 4);
							var partB = words[i].substring(1, 5);
							// alert("A "+partA);
							if (partA == "(DE)" || partA == "(ID)" || partB == "(DE)" || partB == "(ID)") {
								var partC = "de";
								var partD = words[i].substring(4);
								if (partA == "(ID)" || partB == "(ID)") var partC = "id";
								if (partB == "(DE)" || partB == "(ID)") var partD = words[i].substring(5);
								content = content + '<table id="ac"> <tr id="ac"><td id="ac" width="38px">'+
													'<img src="img/' + partC + '.gif" alt="flag"></td>'+
													'<td id="ac" VALIGN="middle" ALIGN="left" '+
													'onclick="acRequest(\'' + partD + '\');";>' +
													partD + '</td></tr></table>';
							}
							updateAC = true;
						}
					}
				}
				return replaceCont(content);
			}

function replaceCont(content){
				content = content.replace(/_colg_/g , "<span style = 'color:#00C000'>");
				content = content.replace(/_siz12_/g , "<span style='font-size:13px'>");
				content = content.replace(/_siz10_/g , "<span style='font-size:12px'>");
				content = content.replace(/_colb_/g , "<span style = 'color:#000000'>");
				content = content.replace(/_colw_/g , "<span style = 'color:#ffffff'>");
				content = content.replace(/_collb_/g , "<span style = 'color:#FFE4C4'>");
				content = content.replace(/_coldb_/g , "<span style = 'color:#FFD39B'>");
				content = content.replace(/_colx_/g   , "</span>");
				content = content.replace(/_fat_/g , "<b>");
				content = content.replace(/_fatx_/g   , "</b>");
				content = content.replace(/_br_/g, "<br>");
				content = content.replace(/_hochkomma_/g, "'");
				content = content.replace(/_img_/g, "<table width='100%'><tr><td align='center'><img src='");
				content = content.replace(/_imgx_/g, "'></td></tr></table>");
				content = content.replace(/_tab_/g, "<TABLE>");
				content = content.replace(/_tabx_/g, "</TABLE>");
				content = content.replace(/_tr_/g, "<TR>");
				content = content.replace(/_trx_/g, "</TR>");
				content = content.replace(/_td_/g, "<TD>");
				content = content.replace(/_tdx_/g, "</TD>");
				content = content.replace(/_href1_/g, "<a href='");
				content = content.replace(/_href2_/g, "'>");
				content = content.replace(/_href3_/g, "</a>");
				content = content.replace(/_hrefX_/g, "<a href=\"dict.php?feed=searchengine_de\" onclick=\"window.external.AddSearchProvider('");
				content = content.replace(/_hrefE_/g, "<a href=\"dict.php?feed=searchengine_en\" onclick=\"window.external.AddSearchProvider('");
				content = content.replace(/_hrefI_/g, "<a href=\"dict.php?feed=searchengine_id\" onclick=\"window.external.AddSearchProvider('");
				content = content.replace(/_hrefY_/g, "')\">");
				content = content.replace(/_hrefZ_/g, "</a>");
				content = content.replace(/_audio_/g, '<img onclick="playSound(\'snd/');
				content = content.replace(/_audix_/g, '\',75)" src="img/audio.gif" alt="" height="20" width="20">');
				return content;
}
function sortTable(col, id){
				//alert("sortTable "+col+", "+id);
}
function playSound( url, vol ){
	document.getElementById("sound").innerHTML="";
	var content = "<embed src='"+url+"' hidden=true autostart=true loop=false volume='"+vol+"' MASTERSOUND>";
	document.getElementById("sound").innerHTML=content;
}
function stopSound(){   
	document.getElementById("sound").innerHTML="<embed src='/snd/empty.wav' hidden=true autostart=true loop=false MASTERSOUND>";
}













