var imgs = new Array();

        function loadClients(src) {
            var xmlDoc = loadXMLDoc(src);
            for (var i = 0; i < xmlDoc.getElementsByTagName("image").length; i++) {
                var image = xmlDoc.getElementsByTagName("image")[i];

                var path = image.getElementsByTagName("path")[0].childNodes[0].nodeValue;
                var link = image.getElementsByTagName("link")[0].childNodes[0].nodeValue;
                var target = image.getElementsByTagName("target")[0].childNodes[0].nodeValue;
                var style = "border:none; position:absolute; width:100%; height:100%; top: -16px; right: -12px; z-index: -500";

                imgs[i] = "img" + i;
                document.getElementById("client_images").innerHTML = document.getElementById("client_images").innerHTML + "<a href='" + link + "'><img id='img" + i + "' src='" + path + "' target='" + target + "' style='" + style + "' /></a>";
            }
        }

        var loadTimer = 3;
        //var loadImages = setTimeout("imgLoad()", 1000);
        function imgLoad() { //lets images load for loadTimer seconds
            loadTimer--;
            //document.getElementById("console").value = "Starting in " + loadTimer + "";
            if (loadTimer > 0)
                loadImages = setTimeout("imgLoad()", 1000);
            else {
                loadClients("client_images.xml");
                //document.getElementById("console").value = "";
                var t = setTimeout("timedCount()", 10);
                clearTimeout(loadImages);
            }
        }

        var timer = 0; //Global timer
        var index = 0; //Index of image being animated
        var previous = 0; //Index of i
        var animTime = 1 * 100; //# of seconds animation runs 
        var vertDistance = 500; //Distance for animation to cross vertically
        var horizDistance = 945; //Distance for animation to cross horizontally
        var delayTime = 0 * 100 + animTime; //timer value for delay (in seconds)

        function timedCount() {
            timer++;
            if (timer == 4) {
                $("#" + imgs[index]).css("z-index", "50");
                $("#" + imgs[index]).animate({ opacity: 1 }, "slow", function () { endAnimation(); });
            }
            t = setTimeout("timedCount()", 1000);
        }

        function fadeIn(index) {

        }

        function endAnimation() {
            timer = 0;

            if (index < imgs.length - 1) {
                if (index == 0) {
                    document.getElementById(imgs[previous]).style.zIndex = "-5"
                }
                previous = index;
                index++;
            }
            else {
                for (var i = 0; i < imgs.length - 1; i++) //put images in correct order except for last so last image stays on top for transition
                    document.getElementById(imgs[i]).style.zIndex = "0";
                document.getElementById(imgs[index]).style.zIndex = "0";
                previous = index;
                index = 0;
            }
            document.getElementById(imgs[index]).style.zIndex = "10";
            $("#" + imgs[index]).css("opacity", 0);
        }

        function getStyleString(txt, style) {
            var oElement = document.getElementById(txt), oStyle;
            if (window.getComputedStyle)
                eval("oStyle = window.getComputedStyle(oElement, null)." + style);
            else if (oElement.currentStyle)
                eval("oStyle = oElement.currentStyle." + style);
            return oStyle;
        }

        function loadXMLDoc(txt) {
            if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            }
            else {// code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.open("GET", txt, false);
            xmlhttp.send();
            xmlDoc = xmlhttp.responseXML;
            return xmlDoc;
        }
        

