﻿// JScript File
    // interne link
    function doIntLink(strUrl){
        var newurl = "string";
        var strsearch = "#";
        var startpos = 0;
        var letterNow = 0;
        letterNow = eval(document.getElementById('letter').value);
        ageNow = eval(document.getElementById('agetab').value);

        var strsearchIda = "&ida=";
        var startposIda = 0;
        startposIda = strUrl.indexOf(strsearchIda, 0);
        if (startposIda == -1){
            startpos = strUrl.indexOf(strsearch, 0);
            if (startpos == -1){
                newurl = strUrl + '&idl=' + letterNow + '&ida=' + ageNow;
            }
            else{
                newurl = strUrl.replace('#','&idl=' + letterNow + '&ida=' + ageNow + '#');
            }
        }
        else{
            startpos = strUrl.indexOf(strsearch, 0);
            if (startpos == -1){
                newurl = strUrl + '&idl=' + letterNow;
            }
            else{
                newurl = strUrl.replace('#','&idl=' + letterNow + '#');
            }
        }
        document.getElementById('linkurl').value = newurl;
        __doPostBack('openInternalLink','');
    }
    function doForum(){
        myWin = open();
        myWin.location.href = "ForumFront.aspx";
    }
    function doHome(){
        doIntLink("Stomavereniging.aspx?id=0")
    }
    function doDictLetter(strletter){
        document.getElementById('dictletter').value = strletter;
        __doPostBack('getLetter','');
    }
    function showHand(ctrl){
        ctrl.style.cursor = 'pointer';
    }
    function myTabChanged(val){
        document.getElementById('agetab').value = val;
    }
    function doButtonTop(val){
        var action =  document.getElementById('urlbtop' + val).value;
        if (action == 'lettergrootte')
        {
            //nothing
        }
        else {
            doIntLink(action);
        }
    }
    function doButtonBottom(val){
        var action =  document.getElementById('urlbbottom' + val).value;
        if (action == 'lettergrootte')
        {
            //nothing
        }
        else {
            doIntLink(action);
        }
    }
    function setMyTab(){
        var displayText;
        var strUrl = document.getElementById('urlDyn').value;
        var myTab;
        if (jnDivOpen('AjaxAgeTab_Volwassene') == true){
            displayText = document.getElementById('AjaxAgeTab_Volwassene').style.display;
            if (displayText != "none"){
                myTab = 1;
            }
        }
        if (jnDivOpen('AjaxAgeTab_Kind') == true){
            displayText = document.getElementById('AjaxAgeTab_Kind').style.display;
            if (displayText != "none"){
                myTab = 2;
            }
        }
        if (jnDivOpen('AjaxAgeTab_Baby') == true){
            displayText = document.getElementById('AjaxAgeTab_Baby').style.display;
            if (displayText != "none"){
                myTab = 3;
            }
        }
        document.getElementById('agetab').value = myTab;
        
        var strsearchIda = "&ida=";
        var startposIda = 0;
        var newurl = "string"
        
        strsearchIda = "&ida=0";
        startposIda = strUrl.indexOf(strsearchIda, 0);
        if (startposIda != -1){
            newurl = strUrl.replace(strsearchIda,'&ida=' + myTab);
        }
        strsearchIda = "&ida=1";
        startposIda = strUrl.indexOf(strsearchIda, 0);
        if (startposIda != -1){
            newurl = strUrl.replace(strsearchIda,'&ida=' + myTab);
        }
        strsearchIda = "&ida=2";
        startposIda = strUrl.indexOf(strsearchIda, 0);
        if (startposIda != -1){
            newurl = strUrl.replace(strsearchIda,'&ida=' + myTab);
        }
        strsearchIda = "&ida=3";
        startposIda = strUrl.indexOf(strsearchIda, 0);
        if (startposIda != -1){
            newurl = strUrl.replace(strsearchIda,'&ida=' + myTab);
        }

        document.getElementById('urlDyn').value = newurl;
    }
    function jnDivOpen(strDiv){
        var divProp = 0;
        try 
        {
        // haal een willekeurige eigenschap van divTreeview om te kijken om de div gevonden wordt
        divPropTrv = document.getElementById(strDiv).style.height;
            return true;
        }
        catch(e) 
        {
            return false;
        }
        finally
        {
            divPropTrv = null;
        }
    }
