function goMerchant(){
	if (document.merchlist.MID.options[document.merchlist.MID.selectedIndex].value != "") {
		window.location.href = document.merchlist.MID.options[document.merchlist.MID.selectedIndex].value;
		return false;
	}
}


var xmlDoc;

var browser=navigator.appName;

if (browser!="Microsoft Internet Explorer"){
	xmlDoc=new window.XMLHttpRequest();
	xmlDoc.open("GET","/visaperks/merchants.xml",false);
	xmlDoc.send("");
	xmlDoc=xmlDoc.responseXML;
}else{
	xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
	xmlDoc.async=false;
	xmlDoc.load("/visaperks/merchants.xml");
}

var x=xmlDoc.getElementsByTagName("merchant");
for (i=0;i<x.length;i++)
{ 
	var optionValue=x[i].getElementsByTagName("option")[0].childNodes[0].nodeValue;
	var path=x[i].getElementsByTagName("option")[0].getAttribute("path");
	var expiry_date=x[i].getElementsByTagName("expires")[0].childNodes[0].nodeValue;
	expiry_date = expiry_date.split("/")
	
	var the_date = new Date(expiry_date[2],expiry_date[1]-1,expiry_date[0],23,59,59 );
	var current_date = new Date();
	
	var merchant=optionValue
		
	if(the_date >= current_date){
		if (merchant == cur_merchant){
  			document.write("<option value=\"/visaperks/shopping/"+path+"/\" selected='selected'>"+optionValue+"</option>");
		}else if (path == "")  {
			document.write("<option value=\"/visaperks/category.jsp?category=all\">"+optionValue+"</option>");
		}else {
			document.write("<option value=\"/visaperks/shopping/"+path+"/\">"+optionValue+"</option>");
		}
	}
}

