var uid = "";
var antwoord = "";
var recnr = 0;
var html = "";
var category = 0;
var matchLayer = 0;

var D = function (id) {
    return document.getElementById(id);
}

var elitechAise = function () {
    this.klantcode = "TSCS_de";    /* Probeer hier een unieke afkorting te gebruiken voor een klant */
    this.subject = "CCW";
    this.state = 1;           /* default status */
    this.frame1 = "";          /* default waarde frame 1 */
    this.frame2 = "";          /* default waarde frame 2 */
    this.frame3 = "";          /* default waarde frame 3 */
    this.useIframeIEfix = false;       /* in IE liggen selectboxen en flash etc. altijd met de hoogste z-index. als deze optie op true wordt gezet, wordt achter de divs een iframe geplaatst. Dit iframe kan wel over deze controls heen worden gelegd. */
    this.loadingHTML = "... ...";    /* Tekst wordt getoond tijdens het laden */
    this.showDivSources = false;       /* voor debug/design true zetten */
    this.doPagePush = true;        /* aanzetten pagepush optie. Handig om uit te zetten tijdens ontwikkelfase */
    this.beoordeling = 0;            /* beoordeling goed is de defaultwaarde */
    this.handigeVragen = false;        /* maak gebruik van handige vragen */
    this.toonvraag = true;        /* De vraag herhalen in aise responsediv */
    this.pagepushiframe = false;       /* De pagepush uitvoeren naar een achtergrond frame (in geval van demo|testen) */
    this.RecNr1 = 'leeg';
    this.RecNr2 = 'leeg';
    this.RecNr3 = 'leeg';
    this.DoorverwijzingContact = true;
    this.lastReceived_uid = "";
    this.lastReceived_antwoord = "";
    this.lastReceived_recnr = 0;
    this.lastReceived_html = "";
    this.lastReceived_category = 0;
    this.lastQuestion = "";
    this.testing = false;
    this.feedbacktestfase = false;

    this.defaultvraag = new Array();
    this.callback = "me.putXMLhere();";
    this.oScript = "";
    var me = this;

    this.convertTo = function () {
        me.lastReceived_antwoord = me.lastReceived_antwoord.replace(/&#/gi, "SPECIAL_SIGN");
        me.lastReceived_antwoord = me.lastReceived_antwoord.replace(/;/gi, "PUNT_KOMMA");
    };

    this.convertFrom = function (value) {
        value = value.replace(/SPECIAL_SIGN/gi, "&#");
        value = value.replace(/PUNT_KOMMA/gi, ";");
        return value;
    };

    this.storeAllData = function () {
        me.convertTo();
        var aise = D('tscs_status1div');
        top.window.name = "AISE -!-" + me.klantcode + ";" + me.state + ";" + me.lastQuestion + ";" + me.lastReceived_antwoord + ";" + me.lastReceived_uid;
    };

    this.repositionFromStorage = function () {
        var aise = D('tscs_status1div');
        var wname = top.window.name.split("-!-");
        if (wname[1]) {
            var storage = wname[1].split(";");
            if (storage[0] == this.klantcode) {
                this.state = storage[1];
                this.lastQuestion = this.convertFrom(storage[2]);
                this.lastReceived_antwoord = this.convertFrom(storage[3]);
                this.lastReceived_uid = storage[4];

                if (this.toonvraag) {
                    try {
                        D('tscs_question').value = "";
                    } catch (e) { }
                    D('tscs_aiseResponseDiv').innerHTML = "<strong>" + this.lastQuestion + "</strong><span class='tscs_ruimtegesteldevraag'><br /></span>" + "" + this.lastReceived_antwoord + "";
                }
                else {
                    try {
                        D('tscs_question').value = this.lastQuestion;
                    } catch (e) { }
                    D('tscs_aiseResponseDiv').innerHTML = "<strong>" + this.lastQuestion + "</strong><span class='tscs_ruimtegesteldevraag'><br /></span>" + "" + this.lastReceived_antwoord + "";
                    D('tscs_aiseResponseDiv').innerHTML = this.lastReceived_antwoord;
                }
            }
        } else {
            aise.style.top = this.defaultFromtop;
            aise.style.left = this.defaultFromLeft;
        }
        this.changeState();
        return true;
    };

    this.changeState = function () {
        if (this.state == 1) {
            D('tscs_status1div').style.display = 'block';
            D('tscs_status2div').style.display = 'none';
            D('tscs_status3div').style.display = 'none';
            if (this.useIframeIEfix) {
                D('tscs_status1frame').style.display = 'block';
                D('tscs_status2frame').style.display = 'none';
                D('tscs_status3frame').style.display = 'none';
            }
        }
        if (this.state == 2) {
            D('tscs_status1div').style.display = 'block';
            D('tscs_status2div').style.display = 'none';
            D('tscs_status3div').style.display = 'none';
            if (this.useIframeIEfix) {
                D('tscs_status1frame').style.display = 'block';
                D('tscs_status2frame').style.display = 'none';
                D('tscs_status3frame').style.display = 'none';
            }
            if (D('tscs_aiseResponseDiv').innerHTML == '') {
                this.sendQuestionInit();
                return;
            }
            D('tscs_question').focus();
        }
        if (this.state == 3) {
            D('tscs_status1div').style.display = 'block';
            D('tscs_status2div').style.display = 'block';
            D('tscs_status3div').style.display = 'block'; // TONEN VOOR TEST_DIALOOG wordt dan display='';   verbergen =>  display='none';
            if (this.useIframeIEfix) {
                D('tscs_status1frame').style.display = 'block';
                D('tscs_status2frame').style.display = 'block';
                D('tscs_status3frame').style.display = 'block';
            }
        }
    };

    this.changeStateFromTopDiv = function () {
        if ((this.state == 2) || (this.state == 3)) {
            this.state = 1;
        } else {
            this.state = 2;
        }
        this.changeState();
    };

    this.parse = function () {
        document.write('<link rel="stylesheet" type="text/css" href="' + this.css + '">');
        if (this.showDivSources) {
            document.write('<textarea style="font-family: Verdana; font-size:11px;width:100%;height:33%">' + this.frame1 + "</textarea>");
            document.write('<textarea style="font-family: Verdana; font-size:11px;width:100%;height:33%">' + this.frame2 + "</textarea>");
            document.write('<textarea style="font-family: Verdana; font-size:11px;width:100%;height:33%">' + this.frame3 + "</textarea>");
        }
        document.write(this.frame1);
        document.write(this.frame2);
        document.write(this.frame3);
        
        if (!isGeldigeIE()) { this.useIframeIEfix = false; }
        if (this.useIframeIEfix) {
            var status1div = D('tscs_status1div');
            document.write("<iframe name='tscs_status1frame' id='tscs_status1frame' frameborder='0' style='moz-opacity:.5;filter:alpha(opacity=0);display:none;z-index:900;position:absolute;' width='" + status1div.style.width + "' height='" + status1div.style.height + "'></iframe>");
        }
        window.onload = this.positionAiseOnLoadHandler;  // Na het laden aise initialiseren
        window.onunload = this.storeAllData;              // Opslaan positie, vraag en antwoord
    };

    this.positionAiseOnLoadHandler = function () {
        if (me.repositionFromStorage()) {
            if (me.handigeVragen) { me.setDefaultVragen(); }
        }
    };

    this.setDefaultVragen = function () {
        var faqDiv = D('faq');
        faqDiv.innerHTML = "";
        for (var loop = 0; loop < this.defaultvraag.length; loop++) {
            faqDiv.innerHTML = faqDiv.innerHTML + "<a href='#' onClick=\"" + this.instanceName + ".vraagHandigeVraag('" + this.defaultvraag[loop] + "')\">" + this.defaultvraag[loop] + '</a><br />';
        }
    };

    this.vraagHandigeVraag = function (vraag) {
        D('tscs_question').value = vraag;
        this.sendQuestion();
    };

    this.verwerkHandigeVragen = function (hvragen) {
        var faqDiv = D('faq');
        faqDiv.innerHTML = "";
        for (var loop = 0; loop < hvragen.length; loop++) {
            faqDiv.innerHTML = faqDiv.innerHTML + "<a href='#' onClick=\"" + this.instanceName + ".vraagHandigeVraag('" + hvragen[loop] + "')\">" + hvragen[loop] + '</a><br />';
        }
        if (hvragen.length === 0) {
            for (var loop = 0; loop < this.defaultvraag.length; loop++) {
                faqDiv.innerHTML = faqDiv.innerHTML + "<a href='#' onClick=\"" + this.instanceName + ".vraagHandigeVraag('" + this.defaultvraag[loop] + "')\">" + this.defaultvraag[loop] + '</a><br />';
            }
        }
    };

    this.getDataFromServer = function (id, url, vraag) {
        this.oScript = D(id);
        var head = document.getElementsByTagName("head").item(0);
        if (this.oScript) {
            head.removeChild(this.oScript);
        }
        this.oScript = document.createElement("script");
        var callURL = url +
			'?projectCode=' + this.projectCode +
			'&projectID=' + this.projectID +
			'&uid=' + this.lastReceived_uid +
			'&vraag=' + vraag +
			'&langCode=DE';
        this.oScript.setAttribute("src", callURL);

        head.appendChild(this.oScript);
        if (isGeldigeIE()) {
            if (this.oScript.readyState == "loaded") {
                eval(this.callback);
                this.oScript.onreadystatechange = null;
            } else {
                this.oScript.onreadystatechange = this.CheckAgain;
            }
        } else {
            aise.mozCheckAgain();
        }
    };

    this.mozCheckAgain = function () {
        if (typeof (antwoord) == "string") {
            if (antwoord == "") {
                window.setTimeout("aise.mozCheckAgain()", 1000);
            } else {
                aise.putXMLhere();
            }
        } else {
            window.setTimeout("aise.mozCheckAgain()", 1000);
        }
    };

    this.CheckAgain = function () {
        if (me.oScript.readyState == "loaded") {
            eval(me.callback);
            me.oScript.onreadystatechange = null;
        }
    };

    this.getChatStatus = function (id, url, app) {
        this.oScriptChat = D(id);
        var head = document.getElementsByTagName("head").item(0);
        if (this.oScriptChat) {
            head.removeChild(this.oScriptChat);
        }
        this.oScriptChat = document.createElement("script");
        var callURL = url + '?app=' + app;
        this.oScriptChat.setAttribute("src", callURL);
        this.oScriptChat.setAttribute("id", "chatcheckscript");
        head.appendChild(this.oScriptChat);

        if (isGeldigeIE()) {
            if (this.oScriptChat.readyState == "loaded") {
                this.oScriptChat.onreadystatechange = null;
                eval("me.checkChatStatus();");
            } else {
                this.oScriptChat.onreadystatechange = this.CheckAgainChat;
            }
        } else {
            aise.mozCheckAgainChat();
        }
    };

    this.checkChatStatus = function () {
        if (aiseAgentIsOnline == "false") {
        } else {
            //antwoord = antwoord + "<br />Wellicht kan &#233;&#233;n van mijn collega's u verder helpen. Klik <a href='https://backchat.lime-com.net/robeco-direct/default2.aspx?UID=" + me.lastReceived_uid + "' target='_blank' onClick='javascript:return aiseOpenChatWin(" + me.lastReceived_uid + ");'>hier</a> om een chat te starten met een van mijn collega's.";
            antwoord = antwoord + "<br />Vielleicht kann einer meiner Kollegen Ihnen weiterhelfen. Klicken Sie <a href='https://backchat.lime-com.net/selfservicecompany/default.aspx?UID=" + me.lastReceived_uid + "' target='_blank'>hier</a> um einen Chat mit einem Kollegen zu starten.";
        }
        this.lastReceived_antwoord = antwoord;
        this.putXMLherePart2();
    };

    this.mozCheckAgainChat = function () {
        if (typeof (aiseAgentIsOnline) == "string") {
            if (aiseAgentIsOnline == "") {
                window.setTimeout("aise.mozCheckAgain()", 1000);
            } else {
                aise.checkChatStatus();
            }
        } else {
            window.setTimeout("aise.mozCheckAgain()", 1000);
        }
    };

    this.CheckAgainChat = function () {
        if (me.oScriptChat.readyState == "loaded") {
            eval("me.checkChatStatus();");
            me.oScriptChat.onreadystatechange = null;
        }
    };

    var custom_welcome_ask = false;
    this.sendQuestion = function () {
        //	D('tscs_aiseResponseDiv').innerHTML = this.loadingHTML;
        custom_welcome_ask = false;
        this.getDataFromServer("ScriptTagID", this.proxyServer, RemoveXSS(D('tscs_question').value));
    };

    this.sendQuestionDirect = function (vraag) {
        //	D('tscs_aiseResponseDiv').innerHTML = this.loadingHTML;
        custom_welcome_ask = false;
        this.getDataFromServer("ScriptTagID", this.proxyServer, RemoveXSS(vraag));
    };

    this.sendQuestionInit = function () {
        //	D('tscs_aiseResponseDiv').innerHTML = this.loadingHTML;
        custom_welcome_ask = true;
        this.getDataFromServer("ScriptTagID", this.proxyServer, 'custom_welcome');
    };
    this.putXMLhere = function () {
        this.lastReceived_uid = uid;
        this.lastReceived_antwoord = antwoord;
        this.lastReceived_recnr = recnr;
        this.lastReceived_html = html;
        this.lastReceived_category = category;
        this.lastQuestion = RemoveXSS(D('tscs_question').value);

        if (this.RecNr1 == 'leeg') {         // nog geen vraag gesteld
            this.RecNr1 = recnr;
        } else if (this.RecNr2 == 'leeg') {  // pas 1 vraag gesteld
            this.RecNr2 = recnr;
        } else {                             //alles gevuld; dus meer dan 2 vragen gesteld
            this.RecNr1 = this.RecNr2;
            this.RecNr2 = recnr;
        }
        if (this.DoorverwijzingContact) {
            if (((this.RecNr1 != 'leeg' && this.RecNr2 != 'leeg') && ((isNaN(Number(this.RecNr1)) ? Number("1") : Number(this.RecNr1)) <= 0 && (isNaN(Number(this.RecNr2)) ? Number("1") : Number(this.RecNr2)) <= 0))) {
                this.lastReceived_html = html;
                this.lastReceived_antwoord = antwoord;
                this.getChatStatus("ScriptTagIDChat", this.proxychatServer, "ssc");
                return;
            }
        }

        this.putXMLherePart2();
    };

    this.putXMLherePart2 = function () {
        this.lastQuestion = RemoveXSS(this.lastQuestion);
        if (this.toonvraag) {
            D('tscs_aiseResponseDiv').innerHTML = "<span class='repeatquestion'><strong>" + this.lastQuestion + "</strong></span>" + "<p>" + antwoord + "</p>";
        } else {
            D('tscs_aiseResponseDiv').innerHTML = antwoord;
        }
        if (this.handigeVragen) {
            this.verwerkHandigeVragen(hvragen);
        }
        if (html != "") {
            if (this.doPagePush) {
                if (this.pagepushiframe) {
                    if (D("frame")) {
                        D("frame").src = html;
                    }
                } else {
                    document.location.href = html;
                }
            } else {
                D('tscs_aiseResponseDiv').innerHTML += '<br /><br /><a href=' + html + '>Meer info</a>';
            }
        }

        if (!custom_welcome_ask) {
            if (this.testing) {
                this.state = 3;
            } else {
                this.state = 2;
            }
        }
        this.changeState();
        if (this.state > 1) {
            if (this.toonvraag == true) {
                D('tscs_question').value = "";
                D('tscs_question').focus();
            } else {
                D('tscs_question').focus();
                D('tscs_question').select();
            }
        }
        antwoord = ""; // Leegmaken ivm firefox wait <- Deze controlleerd of antwoord gezet is.
    };

    this.SendOpmerking = function () {
        var rsIframe = D("RSIFrameOpmerking");
        var tmpant = this.lastReceived_antwoord; tmpant = tmpant.replace(/\'/g, "`"); tmpant = tmpant.replace(/\&\#/g, "|"); tmpant = tmpant.replace(/\&/g, " en ");
        var tmphtm = this.lastReceived_html; tmphtm = tmphtm.replace(/\'/g, "`");
        var tmpque = this.lastQuestion; tmpque = tmpque.replace(/\'/g, "`"); tmpque = tmpque.replace(/\&\#/g, "|"); tmpque = tmpque.replace(/\&/g, " en ");
        var tmpopm = D("tscs_invoerOpmerking").value; tmpopm = tmpopm.replace(/\'/g, "`"); tmpopm = tmpopm.replace(/\&/g, " en ");
        var tmptestfase = (me.feedbacktestfase == true) ? '1' : '0';

        var url = this.opmerkingUrl +
			'?pro=' + this.projectID +
			'&uid=' + this.lastReceived_uid +
			'&vraag=' + tmpque +
			'&antwoord=' + tmpant +
			'&rec=' + this.lastReceived_recnr +
			'&cat=' + this.lastReceived_category +
			'&commentaar=' + tmpopm +
			'&score=' + this.beoordeling +
			'&testfase=' + tmptestfase;
        url = url.replace(/</g, "<_");

        if (rsIframe == null) {
            var iframe = document.createElement("iframe");
            iframe.setAttribute("src", url);
            iframe.setAttribute("id", "RSIFrameOpmerking");
            iframe.setAttribute("scrolling", "no");
            iframe.setAttribute("frameBorder", "5");
            iframe.setAttribute("width", "0");
            iframe.setAttribute("height", "0");
            document.body.appendChild(iframe);
        } else {
            rsIframe.src = url;
        }
        D('tscs_divInvoerOpmerking').style.display = 'none';
        D('tscs_opmerkingtitel').style.display = 'none';
        this.state = 2;
        this.changeState();
        document.getElementsByName('beoordeling')[0].checked = false;
        document.getElementsByName('beoordeling')[1].checked = false;
        document.getElementsByName('beoordeling')[2].checked = false;
        D('tscs_invoerOpmerking').value = "";
    };
    this.changeBeoordeling = function (newValue) {
        this.beoordeling = newValue;
        if (this.beoordeling == 0) {
            D('tscs_divInvoerOpmerking').style.display = 'none';
            D('tscs_opmerkingtitel').style.display = 'none';
        } else {
            D('tscs_divInvoerOpmerking').style.display = '';
            D('tscs_opmerkingtitel').style.display = '';
            if (newValue == 1) {
                D('tscs_opmerkingtitel').innerHTML = 'Voeg hier het antwoord voor deze vraag toe:';
            }
            if (newValue == 2) {
                D('tscs_opmerkingtitel').innerHTML = 'Verduidelijk de fout in het antwoord:';
            }
        }
    };
};

//var basicurl		= "http://192.168.1.100/js/";
var serverPath = "http://projecten.elitech.nl";
var basicurl = serverPath + "/TSCS/js";

var aise = new elitechAise();
aise.projectID = 39; //49;   /* AISE projectID in de database*/
aise.instanceName = 'aise';     /* deze variabele niet veranderen */
aise.defaultFromtop = "0px";    /* startwaarde top van aise */
aise.defaultFromLeft = "0px";    /*307 startwaarde left van aise */
aise.defaultvraag[0] = "FAQ";
aise.defaultvraag[1] = "FAQ";
aise.handigeVragen = false;  	  /* Maak gebruik van handige vragen */
aise.state = 2;     	  /* initiële status op klein blokje. */
aise.doPagePush = true; 	     /* indien false verschijnt onder het antwoord een link naar de page push pagina */
aise.proxyServer = basicurl + "/proxy.asp";
aise.proxychatServer = basicurl + "/proxychat.asp";
aise.css = basicurl + "/sophie_callcenterworld.css";
aise.opmerkingUrl = serverPath + "/receiveopmerkingen.aspx";
aise.loadingHTML = "...";  	   /*  */
aise.showDivSources = false;      /* Debug only => laat content van de divs in textarea's zien. Handig tijdens opmaak van div's */
aise.useIframeIEfix = false;  	  /* aan uitzetten IE fix => wel of geen achterliggende iframes bij de divs. Div kan anders niet over selectboxen en flash heen liggen. */
aise.testing = false;      /* Wel of niet weergeven van de beoordelingsdiv na het krijgen van een antwoord; als niet aan, dan dus geen status3div */
aise.feedbacktestfase = true;
aise.pagepushiframe = false;
aise.toonvraag = true;


aise.frame1 += '<div id="tscs_status1div" class="tscs_status1" style="display:block;">';
aise.frame1 += '	<div id="tscs_aiseResponseDiv"></div>';
aise.frame1 += '	<div id="tscs_totinput">';
aise.frame1 += '		<div id="tscs_bginput"><input type="text" id="tscs_question" name="tscs_question" size="22" value="" class="tscs_tekstinput" onKeyPress="return checkEnter(event)" /></div>';
aise.frame1 += '		<div id="tscs_btnquestion"><a href="#" onMouseOver="javascript:swap(&#34;btnquestion&#34;,&#34;btnquestionon&#34;);" onMouseOut="javascript:swap(&#34;btnquestion&#34;,&#34;btnquestionoff&#34;);" onClick="aise.sendQuestion()"><img name="btnquestion" src="http://projecten.elitech.nl/tscs/img/fragestellen_off.gif" border="0" alt="Frage stellen" /></a></div>';
aise.frame1 += '	</div>';
aise.frame1 += '</div>';

aise.frame2 += '<div id="tscs_status2div" class="tscs_status2" style="display:none;">';
aise.frame2 += '</div>';

aise.frame3 += '<div id="tscs_status3div"  class="tscs_status3" style="display:none;">';
aise.frame3 += '	<div class="tscs_beoordeling">Geef hier per vraag aan wat u van het antwoord van Sophie vindt: <br /><br />';
aise.frame3 += '		<input type="radio" name="beoordeling" id="beoordelingGoed" value="Goed" onClick="aise.changeBeoordeling(0);aise.SendOpmerking();" />De vraag is goed beantwoord.<br />';
aise.frame3 += '		<input type="radio" name="beoordeling" id="beoordelingVerkeerdHerkend" value="Verkeerd herkend" onClick="aise.changeBeoordeling(1)" />De vraag wordt niet goed herkend.<br />';
aise.frame3 += '		<input type="radio" name="beoordeling" id="beoordelingFout" value="Fout" onClick="aise.changeBeoordeling(2)" />Het antwoord is inhoudelijk niet goed.<br /><br />';
aise.frame3 += '		<div id="tscs_divInvoerOpmerking" style="display:none;">';
aise.frame3 += '				<div id="tscs_opmerkingtitel"></div>';
aise.frame3 += '				<textarea id="tscs_invoerOpmerking" name="invoer" cols="20" rows="4" value=""></textarea><br /><br />';
aise.frame3 += '				<button class="tscs_button" onClick="aise.SendOpmerking();">Opmerking opslaan</button><br /><br />';
aise.frame3 += '		</div>';
aise.frame3 += '	</div>';
aise.frame3 += '</div>';

aise.parse(); /* Start aise */



/**********************************************************************/
/************** zie ook aise.frame1/2/3 variabelen ********************/
/**********************************************************************/
function isIE50() {
    return isIE5() && !isIE55();
}
function isIE() {
    return navigator.userAgent.indexOf("MSIE") > -1;
}
function isIE55() {
    return navigator.userAgent.indexOf("MSIE 5.5") > -1;
}
function isIE5() {
    return navigator.userAgent.indexOf("MSIE 5") > -1;
}
function isIE6() {
    return navigator.userAgent.indexOf("MSIE 6") > -1 && navigator.userAgent.indexOf("Opera") == -1;
}
function isIE7() {
    return navigator.userAgent.indexOf("MSIE 7") > -1;
}
function isGeldigeIE() {
    return isIE55() || isIE6() || isIE7();
}

function checkEnter(e) {
    /*versturen van de vraag indien op enter toets wordt gedrukt*/
    var key;

    if (window.event) {
        key = window.event.keyCode; //IE
    } else {
        key = e.which;              //firefox
    }
    if (key == 13) {
        aise.sendQuestion();
        return false;
    }

}
function move_up() {
    /* omhoog scrollen in de Faq div */
    D('faq').scrollTop = D('faq').scrollTop - 15;
}
function move_down() {
    /* omlaag scrollen in de Faq div */
    D('faq').scrollTop = D('faq').scrollTop + 15;
}

btnquestionon = new Image(); btnquestionon.src = "http://projecten.elitech.nl/tscs/img/fragestellen_on.gif";
btnquestionoff = new Image(); btnquestionoff.src = "http://projecten.elitech.nl/tscs/img/fragestellen_off.gif";

function swap() {
    if (document.images) {
        for (var x = 0; x < swap.arguments.length; x += 2) {
            document[swap.arguments[x]].src = eval(swap.arguments[x + 1] + ".src");
        }
    }
}

function RemoveXSS(str) {
    str = str.replace(/>/gi, " ").replace(/</gi, " ");          // '<' en '>'.
    str = str.replace(/%3e/gi, " ").replace(/%3c/gi, " ");      // url-encodering '<' en '>'.
    str = str.replace(/&#60;/gi, " ").replace(/&#62;/gi, " ");  // html-encodering '<' en '>'.
    str = str.replace(/javascript\:/gi, " ");                   // javascript-startstring.
    str = str.replace(/document\.\S/g, " ");                    // document-startstring.
    return str;
}
