function createXMLHttpRequest()
{
var ax = [ "MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP.3.0" , "MSXML2.XMLHTTP" , "Microsoft.XMLHTTP" ];
var http = null;
var i, c;
if (window.XMLHttpRequest)
http = new XMLHttpRequest();
else if (window.ActiveXObject)
{
c = ax.length;
for (i = 0; i < c; i++)
{
try
{
http = new ActiveXObject(ax[i]);
break;
}
catch (e)
{
}
}
}
return http;
}
function submitForm(idForm)
{
var objForm = document.getElementById(idForm);
if (objForm != null)
{
objForm.submit();
}
}
function openPopup(url, width, height)
{
window.open(url, '_blank', 'resizable=no,toolbar=no,location=no,status=no,scrollbars=no,menubar=no,titlebar=no,width=' + width + ',height=' + height + ',left=40,top=40');
}
function openWinXY(url, x, y, width, height, resizable, scrollbar)
{
var s;
if (resizable)
s = 'resizable=yes';
else
s = 'resizable=no';
if (scrollbar)
s = s + ',toolbar=yes,location=no,status=no,scrollbars=yes,menubar=no,titlebar=no,width=' + width + ',height=' + height + ',left=' + x + ',top=' + y;
else
s = s + ',toolbar=no,location=no,status=no,scrollbars=no,menubar=no,titlebar=no,width=' + width + ',height=' + height + ',left=' + x + ',top=' + y;
window.open(url, '_blank', s);
}
function openWin(url, width, height, resizable, scrollbar)
{
openWinXY(url, 40, 40, width, height, resizable, scrollbar);
}
function openPrintWin(url, width)
{
var height;
height = 80 * screen.availHeight / 100;
window.open(url, '_blank', 'resizable=yes,toolbar=yes,location=no,status=no,scrollbars=yes,menubar=no,titlebar=no,width=' + width + ',height=' + height + ',left=40,top=40');
}
function closeWindowAndRefreshOpener()
{
if (opener != null)
if (opener.location != null)
{
opener.location.reload();
window.close();
}
}
function myRand(range)
{
return Math.floor(Math.random() * 0.999999 * range);
}
function getRandomParam()
{
var chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
var l = chars.length;
var result = '';
for (var i = 1; i <= 64; i++)
{
var chr = chars.charAt(myRand(l));
result += chr;
}
return result;
}
function newCaptcha(id, params, w, h)
{
var idImg = document.getElementById(id);
if (idImg != null)
idImg.src = "https://mandel-institut.esogetics.com/security/captcha.php?" + params + "&rnd=" + getRandomParam() + "&w=" + w + "&h=" + h;
}
var httpSelTherapies = null;
function updateAddSelectedTherapy(divid, id, title, link, addTherapyText, delTherapyText)
{
if (httpSelTherapies.readyState == 4)
{
var objDiv = document.getElementById(divid);
if (objDiv != null)
{
var data = eval("(" + httpSelTherapies.responseText + ")");
if (data.result)
{
objDiv.innerHTML = '' + delTherapyText + '';
}
}
}
}
function addSelectedTherapy(divid, id, link, title, addTherapyText, delTherapyText)
{
var objDiv = document.getElementById(divid);
if (objDiv != null)
{
httpSelTherapies = createXMLHttpRequest();
httpSelTherapies.open("GET", "https://mandel-institut.esogetics.com/services/query.php?action=addtherapy&id=" + encodeURIComponent(id) + "&title=" + encodeURIComponent(title) + "&link=" + encodeURIComponent(link) + "&rnd=" + getRandomParam(), true);
httpSelTherapies.onreadystatechange = new Function("doAddSelectedTherapy", 'updateAddSelectedTherapy("' + divid + '", ' + id + ', "' + title + '", "' + link + '", "' + addTherapyText + '", "' + delTherapyText + '")');
httpSelTherapies.send(null);
}
}
function updateDelSelectedTherapy(divid, id, title, link, addTherapyText, delTherapyText)
{
if (httpSelTherapies.readyState == 4)
{
var objDiv = document.getElementById(divid);
if (objDiv != null)
{
var data = eval("(" + httpSelTherapies.responseText + ")");
if (data.result)
{
objDiv.innerHTML = '' + addTherapyText + '';
}
}
}
}
function delSelectedTherapy(divid, id, link, title, addTherapyText, delTherapyText)
{
var objDiv = document.getElementById(divid);
if (objDiv != null)
{
httpSelTherapies = createXMLHttpRequest();
httpSelTherapies.open("GET", "https://mandel-institut.esogetics.com/services/query.php?action=deltherapy&id=" + encodeURIComponent(id) + "&rnd=" + getRandomParam(), true);
httpSelTherapies.onreadystatechange = new Function("doDelSelectedTherapy", 'updateDelSelectedTherapy("' + divid + '", ' + id + ', "' + title + '", "' + link + '", "' + addTherapyText + '", "' + delTherapyText + '")');
httpSelTherapies.send(null);
}
}
function toggleCompMenu(id)
{
var objCompMenu = document.getElementById(id);
if (objCompMenu != null)
{
if (objCompMenu.style.display == 'none')
objCompMenu.style.display = 'block';
else
objCompMenu.style.display = 'none';
}
}
function toggleMoreLess(idDivLess, idDivMore, idButton, textForMoreInformation, textForLessInformation)
{
var objDivLess = document.getElementById(idDivLess);
var objDivMore = document.getElementById(idDivMore);
var objButton = document.getElementById(idButton);
if (objDivLess != null && objDivMore != null && objButton != null)
{
if (objDivLess.style.display == 'none')
{
objButton.innerHTML = textForMoreInformation;
objDivLess.style.display = 'block';
objDivMore.style.display = 'none';
}
else
{
objButton.innerHTML = textForLessInformation;
objDivLess.style.display = 'none';
objDivMore.style.display = 'block';
}
}
}