 function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}

var http = createRequestObject();
var http2 = createRequestObject();

function getTopBettingLinks(linkId,linkTypeId,thesite) {

	var theGetUrl = '/common/betlinks/1,21452,,00.xml?t=top&lid=' + linkId + '&ltid=' + linkTypeId + '&s=' + thesite;
	
    http.open('get', theGetUrl);
    http.onreadystatechange = handleToplink;
    http.send(null);

}

function handleToplink() {
    if(http.readyState == 4){
		var xmlDoc = http.responseXML;
		if (xmlDoc.getElementsByTagName("bettingLinks")[0].hasChildNodes() && document.getElementById('betlinks_top')) {
			//we have something to process
			document.getElementById('betlinks_top').innerHTML= xmlDoc.getElementsByTagName("bettingLinks")[0].firstChild.nodeValue;
		}
	}
}

function getBottomBettingLinks(linkId,linkTypeId,thesite) {

	var theGetUrl = '/common/betlinks/1,21452,,00.xml?t=bottom&lid=' + linkId + '&ltid=' + linkTypeId + '&s=' + thesite;
    http2.open('get', theGetUrl);
    http2.onreadystatechange = handleBottomlinks;
    http2.send(null);
}

function handleBottomlinks() {
    if(http2.readyState == 4){
		var xmlDoc = http2.responseXML;
		if (xmlDoc.getElementsByTagName("bettingLinks")[0].hasChildNodes() && document.getElementById('betlinks_bottom')) {
			//we have something to process
			document.getElementById('betlinks_bottom').innerHTML= xmlDoc.getElementsByTagName("bettingLinks")[0].firstChild.nodeValue;
		}
	}
}