var xmlDoc;
function loadXML()
 {
    if (window.ActiveXObject)
    {
        xmlDoc = new ActiveXObject("Microsoft.XMLHTTP")
        xmlDoc.onreadystatechange = checkData;
        xmlDoc.open("GET", "data.xml", true);
        xmlDoc.send(null);

    }
    else if (document.implementation && document.implementation.createDocument)
    {
        xmlDoc = new XMLHttpRequest();
        xmlDoc.onreadystatechange = checkData;
        xmlDoc.open("GET", "data.xml", true);
        xmlDoc.send(null);

    }
    else
    {
        alert('Your browser cannot handle this script');

    }

}
function checkReadyState(obj)
 {
    if (obj.readyState == 4)
    {
        if (obj.status == 200)
        {
            return true;

        }
        else
        {
            alert("Problem retrieving XML data");

        }

    }

}
function checkData() {
    if (checkReadyState(xmlDoc))
    {
        var response = xmlDoc.responseXML.documentElement;
        rightHTML = ""
        x = response.getElementsByTagName("item")
        for (i = 0; i < x.length; i++) {
            ctitle = x[i].getElementsByTagName("title");
            cdescription = x[i].getElementsByTagName("description");
            clinks = x[i].getElementsByTagName("link");

            rightHTML = "<h4>" + ctitle[0].firstChild.data + "</h4>"
            rightHTML = rightHTML + "<p>" + cdescription[0].firstChild.data + "</p>";
            rightHTML = rightHTML + "<a href='" + clinks[0].firstChild.data + "'>" + "Read the article &raquo;" + "</a>";
            //rightHTML = rightHTML + "<a href='" + links[0].firstChild.data + "'><img class='right' src='/content/ebiz/wilkinsonplus/page/landingmain/more.gif' /></a>"
            $('right' + i).empty().setHTML(rightHTML)

        }
        createCarousel();

    }

}
function createCarousel() {
    var ex6Carousel = new iCarousel("example_5_content", {
        idPrevious: "example_5_previous",
        idNext: "example_5_next",
        idToggle: "undefined",
        item: {
            klass: "example_5_item",
            size: 200

        },
        animation: {
            transition: Fx.Transitions.Back.easeOut,
            type: "fadeNscroll",
            direction: "top",
            duration: 1000,
            amount: 1,
            rotate: {
                type: "auto",
                interval: 6000,
                onMouseOver: "stop"

            }
            //animation: {
            //rotate: {
            //type: "manual"
            //},
            //direction: "top",
            //duration: 250,
            //amount: 1

        }

    });

}

window.addEvent('domready', 
function() {
    loadXML();

});