var http_request = false;
var d=new Date();
var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
//Ensure correct for language. English is "January 1, 2004"
var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
var popWin = "";
//To Fix GetElementById functionality in IE
if (/msie/i.test (navigator.userAgent)) //only override IE
{
  document.nativeGetElementById = document.getElementById; 
  document.getElementById = function(id)
  {
    var elem = document.nativeGetElementById(id);
    if(elem)
    {
      //make sure that it is a valid match on id
      if(elem.attributes['id'].value == id)
      {
        return elem;
      }
      else
      {
        //otherwise find the correct element
        for(var i=1;i<document.all[id].length;i++)
        {
          if(document.all[id][i].attributes['id'].value == id)
          {
            return document.all[id][i];
          }
        }
      }
    }
    return null;
  }
}
function loading_graphic(){ document.getElementById("loading_graphic").style.display="inline"; }
function hide_loading_graphic(){ document.getElementById("loading_graphic").style.display="none"; }
//HTTP REQUEST HANDLER
function makeRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
         }
      } 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('Cannot create XMLHTTP instance');
         return false;
      }
      http_request.onreadystatechange = alertContents;
      http_request.open('GET', url + parameters, true);
      http_request.send(null);
}
//Pop-up window controller
function openwin(url, strWidth, strHeight) {
  if (popWin != "") {popWin.close()}
	leftStr = (screen.width-strWidth)/2;
	topStr = (screen.height-strHeight)/2-50;
	windowProperties = "toolbar=no,menubar=no,scrollbars=no,statusbar=no,height="+strHeight+",width="+strWidth+",left="+leftStr+",top="+topStr+"";
	popWin = window.open(url,'newWin',windowProperties);
}
//Button Toggle Functions
function toggleLayer(whichLayer)
{
  var elem;
  if( document.getElementById ) // this is the way the standards work
    			elem = document.getElementById( whichLayer );
  		else if( document.all ) // this is the way old msie versions work
      			elem = document.all[whichLayer];
  		else if( document.layers ) // this is the way nn4 works
    			elem = document.layers[whichLayer];
  elem.className = elem.className == 'hidden' ? 'unhidden' : 'hidden';
}
