var xmlDoc;
if (window.ActiveXObject)
{
	xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	xmlDoc.async=false;
	xmlDoc.load("promotions.xml");
}
else if(window.XMLHttpRequest)
{
	var d = new XMLHttpRequest();
	d.open("GET", "promotions.xml", false);
	d.send(null);
	xmlDoc=d.responseXML;
} else {
	xmlDoc = document.implementation.createDocument("","",null);
	xmlDoc.async=false;
	xmlDoc.load("promotions.xml");
}


//xmlDoc.async=false;
//xmlDoc.load("promotions.xml");

var xmlwu=xmlDoc.getElementsByTagName("PROMOTION");

var monthtxt=['', '1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'];

function showProm(temp){
	var st='';
	var tempM = temp.substring(4);
	var tempY = temp.substring(0,4);
	var PromoArray = new Array;

for(j=0;j<=xmlwu.length-1;j++){
	if(tempM==xmlwu[j].getElementsByTagName("MONTH")[0].childNodes[0].nodeValue && tempY==xmlwu[j].getElementsByTagName("YEAR")[0].childNodes[0].nodeValue){
		st='';
		
		st +="<table cellpadding=\"0\" cellspacing=\"0\" class=\"promoTable\" style=\"background:url(images/calendar_2/"+ xmlwu[j].getElementsByTagName("BGIMG")[0].childNodes[0].nodeValue+") no-repeat; width=\""+ xmlwu[j].getElementsByTagName("BGIMG")[0].getAttribute('width')+ "\" height=\"" +xmlwu[j].getElementsByTagName("BGIMG")[0].getAttribute('height')+"\"><tr><td class=\"title\" style=\"color:#"+xmlwu[j].getElementsByTagName("TITLE")[0].getAttribute('color')+";\">"+xmlwu[j].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue+"</td></tr><tr><td class=\"date\" style=\"color:#"+xmlwu[j].getElementsByTagName("MONTH")[0].getAttribute('color')+";\">"+xmlwu[j].getElementsByTagName("YEAR")[0].childNodes[0].nodeValue+"年"+monthtxt[xmlwu[j].getElementsByTagName("MONTH")[0].childNodes[0].nodeValue]+"</td></tr><tr><td class=\"maincontent\" style=\"color:#"+xmlwu[j].getElementsByTagName("CONTENT")[0].getAttribute('color')+";\">"+xmlwu[j].getElementsByTagName("CONTENT")[0].childNodes[0].nodeValue+"</td></tr></table>";
		
	
	PromoArray[xmlwu[j].getElementsByTagName("ORDER")[0].childNodes[0].nodeValue] = st;
	}
}

return PromoArray;


}

function setActiveTab(tabID) {

	var currTabElem = document.getElementById(tabID);

	currTabElem.setAttribute("class", "some_class_name");
	currTabElem.setAttribute("className", "some_class_name");

	return;
}


function existpromomy()
{
	var existm = new Array();
	var i = 0;
	for(j=0;j<=xmlwu.length-1;j++){
		if(xmlwu[j].getElementsByTagName("MONTH")[0].childNodes[0].nodeValue >=1  && xmlwu[j].getElementsByTagName("MONTH")[0].childNodes[0].nodeValue <=12 ){
			existm[i]= xmlwu[j].getElementsByTagName("YEAR")[0].childNodes[0].nodeValue + xmlwu[j].getElementsByTagName("MONTH")[0].childNodes[0].nodeValue;
			i++;
		}
	}
	return existm;
}


function showpulldownmenu()
{
	var d=new Date();
	var curMonth  = d.getMonth() + 1;
	var curYear = d.getFullYear();
	
	var existm = new Array();
	var i = 0;
	for(j=0;j<=xmlwu.length-1;j++){
		m = xmlwu[j].getElementsByTagName("MONTH")[0].childNodes[0].nodeValue;
		y = xmlwu[j].getElementsByTagName("YEAR")[0].childNodes[0].nodeValue;
		if ( (y == curYear && m >=curMonth) || (y > curYear && m < curMonth) )
		{
			//existm[i]= monthtxt[m] + " " +y;
			existm[i]= "<option value=\"" + y + m+ "\">"+monthtxt[m] + " " +y + "</option>";
			
			i++;
		}
	}
	
	return existm;
		
}