populateFilter = function ()
{
	var ddl = document.getElementById('newsFilter');
	if(ddl)
	{
		// first add default
		var opt = document.createElement('option');
		opt.value = "";
		opt.innerHTML = "Select a Month";
		ddl.appendChild(opt);
		
		// then add the rest 
		var dt = new Date();
		var y = dt.getFullYear();
		var currentMonth = dt.getMonth();
		var tmp = currentMonth;
		for(var i=0; i<6; i++)
		{
			var m, mm, value, sel;
			if(tmp < 0)
			{
				y = y - 1;
				tmp = 11;
				m = tmp;
			}
			else
			{
				m = tmp;
			}
			tmp = tmp - 1;
			
			mm = getFullMonth(m);
			value = y + "/" + mm + "/";
		
			// check if the option need selected state
			var currUrl = window.location.href.toString();
			sel = (currUrl.substr(currUrl.length-value.length) == value? true: false);
			
			var opt = document.createElement('option');
			opt.value = value;
			opt.innerHTML = mm + " " + y;
			if(sel) 
				opt.selected = sel;
			ddl.appendChild(opt);
		}
	}
}
getFullMonth = function (num)
{
	var month = "";
	switch(num)
	{
		case 0: month = "January"; break;
		case 1: month = "February"; break;
		case 2: month = "March" ; break;
		case 3: month = "April"; break;
		case 4: month = "May"; break;
		case 5: month = "June"; break;
		case 6: month = "July"; break;
		case 7: month = "August"; break;						
		case 8: month = "September"; break;						
		case 9: month = "October"; break;						
		case 10: month = "November"; break;															
		case 11: month = "December"; break;																		
	}
	return month;	
}

submitToArchive = function (frm, path) 
{
	var ddl = document.getElementById('newsFilter');
	if (path.lastIndexOf('?') > -1)
		path = path.substr(0, path.lastIndexOf('?'));
	
	frm.action = path + "/" + ddl.options[ddl.selectedIndex].value;
}