// JScript source code

    //change the button to be able resize it with a background
    function CreateButton(Component)
    {
        jQuery(Component).each(

            function() {
                
                //new divs that will be added.
                var newLeft = jQuery('<div class="button_left">');
                var newRight = jQuery('<div class="button_right">');
                var newContent = jQuery('<div class="button_content">');
                var newInput = jQuery('<div class="total-button">');
                var t = this;
                
                //if the button is shown
                if (t.type!="hidden")
                {
                    jQuery(t).before(newInput);
                    jQuery(t).before(newLeft);

                    newInput.append(newLeft);
                    jQuery(t).before(newContent);                                

                    newInput.append(newContent);
                    newContent.prepend(t);    

                    jQuery(t).after(newRight);
                    newInput.append(newRight);
                    
                    if (navigator.appName=="Netscape")
                    {
                        jQuery(newInput[0]).width((jQuery(newLeft[0]).width() + jQuery(newRight[0]).width() + jQuery(t).width() + 10))
                    }
                }
            }
        );
    }
     
     
    //the button-container in a reactionblock is positioned inside the formholder. This functions moves the button-container to outside the formholder.
    function moveButtoncontainer()
    {
        jQuery('.addreactionblock .formholder').each(
            function() {
                
                var t = this;
                var buttonContainer = jQuery('.button-container', t);
                
                jQuery(t).after(buttonContainer);
            }
        );
    }
     
    //the checkboxes of an multiple response question are not placed in a div. This functions moves them inside a div to be able to float everything
    function changeForm()
    {
        jQuery('.surveycontainer .q_multipleresponse').each(
            function() {
                
                var t = this;
                var newDiv = jQuery('<div class="checkboxes">');
                var spanText = jQuery('.question-text',t);
                var getTables = jQuery('table',t);
                var getSelect = jQuery('select',t);
                var breakIt  = jQuery('br',t);             
                var element = new Array;
                var type = new Array;
                var aantalChilds;
                
                if ((getTables.length+getSelect.length)==0)
                {
                    breakIt.remove();
                    aantalChilds = t.childNodes.length;
                    
                    for (var x = 0; x<aantalChilds;x++)
                    {
                        if (t.childNodes[x].tagName=='INPUT')
                        {    
                            element[x] = t.childNodes[x];
                            type[x] = t.childNodes[x].tagName;
                        }
                        
                        if (t.childNodes[x].tagName=="LABEL")
                        {
                            element[x] = t.childNodes[x];
                            type[x] = t.childNodes[x].tagName;
                        }
                    }
                    
                    for (var x = 0; x<aantalChilds;x++)
                    {
                        if(element[x] =='object');                        
                        {
                            newDiv.append(element[x]);
                        }
                        if(type[x] == 'LABEL')
                        {
                            newDiv.append(jQuery('<br>'));
                        }
                    }
                        
                    spanText.after(newDiv);
                }
            }
        );
    }
   
   //function to give the anchor of a tooltiptext a class to be able to style it differently from the other tags.
   function changeTooltiphost() {
      jQuery('.tooltipHost').each(
        function() {
            var t=this;
            var parent = jQuery(t).parent();
            parent.addClass('tooltipanchor');
        });
   }
   
//Project dependent functions 

//Start people;
    
    // Check wether a line on the homepage contains a block. If so give the line a margin at the bottom.
    function checkBlocks(strBlock) {
        var blocks = jQuery(strBlock +' .block-output').length;
    
        if (blocks>0) {
            jQuery(strBlock).css({marginBottom: '15px'});
        }
    }
    
    //Create a border around some components dependent on which block they're in.
    function createBorders(strBlock) {
        jQuery(strBlock + ' .block-output').each( 
            function(){
                var t = this;
                var doorgaan = 0;
                var classes = new Array;
                
                classes = t.className.split(" ");
                
                
                //Filedisplayblocks don't need a border.
                for(var x = 0;x<classes.length;x++)
                {
                    if (classes[x]=='filedisplayblock' || classes[x]=='bannerBlock') {
                        doorgaan = 1;
                    }
                }
                
                //Create the border with corners
                if(doorgaan==0) {
                    var divNewBlock = jQuery('<div class="newBlock">');
                    
                    var divtop = jQuery('<div class="cornertop">');
                    var divbottom = jQuery('<div class="cornerbottom">');
                    
                    jQuery(divNewBlock).append(divtop);

                    jQuery(t).before(divNewBlock);
                    divNewBlock.append(t);
                    
                    jQuery(divNewBlock).append(divbottom);
                }
            });
    }

    function makeSameSize(block) {    
        var heightLine1 = jQuery(block).height();
        
        if(navigator.appName=="Netscape") {
            heightLine1 =heightLine1 - 22;
        }
        
        jQuery(block + ' .newBlock').each(
            function() {
                var t = this;
                
                if(jQuery(t).height()!=heightLine1) {
                    jQuery(t).height(heightLine1);
                }
            }
        );
    }
