var today = new Date();
var first = new Date();
	first.setFullYear(2004);
	first.setMonth(10); 
	first.setDate(3);

var raw_date = new Date();
	raw_date.setFullYear(year);
	raw_date.setMonth(month - 1);
	raw_date.setDate(day);

var dest_year = 0;
var dest_month = 0;
var dest_day = 0;
	
var browser = navigator.appName;
	if (browser == "Microsoft Internet Explorer") 
	{
    	document.onkeydown=kpressed_IE;
	} 
	else 
	{
    	document.onkeydown=kpressed_others;
	}

function kpressed_IE(e) 
{		
    if (!e) 
		var e = window.event;
		
    if (e.keyCode) 
	{
        keycode = e.keyCode;
        if ((keycode == 39) || (keycode == 37)) 
		{
            window.event.keyCode = 0;
        }
    } 
	else 
	{
        keycode = e.which;
    }
	
    if (keycode == 39) // Right arrow
	{   		
      	/* if(raw_date >= today)
		{
			// Do nothing to raw_date - simply reload the current page
		}
		else
		{
			raw_date.setDate(raw_date.getDate() + 1);
		}
				
		dest_year = raw_date.getFullYear();
		dest_month = raw_date.getMonth() + 1;
		dest_day = raw_date.getDate();
		
		if(dest_month < 10) { dest_month = '0' + dest_month; }
		if(dest_day < 10) { dest_day = '0' + dest_day; }
		
		window.location = 'd/' + dest_year + dest_month + dest_day + '.html';
        return false; */
    } 
	else if (keycode == 37) // Left Arrow
	{
		if(raw_date <= first)
		{
			// Do nothing to raw_date - simply reload the current page
		}
		else
		{
			raw_date.setDate(raw_date.getDate() - 1);
		}
				
		dest_year = raw_date.getFullYear();
		dest_month = raw_date.getMonth() + 1;
		dest_day = raw_date.getDate();
		
		if(dest_month < 10) { dest_month = '0' + dest_month; }
		if(dest_day < 10) { dest_day = '0' + dest_day; }
		
		window.location = 'd/' + dest_year + dest_month + dest_day + '.html';
        return false;
    }
}

function kpressed_others(e) 
{
    if (e.which) 
	{
        keycode = e.which;
    } 
	else 
	{
        keycode = e.keyCode;
    }
	
    if (keycode == 39) // Right arrow
	{   		
      	/* if(raw_date >= today)
		{
			// Do nothing to raw_date - simply reload the current page
		}
		else
		{
			raw_date.setDate(raw_date.getDate() + 1);
		}
				
		dest_year = raw_date.getFullYear();
		dest_month = raw_date.getMonth() + 1;
		dest_day = raw_date.getDate();
		
		if(dest_month < 10) { dest_month = '0' + dest_month; }
		if(dest_day < 10) { dest_day = '0' + dest_day; }
		
		window.location = 'd/' + dest_year + dest_month + dest_day + '.html';
        return false; */
    } 
	else if (keycode == 37) // Left Arrow
	{
		if(raw_date <= first)
		{
			// Do nothing to raw_date - simply reload the current page
		}
		else
		{
			raw_date.setDate(raw_date.getDate() - 1);
		}
				
		dest_year = raw_date.getFullYear();
		dest_month = raw_date.getMonth() + 1;
		dest_day = raw_date.getDate();
		
		if(dest_month < 10) { dest_month = '0' + dest_month; }
		if(dest_day < 10) { dest_day = '0' + dest_day; }
		
		window.location = 'd/' + dest_year + dest_month + dest_day + '.html';
        return false;
    }
}