﻿$(function() {
	var d = new Date(); var month = new Array(12);
	month[0] = "January";
	month[1] = "February";
	month[2] = "March";
	month[3] = "April";
	month[4] = "May";
	month[5] = "June";
	month[6] = "July";
	month[7] = "August";
	month[8] = "September";
	month[9] = "October";
	month[10] = "November";
	month[11] = "December";

	var monthDropDown = '<select name="searchMonth" id="searchMonth" class="expandblockbox">';

	var currentMonth = d.getMonth();

	monthDropDown += '<option value="0">Please select</option>';

	for (var i = 1; i <= 12; i++) {
		monthDropDown += '<option value="' + currentMonth + '">' + month[currentMonth - 1] + '</option>';

		currentMonth++;

		if (currentMonth > 12) {
			currentMonth = 1;
		}
	}

	monthDropDown += '</select>';

	$("#ctl00_Search_TextBox_Search").before(monthDropDown);

	var monthLabel = '<label for="searchMonth" id="Label_Month">or select <em>a month</em></label>';

	$("#labelSearch").before(monthLabel);

	$("#searchMonth").hide();
	$("#Label_Month").hide();



	$("#ctl00_Search_DropDownList_Category").change(function() {
		if ($(this).val() == "10") {
			$("#Label_Month").show();
			$("#labelSearch").hide();
			$("#ctl00_Search_TextBox_Search").hide();
			$("#searchMonth").show();
		}
		else {
			$("#Label_Month").hide();
			$("#labelSearch").show();
			$("#ctl00_Search_TextBox_Search").show();
			$("#searchMonth").hide();
		}
	});

	$("#searchMonth").change(function() {
		$("#ctl00_Search_HiddenField_Month").val($(this).val());
	});
});