/*
var agt = navigator.userAgent.toLowerCase();
var versInt = parseInt(navigator.appVersion);
var is_ie	= ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3    = (is_ie && (versInt < 4));
var is_ie4    = (is_ie && (versInt == 4) && (agt.indexOf("msie 4")!=-1) );
var is_aol   = (agt.indexOf("aol") != -1);
var is_aol3  = (is_aol && is_ie3);
var is_aol4  = (is_aol && is_ie4);
var is_aol5  = (agt.indexOf("aol 5") != -1);
var is_aol6  = (agt.indexOf("aol 6") != -1);
var is_comp   = (agt.indexOf("compuserve") != -1);
var is_comp2000   = (agt.indexOf("cs") != -1);	 
var is_compie = (is_comp && is_ie);
//var route_window = null;
var sprior = null;
var tprior = null;
*/
var site_url = "../route/";

function show_route( sub_dir, file_name, label, option )
{
	var msg = site_url + "RideServer.php?";
	
	if ( label )
	{
		msg = msg + "Label=" + label;
	}
	else
	{
		return false;
	}
	
	if ( sub_dir )
	{
		msg = msg + "&SubDir=" + sub_dir;
	}
	if ( file_name )
	{
		if ( file_name=="Calendar" )
		{
			file_name="general";
		}
		msg = msg + "&FileName=" + file_name;
	}
	
	if ( option > 0 )
	{
		msg = msg + "&Option=" + option;
	}
	
	location.href = msg;
	return false;
}	

function show_weekly( )
{
	today = new Date();
	var tm = today.getMonth() + 1;
	if (today.getDate() > 15)
	{
		tm++;
	}
	return show_route("", "weekly-" + tm , "none", 5);
}	

function show_this_week()
{
	site_url = "route/";
	return show_weekly();
}

function get_archive()
{
	var m;
	var y;
	var p;
	with (document.coaster)
	{
		mm=month.selectedIndex;
		yy=year.selectedIndex;
		m=month.options[mm].value;
		y=year.options[yy].value;
		if ( yy == 0 )
		{
			var today = new Date();
			var tm = today.getMonth();
			if (tm < mm)
			{
				window.alert("Newsletter edition for this month not yet added to archives.");
				return false;
			}
		}
	}
	p='newsletter-pdf/' + y + '/' + y + '-' + m + '.pdf';
	location.href = p;
	return false;
}