<!--

var today = new Date();
var month_arr = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");

var datestr = month_arr[today.getMonth()] + " " + today.getDate().toString() + ", " + today.getFullYear().toString();
var year = today.getFullYear();

var date_arr = new Array();
var days_arr = new Array();

var howManyDays = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

date_arr[0]=new Option("January",1);
date_arr[1]=new Option("February",2);
date_arr[2]=new Option("March",3);
date_arr[3]=new Option("April",4);
date_arr[4]=new Option("May",5);
date_arr[5]=new Option("June",6);
date_arr[6]=new Option("July",7);
date_arr[7]=new Option("August",8);
date_arr[8]=new Option("September",9);
date_arr[9]=new Option("October",10);
date_arr[10]=new Option("November",11);
date_arr[11]=new Option("December",12);

function fill_select(f) {
   document.writeln("<select name=\"month\" onchange=\"update_days(document.thisForm)\">");
   for(x=0; x<12; x++) 
      document.writeln("<option value=\""+date_arr[x].value+"\">"+date_arr[x].text + "</option>");
   document.writeln("</select> &nbsp; <select name=\"day\"></select>&nbsp;");
}

function update_days(f) {
   var top;
   top = howManyDays[f.month.selectedIndex];
   var save;
   save = f.day.selectedIndex;
  
   for(x = 0; x < days_arr.length; x++) {
      days_arr[x] = null;
      f.day.options[x] = null;
   }
   if(top == 28) {
      year = parseInt(f.year.options[f.year.selectedIndex].value);
      if (year % 4 != 0 || year % 100 == 0 );
      else
         if (year % 400 == 0)  top = 29;
         else
            top = 29;
   }
   for(x=0; x < top; x++) {
      days_arr[x] = new Option(x + 1);            
      f.day.options[x]=days_arr[x];
   }
   if ((save >= 0) && (save < top))
      f.day.options[save].selected = true;
}       

function year_install(f, firstYear, lastYear) {
   document.writeln("<select name=\"year\", onchange=\"update_days(document.thisForm)\">")
   for(x = lastYear; x >= firstYear; x--) document.writeln("<option value=\"" + x + "\">" + x + "</option>");
   document.writeln("</select>");
   update_days(f)
}

function checkDate(formFieldObj,minus,plus) {
	
   var howManyDays = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
   var temp  = formFieldObj.value;
	var tempPartsArray = temp.split("/");
	var rangeString = "\n range from this year - " + minus + " to this year + " + plus;

	
	if (tempPartsArray.length < 3) {
	   alert("Invalid date format");
		formFieldObj.focus();
		return false;
	}
	
	month = tempPartsArray[0];
	day   = tempPartsArray[1];
	year  = tempPartsArray[2];
	
	if ((month != "--") && ((month < 1) || (month > 12))) {
	   alert("Invalid date format - incorrect month");
		formFieldObj.focus();
		return false;
	}
	
// check for leap year	
	if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0 )))
	   howManyDays[1] = 29;
	
	if ((day != "--") && ((day < 1) || (day > howManyDays[month - 1]))) {  // Jan = 1 but the array is zero based
	   alert("Invalid date format - incorrect day");
		formFieldObj.focus();
		return false;
   }
	
	today = new Date();  
	thisYear = today.getFullYear();
	
   if ((year < thisYear - minus) || (year > thisYear + plus)) {
	   alert("Invalid date format - Year out of range " + rangeString);
		formFieldObj.focus();
		return false;
	}
	return true;
}

function securemail (domain, username, type) {
   var address =  "";
   address = address + username + "@" + domain + "." + type;
window.open ('mailto:'+address,'_blank');
}

function popUpWindow(urlName, W, H) {
   var paramStr = "status=no, toolbar=no, location=no, menu=no, scrollbars=yes, directories=no, resizable=yes";
   paramStr += ", width=" + W + ", height=" + H;
   win = window.open(urlName, "WIN", paramStr);
}  // end of function PopUpWindow()

function NewWindow(urlName) {
	var paramStr = "status=yes, toolbar=yes, location=yes, menu=yes, scrollbars=yes, directories=yes, resizable=yes";
      newwin = window.open(urlName, "NEWWIN", paramStr);
}  // end of function PopUpWindow()

/***************************************************************************************************************
*
*  function PopUpGraphWindow - created Dec 2003
*  used to display full sized graphics in a pop-up window when a link or thumbnail is clicked
*
*  call with <a href="#" onclick="popUpGraphWindow('path/image.ext','Picture Caption',www,hhh);">LO</a>
*      where www and hhh are the integer width and height (without quotes) of the graphic.
*      NOTE - the window displayed is wider and higher than the graphic size.
*
*  The file called is graphwin.html and it must contain all the appropriate file header information
*      down to and including the </head> end tag.
*
****************************************************************************************************************/

function popUpGraphWindow(graphURL, graphStr, Width, Height) {
   
   if (Width > 294)
      var winWidth  = Width + 18;
   else
      var winWidth = 312;

   var winHeight = Height + 148;

   var paramStr = "status=no, toolbar=no, location=no, menu=no, directories=no, resizable=yes";
   paramStr += ", width=" + winWidth + ", height=" + winHeight;
   win = window.open("graphwin.html", "WIN", paramStr);

   // build the html in a string variable

   var bodyStr = "<body bgcolor='#ccffff'>";
   bodyStr += "<h1 style='font: 24pt Allegro BT, cursive'>ASHGI Graphic</h1>";
   bodyStr += "<center><img src='" + graphURL + "', alt='" + graphStr +
   "', width='" + Width + "', height='" + Height + "' / >";
   bodyStr += "</center><p style='font-weight: bold; text-align: center;'>" + graphStr + "</p>";
   bodyStr += "<a href='#' onclick='window.close();'>";
   bodyStr += "<img src='Images/closewindow.gif' width='100' height='12'></a>";
   bodyStr += "</body></html>";

   self.win.document.write(bodyStr);
   self.win.document.close();
}  // end of function PopUpGraphWindow()
 -->