// JavaScript Document

/*********************************************************************************/
clickMenu = function(menu) {
	var getEls = document.getElementById(menu).getElementsByTagName("LI");
	var getAgn = getEls;

	for (var i=0; i<getEls.length; i++) {
			getEls[i].onclick=function() {
				for (var x=0; x<getAgn.length; x++) {
				getAgn[x].className=getAgn[x].className.replace("unclick", "");
				getAgn[x].className=getAgn[x].className.replace("click", "unclick");
				}
			if ((this.className.indexOf('unclick'))!=-1) {
				this.className=this.className.replace("unclick", "");;
				}
				else {
				this.className+=" click";
				}
			}
			getEls[i].onmouseover=function() {
				this.className+=" hover";
			}
			getEls[i].onmouseout=function() {
				this.className=this.className.replace("hover", "");
			}
		}
	}
	
	function updateSelectnew(cal) {
		var date = cal.date;
		var selectMonth = document.getElementById("date_month");
		selectMonth.selectedIndex = date.getMonth();
		var selectDay = document.getElementById("date_day");
		selectDay.selectedIndex = (date.getDate() - 1);
		var selectYear = document.getElementById("date_year");
		selectYear.selectedIndex = (date.getFullYear() - (date.getFullYear()-1));
	}

	function updateSelectnew2(cal) {
		var date = cal.date;
		var selectMonth = document.getElementById("date_month2");
		selectMonth.selectedIndex = date.getMonth();
		var selectDay = document.getElementById("date_day2");
		selectDay.selectedIndex = (date.getDate() - 1);
		var selectYear = document.getElementById("date_year2");
		selectYear.selectedIndex = (date.getFullYear() - (date.getFullYear()-1));
	}


	function updateSelect(cal) {
	    document.frmSearch.date_month.disabled = false;
	    document.frmSearch.date_day.disabled = false;
	    document.frmSearch.date_year.disabled = false;
		var date = cal.date;
		var selectMonth = document.getElementById("date_month");
		var selectMonth2 = document.getElementById("date_month2");
		selectMonth.selectedIndex = date.getMonth();
		selectMonth2.value = date.getMonth()+1;
		var selectDay = document.getElementById("date_day");
		var selectDay2 = document.getElementById("date_day2");
		selectDay.selectedIndex = (date.getDate() - 1);
		selectDay2.value = date.getDate();
		var selectYear = document.getElementById("date_year");
		var selectYear2 = document.getElementById("date_year2");
		selectYear.selectedIndex = (date.getFullYear() - 2009);
		selectYear2.value = date.getFullYear();
	}
	function disableSelect() {
	    document.frmSearch.date_month.disabled = true;
	    document.frmSearch.date_day.disabled = true;
	    document.frmSearch.date_year.disabled = true;
	}	
	function enableSelect() {
	    document.frmSearch.date_month.disabled = false;
	    document.frmSearch.date_day.disabled = false;
	    document.frmSearch.date_year.disabled = false;
	}	
	function makeCurrent(){
		var aaj = new Date();
		document.getElementById('date_day2').value = aaj.getDate();
		document.getElementById('date_month2').value = (aaj.getMonth()+1);
		document.getElementById('date_year2').value = aaj.getFullYear();
		
		document.getElementById('date_day').selectedIndex = (aaj.getDate() - 1);
		document.getElementById('date_month').selectedIndex = aaj.getMonth();
		document.getElementById('date_year').selectedIndex = (aaj.getFullYear() - 2009);		
	}
	
	function makeCurrentDate()
	{
		var aaj = new Date();
		var currentTime = new Date()
		currentTime.setDate(currentTime.getDate()+30);

		document.frmSearch.date_day.selectedIndex = (aaj.getDate() - 1);
		document.frmSearch.date_month.selectedIndex = aaj.getMonth();
		document.frmSearch.date_year.selectedIndex = (aaj.getYear() - 2009);

		document.frmSearch.date_day2.selectedIndex = (currentTime.getDate() - 1);
		document.frmSearch.date_month2.selectedIndex = (currentTime.getMonth());
		document.frmSearch.date_year2.selectedIndex = (currentTime.getYear() - 2009);
	}


	function updateSelectnewa(cal) {
		var date = cal.date;
		var selectMonth = document.getElementById("datemonth");
		selectMonth.selectedIndex = date.getMonth();
		var selectDay = document.getElementById("dateday");
		selectDay.selectedIndex = (date.getDate() - 1);
		var selectYear = document.getElementById("dateyear");
		selectYear.selectedIndex = (date.getFullYear() - 2009);
	}

	function updateSelectnew2a(cal) {
		var date = cal.date;
		var selectMonth = document.getElementById("datemonth2");
		selectMonth.selectedIndex = date.getMonth();
		var selectDay = document.getElementById("dateday2");
		selectDay.selectedIndex = (date.getDate() - 1);
		var selectYear = document.getElementById("dateyear2");
		selectYear.selectedIndex = (date.getFullYear() - 2009);
	}
