//TODO:: optimise
TESCODIRECT.lib.event.attach(window,"load",function(e){
   if (document.getElementsByName('carouselCheckBox')){
        loadAll();
    }
},false)

function loadAll(){
    var list = document.getElementsByTagName ('input');
    if(!list){
        return;
    }
    for (var i = 0; i < list.length; ++i){
        if(list[i].id.indexOf('Services')!=-1 && (list[i].type=="checkbox" || list[i].type=="radio")){

            TESCODIRECT.lib.event.attach(list[i],"click", function(e){
                var input = e.target;

//unsafe code. Should check if the node we are replacing is the correct one.
                if(input.checked == true){
                   input.parentNode.replaceChild(document.createTextNode("Selected "), input.parentNode.firstChild);    
                }else{
                   input.parentNode.replaceChild(document.createTextNode("Select Item "), input.parentNode.firstChild);
                }
            },false)

        }
    }
}