function utf8_encode (argString) {
// Encodes an ISO-8859-1 string to UTF-8
//
// version: 1103.1210
// discuss at: http://phpjs.org/functions/utf8_encode
// + original by: Webtoolkit.info (http://www.webtoolkit.info/)
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: sowberry
// + tweaked by: Jack
// + bugfixed by: Onno Marsman
// + improved by: Yves Sucaet
// + bugfixed by: Onno Marsman
// + bugfixed by: Ulrich
// * example 1: utf8_encode('Kevin van Zonneveld');
// * returns 1: 'Kevin van Zonneveld'
var string = (argString + ''); // .replace(/\r\n/g, "\n").replace(/\r/g, "\n");
var utftext = "",
start, end, stringl = 0;
start = end = 0;
stringl = string.length;
for (var n = 0; n < stringl; n++) {
var c1 = string.charCodeAt(n);
var enc = null;
if (c1 < 128) {
end++;
} else if (c1 > 127 && c1 < 2048) {
enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128);
} else {
enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128);
}
if (enc !== null) {
if (end > start) {
utftext += string.slice(start, end);
}
utftext += enc;
start = end = n + 1;
}
}
if (end > start) {
utftext += string.slice(start, stringl);
}
return utftext;
}
/*@cc_on @if (@_win32 && @_jscript_version >= 5) if (!window.XMLHttpRequest)
window.XMLHttpRequest = function() { return new ActiveXObject('Microsoft.XMLHTTP') }
@end @*/
var tree = {
table: '',
disp: null,
selNode: false,
edit: null,
order: false,
attributes: false,
classattr: false,
nodis: false,
show_node:function(pParent, pOpen, pLast) {
var oMaster = document.getElementById(pParent);
var cId = pParent.substr(2);
var oNode = document.getElementById('n_'+cId);
if (oNode) {
var oParent = oNode.parentNode;
oParent.removeChild(oNode);
}
var lOpen = true;
if (oMaster.state == 'open' && pOpen == 1) {
lOpen = false;
}
var oSym = document.getElementById('s_'+cId);
if (lOpen) {
oSym.className=oSym.className.replace(/_closed/, '_animation');
var oRq = new XMLHttpRequest();
var ajaxurl;
ajaxurl='http://mallorca-ausfluege.net/wp-content/plugins/excursiones_ch_plugin/tree-ajax.php';
var datatosend="lang=de&type="+cId;
oRq.open('POST', ajaxurl, true);
oRq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
oRq.onreadystatechange = function() {
if (oRq.readyState == 4) {
if (oRq.status == 200) {
if(oRq.responseText!="NULL"){
var resdatos = eval('(' +oRq.responseText+ ')');
var datos=resdatos.datos;
var resultado="";
var nodeImage="";
resultado+="
";
for(var i=0;i("+dato.total+"/"+dato.max+")";
if(resdatos.type!='exc') clk="onClick=\"tree.show_node('m_"+elid+"',1,false)\"";
resultado+="- ";
resultado+= "";
resultado+= "";
resultado+= "
"+txtshow+"
";
resultado+=" ";
}
var oHelp = document.createElement('div');
oHelp.innerHTML = resultado;
oMaster.parentNode.insertBefore(oHelp.firstChild, oMaster.nextSibling);
}
oMaster.state = 'open';
oSym.className = oSym.className.replace(/_animation/, '_open');
oSym.previousSibling.className = oSym.previousSibling.className.replace(/pNode/, 'mNode');
}
}
}
oRq.send(datatosend);
} else {
oMaster.state = 'closed';
oSym.className = oSym.className.replace(/_open/, '_closed');
oSym.previousSibling.className = oSym.previousSibling.className.replace(/mNode/, 'pNode');
}
return;
},
sel_node:function(pNode, pFunc) {
if (this.selNode) {
this.selNode.className='tree_text';
}
if (pNode == null) {
this.selNode = null;
} else {
this.selNode = pNode;
if (this.selNode) {
this.selNode.className='tree_text tree_text_sel';
if (pFunc) {
eval(pFunc);
}
}
}
}
};
function showContent(oNode){
/*var nodeId = oNode.id.substr(2);
var ajaxurl;
var ajaxurl;
ajaxurl='http://mallorca-ausfluege.net/wp-content/plugins/excursiones_ch_plugin/tree-ajax.php';
var datatosend="type="+nodeId;
sendString(datatosend,ajaxurl, 'content');*/
}
function sendString(pString, pUrl, pDest, pFunc){
var nPar = arguments.length;
var oRq = new XMLHttpRequest();
oRq.open("POST", pUrl, true);
oRq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
oRq.onreadystatechange = function () {
if (oRq.readyState == 4) {
if (oRq.status == 200) {
var datos = eval("("+oRq.responseText+")");
/*var campo=document.getElementById("geozonaROWID");
campo.value=datos.rowid;
var campo=document.getElementById("geoparentID");
campo.value=datos.parentid;
var campo=document.getElementById("geozonacode");
campo.value=datos.code;
campo.disabled=true;
var campo=document.getElementById("geozonaname");
campo.value=datos.name;
var campo=document.getElementById("geozonadesc");
campo.value=datos.description;
var campo=document.getElementById("geozonaIATA");
campo.value=datos.IATA;
var campo=document.getElementById("geozonahotels");
if(datos.hotels==1) campo.checked=true;
else campo.checked=false;
var campo=document.getElementById("geoparent");
campo.value=datos.parentname;
campo.disabled=true;
var btn=document.getElementById("buttoncr");
btn.style.display="";
var btn=document.getElementById("buttonel");
btn.style.display="";
var btn=document.getElementById("buttongu");
btn.style.display="";
var campo=document.getElementById("geohidden");
campo.value="edit";*/
if (pFunc) {
pFunc();
}
}
}
}
oRq.send(pString);
}
function openFirstNode(divname){
var ul0=document.createElement("ul");
ul0.id="n_0";
var divv=document.getElementById(divname);
var nodes=divv.childNodes;
if(nodes) for(var i=0;i