function errorbox(msg,file_loc,line_no){

errorwindow=window.open('','','width=250,height=200,scrollbars=1,resizable=1');
errorwindow.document.write('<title>Error Window</title><center><b>JavaScript Error(s)</b></CENTER><Br>');
errorwindow.document.writeln('<B>Message: </B><FONT SIZE=2>' + msg + '</FONT><BR>');
errorwindow.document.writeln('<B>File: </B><FONT SIZE=2>' + file_loc + '</FONT><BR>');
errorwindow.document.writeln('<B>Line: </B><FONT SIZE=2>' + line_no + '</FONT><BR>');
errorwindow.document.writeln('<form><input type="button" value="Close window" onClick="window.close()"></form></center>');
errorwindow.document.close();
errorwindow.document.bgColor="white";
return true
}

onerror=errorbox

//<!-- By Robert B. Fine, Copyright 1999 Fine Software LLC
// Passed a  form field object that is expected to be a date, 
// Reformats the date as mm/dd/yyyy.  

// Special features:
// 1.  Passed an 'l' returns the last day of the current month
// 2.  Passed an 'L' returns the last day of the year
// 3.  Passed an 'f' returns the First day of the current month
// 4.  Passed an 'F' returns the First day of the year
// 3.  Passed an 't' or 'T' returns the today's date
// 4.  Date separator may be '/' or '-'.  Doesn't matter.

function checkdate(DateString,BlankOK) {
	var err = 0
	string = DateString.value
	var valid = "0123456789/-"
	var ok = "yes";
	var temp,x;
	var Today = new Date();

	if ( string.length  == 0 ) {
		if (  checkdate.arguments.length > 1 ) {
			DateString.value = "";
		}
		else{
			alert("The date may not be blank.");
			string = 't';
		}
	}

	switch (string){
		case 't' || 'T':	// Asked for Today
			b = Today.getMonth() + 1;
			d = Today.getDate();
			f = Today.getFullYear();
			break;	

		case 'f':	// Asked for First of Month
			Today.setDate(1);
			b = Today.getMonth() + 1;
			d = Today.getDate();
			f = Today.getFullYear();
			break;	

		case 'F':	// Asked for First of Year
			Today.setDate(1);
			b = 1;
			d = 1;
			f = Today.getFullYear();
			break;	

		case 'l':	// Asked for the Last Day of Month
			switch (Today.getMonth()){
				case 0:		// January
					Today.setDate(31);
					break;
				case 1:		// February
					if ((Today.getFullYear()/4)==parseInt(Today.getFullYear()/4)){
						if ((Today.getFullYear()/400)!=parseInt(Today.getFullYear()/400)){
							Today.setDate(28);
						} else {
							Today.setDate(29);
						}
					} else {
						Today.setDate(28);
					}
					break;
				case 2:		// March
					Today.setDate(31);
					break;
				case 3:		// April
					Today.setDate(30);
					break;
				case 4:		// May
					Today.setDate(31);
					break;
				case 5:		// June
					Today.setDate(30);
					break;
				case 6:		// July
					Today.setDate(31);
					break;
				case 7:		// August
					Today.setDate(31);
					break;
				case 8:		// September
					Today.setDate(30);
					break;
				case 9:		// October
					Today.setDate(31);
					break;
				case 10:	// November
					Today.setDate(30);
					break;
				case 11:	// December
					Today.setDate(31);
					break;


			}
			b = Today.getMonth() + 1;
			d = Today.getDate();
			f = Today.getFullYear();
			break;	

		case 'L':	// Asked for Last of Year
			Today.setDate(1);
			b = 12;
			d = 31;
			f = Today.getFullYear();
			break;	

		default:
			b = ""
			d = ""
			f = ""
			x = 0
			for (var i=0; i< string.length; i++) {
				temp = "" + string.substring(i, i+1);
				if (valid.indexOf(temp) == "-1") err = 1;
				if (temp == "/" || temp=="-"){
					x += 1;
				} else {

					switch (x) {
						case 0:
							b = b + "" + temp;
							break;
						case 1:
							d = d + "" + temp;
							break;
						case 2:
							f = f + "" + temp;
							break;
						default:
							break;
					}
				}
			}
			if (x != 2) err= 1;
	
		
	}

	if (b<1 || b>12) err = 1
	if (d<1 || d>31) err = 1
	if (f<0 ) err = 1
	if (f>0 && f<=70) g=parseInt(f) + 2000
	if (f>70 && f<=99) g=parseInt(f) + 1900
	if (f>99) g=parseInt(f)
	if (b==4 || b==6 || b==9 || b==11){
		if (d==31) err=1
	}
	if (b==2){
		var h=parseInt(f/4)
		if (isNaN(h)) {
			err=1
		}
		if (d>29) err=1
		if (d==29 && ((f/4)!=parseInt(f/4))) err=1
	}

	if (err==1) {
		alert('That is not a correct date. Please re-enter it');
		DateString.value="";
	}
	else {
		DateString.value=b+"/"+d+"/"+g;
	}
}

function plainWindow(URL){
  plain_window = window.open(URL,"plain","width=300,height=150, menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no");
  plain_window.focus();
}

function fullWindow(URL){
  plain_window = window.open('/scripts/fullwindow.asp?url=' + URL,"plain","height=400, menubar=yes,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes");
  plain_window.focus();
}

function printWindow(){
 bv = parseInt(navigator.appVersion);
 if (bv >= 4){ 
	window.print();
 }
 else
 {
 	alert("You must upgrade your browser!");
 }
}


var chkDot = true;
var usEmail = true;


function validEmail(eAddr) 
   { 
      var lenSuffix = (usEmail) ? 4 : 3;
      var result = false;
      var ndxAt = ndxDot = ndxDot2 = 0;
          
      ndxAt  = eAddr.indexOf("@");
      ndxDot = eAddr.indexOf(".") ;
      ndxDot2 = eAddr.lastIndexOf(".") ;

// Removed at the request of Myung - this checks for a dot in the beginning

//      else if (chkDot && (ndxDot < ndxAt) ){
//         chkDot = !( confirm("You entered a 'dot' before the '@'\nAre you sure that is right?") );
//	}


      if ((ndxDot < 0) || (ndxAt < 0)){
         alert("Your email address lacks '.' or '@'.\n\nThe format is 'you@dom.suf'"); 
	}
      else if ( (ndxDot2 - 3) <= ndxAt) {
	alert("You may be missing your domain name.\n\nThe format is 'you@dom.suf'");
	}
      else if (eAddr.length - ndxDot2 < lenSuffix ) { 
         usEmail = !(confirm("You have fewer than 3 characters as a domain suffix.\nAre you sure that is right?") );
	}
      else {
           result=true; 
	}
          
      return result; 
   } 



// -->

