function getStartYear() {
	var year;
	year=2001;
	return year;
}

function getEndYear(choice){
	var year;
	var d = new Date();
	if (choice=="year"){
		year=d.getFullYear()-1;
	}
	else if (choice=="month"){
		if (d.getMonth()==0 || d.getMonth()==1){
			year=d.getFullYear()-1;
		}
		else{
			year=d.getFullYear();
		}
	}
	return year;
}

function getEndMonth(){
	var month;
	var d=new Date();
	
		if (d.getMonth()==0){
			month=11;
		}
		else if (d.getMonth()==1){
			month=12;
		}
		else{
			month=d.getMonth()-1;
		}
	return month;
}
function showMonth() {

	var startYear;
	var endYear;
	var myEle;
	var i;
	var index;
	var month;


	for (var q=document.choices.month.options.length;q>=0;q--){
		document.choices.month.options[q]=null;
	}
	for (var q=document.choices.year.options.length;q>=0;q--){
		document.choices.year.options[q]=null;
	}
	startYear=getStartYear();
	endYear=getEndYear("month");		
	month=getEndMonth();
	
	for (i=endYear; i>=startYear; i--){
		myEle=document.createElement("option");
		myEle.value=i;
		myEle.text=i;
		document.choices.year.add(myEle);
	}	
	for (i=month; i>=1; i--){
		myEle=document.createElement("option");
		myEle.value=i;
		myEle.text=i;
		document.choices.month.add(myEle);
	}	
	document.getElementById('MonthShowMe').style.visibility='visible';
	return true;
}

function showYear() {

	var startYear;
	var endYear;
	var myEle;
	var i;
	var index;


	document.getElementById('MonthShowMe').style.visibility='hidden';

	startYear=getStartYear();
	endYear=getEndYear("year");
	
	for (var q=document.choices.year.options.length;q>=0;q--){
		document.choices.year.options[q]=null;
	}
	for (i=endYear; i>=startYear; i--){
		myEle=document.createElement("option");
		myEle.value=i;
		myEle.text=i;
		document.choices.year.add(myEle);
	}	
	return true;
}
function Change() {
	var myEle;
	var i;
	var index;
	var month;
	var d = new Date();
	
	if (document.choices.year.value==d.getFullYear()){
		for (var q=document.choices.month.options.length;q>=0;q--){
			document.choices.month.options[q]=null;
		}
	
		month=getEndMonth();
	
		for (i=month; i>=1; i--){
			myEle=document.createElement("option");
			myEle.value=i;
			myEle.text=i;
			document.choices.month.add(myEle);
		}	
	}
	else{
		for (var q=document.choices.month.options.length;q>=0;q--){
			document.choices.month.options[q]=null;
		}
	
		month=12;
	
		for (i=month; i>=1; i--){
			myEle=document.createElement("option");
			myEle.value=i;
			myEle.text=i;
			document.choices.month.add(myEle);
		}	
	}
	return true;
}