function initScripts() {

       $$('a.glossary').each(function(element,index) {  
		new ToolTip(element, element.getAttribute('desc'));
		 });


if (document.getElementById('searchme') != null) {
        $('searchme').addEvent('click', function(e){
        url = document.getElementById('searchta').value;
        window.location = "/search.html?keywords="+url;
        });
}
if (document.getElementById('websites') != null) {
        $('websites').addEvent('change', function(e){
        window.location = document.getElementById("websites").value;
        });
}

var searchta = $('searchta');
var searchtabase = document.getElementById('searchta').value;
        $('searchta').addEvent('focus', function(e){
       if (document.getElementById('searchta').value = searchtabase) { searchta.value = ''; }
        });

	$('searchta').addEvent('blur', function(e){
       if (searchta.value =='') { searchta.value = searchtabase; }
        });

	var firstadbasecolor = document.getElementById('firstad').style.color;
        $('firstad').addEvent('mouseover', function(e){
	$('firstad').style.color = "#ffffff";
        });

        $('firstad').addEvent('mouseout', function(e){
        $('firstad').style.color = firstadbasecolor;
        });

        $('secondad').addEvent('mouseover', function(e){
        $('secondad').style.color = "#ffffff";
        });

        $('secondad').addEvent('mouseout', function(e){
        $('secondad').style.color = firstadbasecolor;
        });


if (document.getElementById('boxone') != null) {

        $('boxone').addEvent('click', function(e){
        url = $('boxone').getElementsByTagName('a')[0].href;
        window.location = url;
        });

        $('boxone').addEvent('mouseover', function(e){
	theelement = $('boxone').getElementsByTagName('div')[0];
	theclass = $('boxone').getElementsByTagName('div')[0].className;
	if 	(theclass =="firstbox whatisdiabetes")	theelement.className = "firstbox whatisdiabetesover";
	else if (theclass =="firstbox whatisdiabetesover")	theelement.className = "firstbox whatisdiabetes";
        else if (theclass =="firstbox diagnosis")       theelement.className = "firstbox diagnosisover";
        else if (theclass =="firstbox diagnosisover")       theelement.className = "firstbox diagnosis";
        else if (theclass =="firstbox treatment")       theelement.className = "firstbox treatmentover";
        else if (theclass =="firstbox treatmentover")       theelement.className = "firstbox treatment";
        else if (theclass =="firstbox management")       theelement.className = "firstbox managementover";
        else if (theclass =="firstbox managementover")       theelement.className = "firstbox management";
        });

        $('boxone').addEvent('mouseout', function(e){
        theelement = $('boxone').getElementsByTagName('div')[0];
        theclass = $('boxone').getElementsByTagName('div')[0].className;
        if      (theclass =="firstbox whatisdiabetes")  theelement.className = "firstbox whatisdiabetesover";
        else if (theclass =="firstbox whatisdiabetesover")      theelement.className = "firstbox whatisdiabetes";
        else if (theclass =="firstbox diagnosis")       theelement.className = "firstbox diagnosisover";
        else if (theclass =="firstbox diagnosisover")       theelement.className = "firstbox diagnosis";
        else if (theclass =="firstbox treatment")       theelement.className = "firstbox treatmentover";
        else if (theclass =="firstbox treatmentover")       theelement.className = "firstbox treatment";
        else if (theclass =="firstbox management")       theelement.className = "firstbox managementover";
        else if (theclass =="firstbox managementover")       theelement.className = "firstbox management";
        });
}

if (document.getElementById('boxtwo') != null) {

        $('boxtwo').addEvent('click', function(e){
        url = $('boxtwo').getElementsByTagName('a')[0].href;
        window.location = url;
        });


        $('boxtwo').addEvent('mouseover', function(e){
        theelement = $('boxtwo').getElementsByTagName('div')[0];
        theclass = $('boxtwo').getElementsByTagName('div')[0].className;
        if      (theclass =="firstbox whatisdiabetes")  theelement.className = "firstbox whatisdiabetesover";
        else if (theclass =="firstbox whatisdiabetesover")      theelement.className = "firstbox whatisdiabetes";
        else if (theclass =="firstbox diagnosis")       theelement.className = "firstbox diagnosisover";
        else if (theclass =="firstbox diagnosisover")       theelement.className = "firstbox diagnosis";
        else if (theclass =="firstbox treatment")       theelement.className = "firstbox treatmentover";
        else if (theclass =="firstbox treatmentover")       theelement.className = "firstbox treatment";
        else if (theclass =="firstbox management")       theelement.className = "firstbox managementover";
        else if (theclass =="firstbox managementover")       theelement.className = "firstbox management";
        });

        $('boxtwo').addEvent('mouseout', function(e){
        theelement = $('boxtwo').getElementsByTagName('div')[0];
        theclass = $('boxtwo').getElementsByTagName('div')[0].className;
        if      (theclass =="firstbox whatisdiabetes")  theelement.className = "firstbox whatisdiabetesover";
        else if (theclass =="firstbox whatisdiabetesover")      theelement.className = "firstbox whatisdiabetes";
        else if (theclass =="firstbox diagnosis")       theelement.className = "firstbox diagnosisover";
        else if (theclass =="firstbox diagnosisover")       theelement.className = "firstbox diagnosis";
        else if (theclass =="firstbox treatment")       theelement.className = "firstbox treatmentover";
        else if (theclass =="firstbox treatmentover")       theelement.className = "firstbox treatment";
        else if (theclass =="firstbox management")       theelement.className = "firstbox managementover";
        else if (theclass =="firstbox managementover")       theelement.className = "firstbox management";
        });
}
if (document.getElementById('boxthree') != null) {

        $('boxthree').addEvent('click', function(e){
        url = $('boxthree').getElementsByTagName('a')[0].href;
        window.location = url;
        });


        $('boxthree').addEvent('mouseover', function(e){
        theelement = $('boxthree').getElementsByTagName('div')[0];
        theclass = $('boxthree').getElementsByTagName('div')[0].className;
        if      (theclass =="firstbox whatisdiabetes")  theelement.className = "firstbox whatisdiabetesover";
        else if (theclass =="firstbox whatisdiabetesover")      theelement.className = "firstbox whatisdiabetes";
        else if (theclass =="firstbox diagnosis")       theelement.className = "firstbox diagnosisover";
        else if (theclass =="firstbox diagnosisover")       theelement.className = "firstbox diagnosis";
        else if (theclass =="firstbox treatment")       theelement.className = "firstbox treatmentover";
        else if (theclass =="firstbox treatmentover")       theelement.className = "firstbox treatment";
        else if (theclass =="firstbox management")       theelement.className = "firstbox managementover";
        else if (theclass =="firstbox managementover")       theelement.className = "firstbox management";
        });

        $('boxthree').addEvent('mouseout', function(e){
        theelement = $('boxthree').getElementsByTagName('div')[0];
        theclass = $('boxthree').getElementsByTagName('div')[0].className;
        if      (theclass =="firstbox whatisdiabetes")  theelement.className = "firstbox whatisdiabetesover";
        else if (theclass =="firstbox whatisdiabetesover")      theelement.className = "firstbox whatisdiabetes";
        else if (theclass =="firstbox diagnosis")       theelement.className = "firstbox diagnosisover";
        else if (theclass =="firstbox diagnosisover")       theelement.className = "firstbox diagnosis";
        else if (theclass =="firstbox treatment")       theelement.className = "firstbox treatmentover";
        else if (theclass =="firstbox treatmentover")       theelement.className = "firstbox treatment";
        else if (theclass =="firstbox management")       theelement.className = "firstbox managementover";
        else if (theclass =="firstbox managementover")       theelement.className = "firstbox management";
        });
}
if (document.getElementById('boxfour') != null) {

        $('boxfour').addEvent('click', function(e){
        url = $('boxfour').getElementsByTagName('a')[0].href;
        window.location = url;
        });


        $('boxfour').addEvent('mouseover', function(e){
        theelement = $('boxfour').getElementsByTagName('div')[0];
        theclass = $('boxfour').getElementsByTagName('div')[0].className;
        if      (theclass =="firstbox whatisdiabetes")  theelement.className = "firstbox whatisdiabetesover";
        else if (theclass =="firstbox whatisdiabetesover")      theelement.className = "firstbox whatisdiabetes";
        else if (theclass =="firstbox diagnosis")       theelement.className = "firstbox diagnosisover";
        else if (theclass =="firstbox diagnosisover")       theelement.className = "firstbox diagnosis";
        else if (theclass =="firstbox treatment")       theelement.className = "firstbox treatmentover";
        else if (theclass =="firstbox treatmentover")       theelement.className = "firstbox treatment";
        else if (theclass =="firstbox management")       theelement.className = "firstbox managementover";
        else if (theclass =="firstbox managementover")       theelement.className = "firstbox management";
        });

        $('boxfour').addEvent('mouseout', function(e){
        theelement = $('boxfour').getElementsByTagName('div')[0];
        theclass = $('boxfour').getElementsByTagName('div')[0].className;
        if      (theclass =="firstbox whatisdiabetes")  theelement.className = "firstbox whatisdiabetesover";
        else if (theclass =="firstbox whatisdiabetesover")      theelement.className = "firstbox whatisdiabetes";
        else if (theclass =="firstbox diagnosis")       theelement.className = "firstbox diagnosisover";
        else if (theclass =="firstbox diagnosisover")       theelement.className = "firstbox diagnosis";
        else if (theclass =="firstbox treatment")       theelement.className = "firstbox treatmentover";
        else if (theclass =="firstbox treatmentover")       theelement.className = "firstbox treatment";
        else if (theclass =="firstbox management")       theelement.className = "firstbox managementover";
        else if (theclass =="firstbox managementover")       theelement.className = "firstbox management";
        });
}






var main = document.getElementById("main");
var oUL = main.getElementsByTagName("ol");

ol=document.getElementById('main').getElementsByTagName('ol');
for(i=0;i<ol.length;i++) {
lis = ol[i].getElementsByTagName('li');
	for(i=0;i<lis.length;i++) {
	lis[i].className = "ol"+(i+1);
	}
}






var list = $$('#submenu li');
list.each(function(element) {

var url = element.getElementsByTagName('a');
if (typeof url[0] != 'undefined') {
var fx = new Fx.Styles(element, {duration:200, wait:false});
element.addEvent('click', function(){
if (typeof url[0] != 'undefined') {
window.location = url[0].href;
}
});

element.addEvent('mouseenter', function(){
		fx.start({
		'padding-left': '10px'
		});
element.style.cursor = "pointer";
element.style.backgroundImage = "url(tl_files/therapy/EU/layout/indentli.gif)";
element.style.backgroundRepeat = "no-repeat";
element.style.backgroundPosition = "195px 2px";

	});

	element.addEvent('mouseleave', function(){
		fx.start({
			'padding-left': 0
		});
element.style.backgroundImage = "url()";
	});

}
});


















	var hostname = window.location.hostname;
	hostname = hostname.replace("www.","").toLowerCase();
	exitWarning = "0";
	if (hostname == "diabetes-info.co.uk") {
exitWarning = "Warning! You are living our website.";
} else if (hostname == "tanl.mdt.healthcommunication.com") {
exitWarning = "U verlaat nu de website van Medtronic, en u wordt verder geleid naar een andere website. Deze site zou zijn oorsprong in een ander land kunnen hebben. Derhalve kunnen er andere wettelijke bepalingen en regels van kracht zijn. Verder kan deze site product- en/of andere informatie bevatten die niet van toepassing is of niet relevant is voor uw land. Controleer eerst de gebruiksvoorwaarden van de site voor verdere details hierover. Indien u onder deze voorwaarden verder wenst te gaan, klik dan hieronder. ";
}
	var a = document.getElementById('main').getElementsByTagName("a");	
	function thecheck(obj){
		var href = obj.href.toLowerCase();
		return (href.indexOf("http://")!=-1 && href.indexOf(hostname)==-1) ? true : false;				
	};
	for (var i=0;i<a.length;i++){
		if (thecheck(a[i]) && exitWarning!="0") {
		a[i].onclick = function() {
			alert(exitWarning);
			}
		}
	};	



}

