//=========================================================
//
// CLIMO_SELECT.JS selectes prior climo data using pull-downs
//
//=========================================================

//=========================================================
//
// Display link category title
//
//=========================================================
	document.write('<br><br><font face="Verdana" size="4" color="Cyan">Climate Summaries:&nbsp;&nbsp;</font>')

//=========================================================
//
// Pull-down for detailed summaries (past two months only)
//
//=========================================================
	document.write('<select onChange="if (this.options.selectedIndex != 0) self.location=this.options[this.selectedIndex].value">') 
	document.write('<option selected>Detailed</option>')
	if (day == 1) {detail_month = month - 1, detail_prior = month - 2} else {detail_month = month, detail_prior = month - 1}
	detail_year = year
	detail_year_prior = year
	if (detail_month <= 0) {detail_month = detail_month + 12, detail_year = detail_year - 1}
	if (detail_prior <= 0) {detail_prior = detail_prior + 12, detail_year_prior = detail_year_prior - 1}
	document.write('<option value="http://gretnawx.net/monthly_details.php?month=current">',text_month[detail_month].substring(0,3),' ',detail_year,'</option>')
	document.write('<option value="http://gretnawx.net/monthly_details.php?month=prior">',text_month[detail_prior].substring(0,3),' ',detail_year_prior,'</option>')
	document.write('</select>&nbsp;&nbsp;')

//=========================================================
//
// Pull-down to select monthly summaries
//
//=========================================================
	document.write('<select onChange="if (this.options.selectedIndex != 0) self.location=this.options[this.selectedIndex].value">') 
	document.write('<option selected>Monthly</option>')
	selected_year = year
	while (selected_year >= 1997) {
		start_month = 1
		end_month = 12
		if (selected_year == 1997) {start_month = 4}
		if (selected_year == year) {end_month = month - 1}
		selected_month = start_month
		while (selected_month <= end_month) {
	     		if ((selected_year > 2002) || (selected_year == 2002 && selected_month > 2)) {
				if (selected_month == start_month) {document.write('<option disabled="disabled"> -- ',selected_year,' -- </option>')}
				document.write('<option value="http://gretnawx.net/monthly_climo.php?yy=',selected_year,'&mm=',selected_month,'">',text_month[selected_month].substring(0,3),'</option>')}
	     		if ((selected_year == 2002 && selected_month <= 2) || (selected_year < 2002)) {
				if (selected_month == start_month) {document.write('<option disabled="disabled"> -- ',selected_year,' -- </option>')}
				document.write('<option value="http://gretnawx.net/Data/Climo_Data/',selected_year,'/',text_month[selected_month],'.pdf">',text_month[selected_month].substring(0,3),'</option>')}
		selected_month++}
	selected_year--}
	document.write('</select>&nbsp;&nbsp;')

//=========================================================
//
// Pull-down to select annual summaries
//
//=========================================================
	document.write('<select onChange="if (this.options.selectedIndex != 0) self.location=this.options[this.selectedIndex].value">') 
	document.write('<option selected>Annual</option>')
	selected_year = year
	while (selected_year >= 1997) {
	     	if (selected_year >= 2002) {
			if (selected_year == year && month > 1) {document.write('<option value="http://gretnawx.net/yearly_climo.php?yy=',selected_year,'">',selected_year,'</option>')}
			if (selected_year < year) {document.write('<option value="http://gretnawx.net/yearly_climo.php?yy=',selected_year,'">',selected_year,'</option>')}}
	     	else {document.write('<option value="http://gretnawx.net/Data/Climo_Data/',selected_year,'/Annual.pdf">',selected_year,'</option>')}
	selected_year--}
	document.write('</select><br><br>')


//=========================================================
//
// End CLIMO_SELECT.JS 
//
//=========================================================