
function writeWhatsnewMenu(){
	var month = 7;
	var year = 2010;
	if (month < 0)  { 
		month = 12 +  month; 
		year = year - 1;
	}
	var shortmonth = new Array ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	document.write ("<LABEL For=\'sel_whatsIdx\' style=\'display:none\'>View Archives</LABEL>");
	document.write ("<SELECT NAME=\'sel_whatsIdx\' id=\'sel_whatsIdx\' onChange=\'whatsNew_gotoIndex(this);\'>");
	document.write ("<OPTION VALUE=\'\'>View Archives</OPTION>");
	ry = year;
	for (i = 0; i<12; i++) {
		rm = month - i;
		if (rm < 0) {
			rm = 12 + (month - i);
			ry = year - 1;
		}
		document.write ("<OPTION VALUE=\'"+shortmonth[rm]+"_"+ry+".html'>"+shortmonth[rm]+" "+ry+"</OPTION>");
	}	
	document.write ("<OPTION VALUE=\'main.html\'>View all Archives</OPTION>");
	document.write ("</SELECT>");
}

function whatsNew_gotoIndex(obj) {
	var url = String(window.location);
	var filepart = obj.options[obj.selectedIndex].value;
	obj.options[0].selected = true;
	if (filepart =="") return;
	if ( url.indexOf("/en/") >= 0 ) {
		window.location = "http://gbcode.ofta.gov.hk/TuniS/www.ofta.gov.hk/en/whats_new/archives/" + filepart; 
	} else {
		window.location = "http://gbcode.ofta.gov.hk/TuniS/www.ofta.gov.hk/zh/whats_new/archives/" + filepart; 
	}
}

document.jsWhatsNew_Loaded = true;