window.addEvent('domready', initScripts);
var ToolTip=new Class({
    initialize:function(trigger,content,options){

        this.setOptions({
            duration:300,transition:Fx.Transitions.linear,wait:false,tooltipClass:'yoo-tooltip',style:'default',width:350,display:'inline',mode:'cursor',sticky:0
        }
        ,options);
        this.open=false;
        this.trigger=$(trigger);
        this.trigger.setStyles(this.triggerstyles());
        this.tooltip=new Element('div',{
            'class':this.options.tooltipClass,'styles':{
                'position':'absolute','top':0,'left':0,'z-index':10,'visibility':'hidden','width':this.options.width
            }
        }
        ).injectTop(document.body);
        this.tooltip_style=new Element('div',{
            'class':this.options.style
        }
        ).injectInside(this.tooltip);
        this.tooltip_tl=new Element('div',{
            'class':'tooltip-tl','styles':{
                'width':this.options.width
            }
        }
        ).injectInside(this.tooltip_style);
        this.tooltip_tr=new Element('div',{
            'class':'tooltip-tr'
        }
        ).injectInside(this.tooltip_tl);
        this.tooltip_t=new Element('div',{
            'class':'tooltip-t','styles':{
                'height':15
            }
        }
        ).injectInside(this.tooltip_tr);
        this.tooltip_l=new Element('div',{
            'class':'tooltip-l','styles':{
                'width':this.options.width
            }
        }
        ).injectAfter(this.tooltip_tl);
        this.tooltip_r=new Element('div',{
            'class':'tooltip-r'
        }
        ).injectInside(this.tooltip_l);
        this.tooltip_m=new Element('div',{
            'class':'tooltip-m'
        }
        ).injectInside(this.tooltip_r).setHTML(content);
        this.tooltip_bl=new Element('div',{
            'class':'tooltip-bl','styles':{
                'width':this.options.width
            }
        }
        ).injectAfter(this.tooltip_l);
        this.tooltip_br=new Element('div',{
            'class':'tooltip-br'
        }
        ).injectInside(this.tooltip_bl);
        this.tooltip_b=new Element('div',{
            'class':'tooltip-b'
        }
        ).injectInside(this.tooltip_br);
        this.tooltip_arrow=new Element('div',{
            'class':'tooltip-arrow','styles':{
                'height':23
            }
        }
        ).injectInside(this.tooltip_b);
        if(this.options.sticky){
            this.close=new Element('div',{
                'class':'tooltip-close'
            }
            ).injectInside(this.tooltip_tl)
        }
        this.fx=new Fx.Styles(this.tooltip,this.options);
        this.trigger.addEvent('mouseenter',this.show.bindWithEvent(this));
        if(this.options.sticky){
            this.close.addEvent('mouseenter',this.hide.bindWithEvent(this))
        }
        else{
            this.trigger.addEvent('mouseleave',this.hide.bindWithEvent(this))
        }
    }
    ,show:function(event){
        if(!this.open){
            this.pos=this.position(event);
            this.tooltip.setStyles({
                'opacity':0,'top':this.pos.top+'px','left':this.pos.left+'px'
            }
            );
            this.fx.start({
                'opacity':1,'top':(this.pos.top-10)+'px'
            }
            );
            this.open=true
        }
    }
    ,hide:function(event){
        this.fx.start({
            'opacity':0,'top':(this.pos.top-20)+'px'
        }
        );
        this.open=false
    }
    ,position:function(event){
        var trg=this.trigger.getCoordinates();
        var tip=this.tooltip.getCoordinates();
        if(this.options.mode=='cursor'){
            var event=new Event(event);
            trg=$extend(trg,{
                'top':event.page.y,'left':event.page.x,'width':0
            }
            )
        }
        return{
            'top':trg.top-(tip.height),'left':trg.left-(tip.width/2)+(trg.width/2)
        }
    }
    ,triggerstyles:function(){
        var styles={
            'display':this.options.display
        }
        ;
        if(!this.trigger.getFirst())return styles;
        var first=this.trigger.getFirst().getCoordinates();
        return $extend(styles,{
            'width':first.width
        }
        )
    }
}
);
ToolTip.implement(new Options);
