<!--

var windowPointers = new Array();
var xmlFeed = new Array();

function loadXml(windowId, xmlSource) {
if (window.XMLHttpRequest) {
  xhttp=new XMLHttpRequest();
} else {
  xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}

xhttp.open("GET",xmlSource,false);
xhttp.send("");

xmlFeed[windowId]=xhttp.responseXML;
windowPointers[windowId]=0;
}

function loadTimer(windowId, htmlElementId) {
    setInterval("loadCampaign(" + windowId + ", '" + htmlElementId + "')", 5000);
}

function loadCampaign(windowId, htmlElementId) {
var feedData = xmlFeed[windowId].getElementsByTagName("campaign");
var curPos = windowPointers[windowId];

if (curPos>=feedData.length) {
    curPos = 0;
}

var imgHtml = "";
var mouseOver = "";
var mouseClick = "";

if ((feedData[curPos].getElementsByTagName("out")[0].firstChild)!=null) {
    imgHtml = "<img src=\"" + (feedData[curPos].getElementsByTagName("out")[0].firstChild.data) + "\" alt=\"" + altText + "\" name=\"img_" + windowId + "\" id=\"img_" + windowId + "\" />";
}

if ((feedData[curPos].getElementsByTagName("over")[0].firstChild)!=null) {
    mouseOver = " onmouseout=\"changeImages('img_" + windowId + "', '" + (feedData[curPos].getElementsByTagName("over")[0].firstChild.data) + "'); return true;\"";
}

if ((feedData[curPos].getElementsByTagName("click")[0].firstChild)!=null) {
    mouseClick = " onmousedown=\"changeImages('img_" + windowId + "', '" + (feedData[curPos].getElementsByTagName("click")[0].firstChild.data) + "'); return true;\"";
}


var html = "<div class=\"box_" + windowId + "\">";

if ((feedData[curPos].getElementsByTagName("link")[0].firstChild)==null) {
    html = html + "<a href=\"#\" " + mouseOver + " " + mouseClick + ">" + imgHtml + "</a>";
} else {
    var linkUrl = (feedData[curPos].getElementsByTagName("link")[0].firstChild.data);
    var linkWindow = (feedData[curPos].getElementsByTagName("link")[0].getAttribute('window'));
    var altText = (feedData[curPos].getElementsByTagName("text")[0].firstChild.data);
    
    if (linkWindow=="n") {
        html = html + "<a href=\"" + linkUrl + "\" target=\"_blank\" " + mouseOver + " " + mouseClick + ">" + imgHtml + "</a>";
    } else if (linkWindow=="p") {
        html = html + "<a href=\"javascript:popup('" + linkUrl + "');\" " + mouseOver + " " + mouseClick + ">" + imgHtml + "</a>";
    } else {
        html = html + "<a href=\"" + linkUrl + "\" " + mouseOver + " " + mouseClick + ">" + imgHtml + "</a>";
    }
}

html = html + "</div>";

document.getElementById(htmlElementId).innerHTML = html;

curPos = curPos + 1;
windowPointers[windowId] = curPos;
return true;
}

// -->