function singleDaySelected(){
    showSingleDay();
    hideRange();
    hideMonthly();
    hideMonsoon();
    hideMapButton();
}
function rangeSelected(){
    hideSingleDay();
    showRange();
    hideMonthly();
    hideMonsoon();
    showMapButton();
}
function monthlySelected(){
    hideSingleDay();
    hideRange();
    showMonthly();
    hideMonsoon();
    showMapButton();
}
function monsoonSelected(){
    hideSingleDay();
    hideRange();
    hideMonthly();
    showMonsoon();
    showMapButton();
}

function showSingleDay(){
    MM_showHideLayers2('singleDay', '' , 'show'); 
}
function hideSingleDay(){
    MM_showHideLayers2('singleDay', '' , 'hide'); 
}
function showRange(){
    MM_showHideLayers2('rangeDay', '' , 'show'); 
}
function hideRange(){
    MM_showHideLayers2('rangeDay', '' , 'hide'); 
}
function showMonthly(){
    MM_showHideLayers2('monthly', '' , 'show'); 
}
function hideMonthly(){
    MM_showHideLayers2('monthly', '' , 'hide'); 
}
function showMonsoon(){
    MM_showHideLayers2('monsoon', '' , 'show'); 
}
function hideMonsoon(){
    MM_showHideLayers2('monsoon', '' , 'hide'); 
}
function showMapButton(){
    MM_showHideLayers2('mapButton', '' , 'show'); 
}
function hideMapButton(){
    MM_showHideLayers2('mapButton', '' , 'hide'); 
}



function selectDefaults(selectOption){
    if (selectOption ==  "" || selectOption == theForm.reportObject[0].value){
	theForm.reportObject[0].checked = true;
        singleDaySelected()
    } else if (selectOption == theForm.reportObject[1].value){
	theForm.reportObject[1].checked = true;
        rangeSelected();
    } else if (selectOption == theForm.reportObject[2].value){
	theForm.reportObject[2].checked = true;
        monthlySelected();
    } else if (selectOption == theForm.reportObject[3].value){
	theForm.reportObject[3].checked = true;
        monsoonSelected();
    }
}
function setDateFields(theDateStart, theDateEnd){
    theForm.reportDateStart.value = theDateStart;
    theForm.reportDateEnd.value = theDateEnd;
    //theForm.reportObject.value = (theDateStart == theDateEnd) ? "rain" : "rain-range";
}

function submitReportForm(){
    if (theForm.reportObject[0].checked){
        setDateFields(theForm.startDateSingle.value, theForm.startDateSingle.value);
    } else if (theForm.reportObject[1].checked){
        setDateFields(theForm.startDateRange.value, theForm.endDateRange.value);
    } else if (theForm.reportObject[2].checked){
        setMonthFields();
    } else if (theForm.reportObject[3].checked){
        setMonsoonFields();
    }
    theForm.submit();
}
function setMonthFields(){
    theForm.reportMonth.value = theForm.date_reading_mm.options[theForm.date_reading_mm.selectedIndex].value;
    theForm.reportYear.value = theForm.date_reading_yy.options[theForm.date_reading_yy.selectedIndex].value;
}
function setMonsoonFields(){
    theForm.reportYear.value = theForm.date_reading_yyyy.options[theForm.date_reading_yyyy.selectedIndex].value;
}