function validate(){
	f = document.custom_graph;
	
	var startDate = new Date(f.s_mm.value+'/'+f.s_dd.value+'/'+f.s_yy.value);
	var endDate = new Date(f.e_mm.value+'/'+f.e_dd.value+'/'+f.e_yy.value);
	if(endDate <= startDate) {
		alert('The end date must be after the start date.');
		return false;
	}

	f.graph_start.value=f.s_yy.value+'-'+f.s_mm.value+'-'+f.s_dd.value;
	f.graph_end.value = f.e_yy.value+'-'+f.e_mm.value+'-'+f.e_dd.value;
	return true;
}

function ReplaceContentInContainer(id,content) {
        var container = document.getElementById(id);
        Spry.Utils.setInnerHTML(container,content);
}
function GenHistoricalCallback(request) {
        var result = request.xhRequest.responseText;
        var x = result.split(":");
        ReplaceContentInContainer(x[1],x[0]);
}
function GenHistorical(url) {
	point = window.center({width:100,height:100});
	showLayer('Processing',point);
	setTimeout("hideLayer('Processing')",600);
        Spry.Utils.submitForm('custom_graph', GenHistoricalCallback);
}
