function addloadevent(thefunc){
var oldfunc=window.onload;
if (typeof oldfunc!='function'){
window.onload=thefunc;
}
else{
window.onload=function(){
	oldfunc();
	thefunc();
}
}
}

function createxmlhttp()
{
xmlhttpobj = false;
try{
xmlhttpobj = new XMLHttpRequest;
}catch(e){
try{
xmlhttpobj=new ActiveXObject("MSXML2.XMLHTTP");
}catch(e2){
try{
xmlhttpobj=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e3){
xmlhttpobj = false;
}
}
}
return xmlhttpobj;
} 

function mctlist(){
var xmlhttpobj=createxmlhttp();
var url="http://www.365ebuy.com/365include/pullmctlist.asp";
xmlhttpobj.onreadystatechange=handlechange;
xmlhttpobj.open("get",url,true);
xmlhttpobj.send(null);
}
function handlechange(){
if(xmlhttpobj.readyState==4){
	if(xmlhttpobj.status==200){
		var mctlist=document.getElementById("mctlist");
		var thexml=xmlhttpobj.responseXML;
		var merchants=thexml.getElementsByTagName("merchant");
		var mctnames=thexml.getElementsByTagName("mctname");
		var rebates=thexml.getElementsByTagName("rebate");
		for(var i=0;i<merchants.length;i++){
			merchant=merchants[i].firstChild.nodeValue;
			mctname=mctnames[i].firstChild.nodeValue;
			rebate=rebates[i].firstChild.nodeValue;
			if(rebate!=0){
				showtxt=mctname+'(·µ'+rebate+')';
			}else{
				showtxt=mctname;
				}
			var myoption=document.createElement("option");
			mctlist.options.add(myoption);
			myoption.innerText=showtxt;
			myoption.textContent=showtxt;
			myoption.value='http://www.365ebuy.com/'+merchant+'.html';
			}
		}

		}
	}
addloadevent(mctlist)
