function showhide(target, trigger) {
	ref=document.getElementById(target);
	switch (ref.style.display) {
	  case "none":
		state="";
		link='<img src="/images/up-arrow.gif" alt="Hide" />';
		break;
	  default:
		state="none";
		link='<img src="/images/down-arrow.gif" alt="Show" />';
	}
	ref.style.display = state;
	document.getElementById(trigger).innerHTML = "<a href=\"javascript:showhide('"+target+"','"+trigger+"');\">"+link+"</a>";
}

function hideshow(target, trigger, show) {
	ref=document.getElementById(target);
	switch (show) {
	  case 1:
		state="";
//		link='<img src="/images/up-arrow.gif" alt="Hide" />';
		break;
	  default:
		state="none";
//		link='<img src="/images/down-arrow.gif" alt="Show" />';
	}
	ref.style.display = state;
//	document.getElementById(trigger).innerHTML = "<a href=\"javascript:showWeather('weather_body','"+target+"');\">"+link+"</a>";
}

function makeRequest(url, container) {
	var http_request = false;
	
	//Show loading
	//container_html = document.getElementById(container).innerHTML.split('</td><td style="width: 50%; vertical-align: top;">');
	//document.getElementById(container).innerHTML = container_html[0] + "</td><td><div style='float:right;background-color:red;color:white;z-index:1' align='right'>Loading...</div>" + container_html[1];
	document.getElementById(container).innerHTML = "<td colspan='2' style='vertical-align:top;height:100px'><div style='float:left;background-color:red;color:white;z-index:1;position:relative;'>Loading...</div></td>";
  //document.getElementById(container).innerHTML = "<td><div style='float:left;background-color:red;color:white;z-index:1;position:relative;'>Loading...</div>"+document.getElementById(container).innerHTML.substr(document.getElementById(container).innerHTML.indexOf('>')+1);
	//alert(document.getElementById(container).innerHTML);
	
	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        http_request.onreadystatechange = function() { alertContents(http_request, container); };
        http_request.open('GET', url, true);
        http_request.send(null);

    }

    function alertContents(http_request, container) {

        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                //alert(http_request.responseText);
								document.getElementById(container).innerHTML = http_request.responseText;
            } else {
                alert('There was a problem with the request.');
            }
        }

    }
    
function lastMod()
{
	var x = new Date (document.lastModified);
	//alert(document.lastModified);
	Modif = new Date(x.toGMTString());
	Year = takeYear(Modif);
	Month = Modif.getMonth();
	Day = Modif.getDate();
	Mod = (Date.UTC(Year,Month,Day,0,0,0))/86400000;
	x = new Date();
	today = new Date(x.toGMTString());
	Year2 = takeYear(today);
	Month2 = today.getMonth();
	Day2 = today.getDate();
	now = (Date.UTC(Year2,Month2,Day2,0,0,0))/86400000;
	daysago = now - Mod;
	//alert (daysago);
	if (daysago < 0) return '';
	unit = 'days';
	if (daysago > 730)
	{
		daysago = Math.floor(daysago/365);
		unit = 'years';
	}
	else if (daysago > 60)
	{
		daysago = Math.floor(daysago/30);
		unit = 'months';
	}
	else if (daysago > 14)
	{
		daysago = Math.floor(daysago/7);
		unit = 'weeks'
	}
	var towrite = 'Page last changed ';
	if (daysago == 0) towrite += 'today';
	else if (daysago == 1) towrite += 'yesterday';
	else towrite += daysago + ' ' + unit + ' ago';
	return towrite;
}


function takeYear(theDate)
{
	x = theDate.getYear();
	var y = x % 100;
	y += (y < 38) ? 2000 : 1900;
	return y;
}