//********************************************************************************
// THIS FUNCTION CHECKS FOR CORRECT EMAIL ADDRESS FORMAT
// somewhere in the body you must call the checkbae() function
// this code goes in the head tag
	var testresults
	function checkemail(){
	var str=document.form1.email.value
	var iPos = str.indexOf("@");
	sFirst = str.substr(0 , iPos);
	var sLast = str.substr(iPos+1,str.length - iPos - 1);
	sLast = sLast.toLowerCase();
	var iPos2 = sLast.indexOf(".");
	var sISP = sLast.substr(iPos2+1,sLast.length );
	var bDomain = false;
	if (sISP.length >= 2 && sISP.length <= 6)
		bDomain = true;
	if (iPos2 >= 1 && sFirst != "" && sLast != "" && bDomain  || str == "")		
		testresults=true
	else{
		alert("Please input a valid email address!")
	testresults=false
	document.form1.email.focus()
	}
	return (testresults)
	}

	function checkbae(){
		if (document.layers||document.getElementById||document.all)
			return checkemail()
		else
			return true
	}
//
//***********************************************************************************
// THIS FUNCTION CALLS EMAIL CHECK AND ONLY ALLOWS FOR ONE SUBMISSION OF THE FORM
// the form must be named "form1"  
//  AND  THERE HAS TO BE A FIELD NAMED  EMAIL  
// this is the submit button needed for the email address check function
// <input type="button" name="Button" value="Submit Request" onClick="oneClick()">
// this code goes in the head tag
// One click submit for email address
	counter = 0;
	function oneClickEA(){
		if (document.form1.uword){
			if(jcap()){
		if (checkbae()){
			if (counter < 1 ){
				document.form1.submit();
				counter++;
			}
			else
			alert("You have already submitted the form. Thank You!");
			}
		}
		}
	else {
		if (checkbae()){
			if (counter < 1 ){
				document.form1.submit();
				counter++;
			}
			else
			alert("You have already submitted the form. Thank You!");
		}
	}
	}
//***********************************************************************************
// THIS FUNCTION CHECKS FOR CORRECT EMAIL ADDRESS FORMAT AND THIEL DOMAIN (thiel.edu)
// somewhere in the body you must call the checkTCbae() function
// this code goes in the head tag
// Check for correct email address format and domain (thiel.edu)
	var testresults
	function checkTCemail(){
	var str=document.form1.email.value
	var iPos = str.indexOf("@");
	sFirst = str.substr(0 , iPos);
	var sLast = str.substr(iPos+1,str.length - iPos - 1);
	sLast = sLast.toLowerCase();
	if (sFirst != "" && sLast == "thiel.edu" || str == "")
		
testresults=true
	else{
		alert("Please input your valid Thiel email address!")
	testresults=false
	document.form1.email.focus()
	}
	return (testresults)
	}

	function checkTCbae(){
		if (document.layers||document.getElementById||document.all)
			return checkTCemail()
		else
			return true
	}
//***********************************************************************************
// THIS FUNCTION CALLS THIEL EMAIL CHECK AND ONLY ALLOWS FOR ONE SUBMISSION OF THE FORM
// the form must be named "form1"
// this is the submit button needed for the email address check function
// <input type="button" name="Button" value="Submit Request" onClick="oneClickTC()">
// this code goes in the head tag
// One click submit for TC email address
	counter = 0;
	function oneClickTC(){
		if (document.form1.uword){
		if (jcap()){
		if (checkTCbae()){
			if (counter < 1) {
				document.form1.submit();
				counter++;
			}
			else
			alert("You have already submitted the form. Thank You!");
			}
		}
		}
	else {
		if (checkTCbae()){
			if (counter < 1) {
				document.form1.submit();
				counter++;
			}
			else
			alert("You have already submitted the form. Thank You!");
			}
	  }
	}
//*************************************************************************************
// THIS FUNCTION ONLY ALLOWS FOR ONE SUBMISSION OF THE FORM
// the form must be named "form1"
// this is the submit button needed for this function
// <input type="button" name="Button" value="Submit Request" onClick="oneClick()">
// this code goes in the head tag
// One click submit
	counter = 0;
	function oneClick(){
		if (counter < 1) {
			document.form1.submit();
			counter++;
		}
		else
			alert("You have already submitted the form. Thank You!");
	}
///***************************************************************************************
// THIS FUNCTION WILL MOVE THE FOCUS FORM ONE FROM FIELD TO ANOTHER
// this is the call to the function from in side a form field
// OnKeyUp="changeFocus(this.value,3,'some_field_name')"
// this.value counts the number of characters in the field
// 3 is the character count when the focus will change
// some_field_name is the field to move the focus to
// Change Focus
	function changeFocus(strLen,size,newFocus){
		val = strLen.length ;
		if (val == size){
			document.app_form[newFocus].focus();
			}
		}
//***************************************************************************************
// THIS GROUP OF FUNCTIONS WILL PRINT THE DATE TO THE SCREEN IN TWO WAYS
// MONTH DD, YYYYY OR MM/DD/YYYYY
// this is the call to the function from inside the body of the page
// <SCRIPT>printNum();</SCRIPT> prints out mm/dd/yyyy
// <SCRIPT>printDate();</SCRIPT> prints out month dd, yyyy
// <SCRIPT>printDayMonth();</SCRIPT> prints out day, month dd, yyyy
// DATE FUNCTIONS
// Build an array initializer
function isnArray() {
 argnr=isnArray.arguments.length
 for (var i=0;i<argnr;i++) {
  this[i+1] = isnArray.arguments[i];
  }
 }
// Get date from local machine
var today = new Date();
// months and day arrays
var Months=new isnArray("January","February","March","April","May","June","July","August","September","October","November","December");
var Days=new isnArray("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
// print date (month dd, yyyy) string to screen
		var mnth = today.getMonth() + 1;
		function  printDate(){
				document.write( " "+Months[mnth]+" "+today.getDate() + ", "+today.getFullYear());
				}
// print date (mm/dd/yyyy) to screen
		function printNum(){
			document.write( " "+mnth+"/ "+today.getDate() + "/ "+today.getFullYear());
				}
// print date (day, month dd, yyyy) to screen
		var dt = today.getDay();
		function printDayMonth(){
			document.write( " "+Days[dt]+", "+Months[mnth]+" "+today.getDate()+dateSuffix+", "+today.getFullYear());
				}
// date suffix switch
thisDate=today.getDate()
switch (thisDate) {
case 1:
dateSuffix="st"
break
case 21:
dateSuffix="st"
break
case 31:
dateSuffix="st"
break    
case 2:  
dateSuffix="nd"  
break    
case 22:
dateSuffix="nd"
break;   
case 3:
dateSuffix="rd"  
break     
case 23:
dateSuffix="rd"  
break      
default:   
dateSuffix="th"
}
// end date functions
//***************************************************************************************
// THIS GROUP OF FUNCTIONS WILL PRINT A RUNNING CLOCK TO THE SCREEN IN TWO WAYS
// EITHER IN A FROM TEXT BOX OR A DIV/SPAN TAG
// this is the call to the function from the body tag
// <BODY onLoad="startTime()">
// CLOCK FUNCTIONS
var theTimeNow=""
//prints the time to the screen
function printTime(){
	// these 2 lines will update a div or span tag with id "textBox"
	this.container=document.getElementById("textBox");
	this.container.innerHTML=theTimeNow;
	// this line will update a form text box with id "textTime" and form name "form1"
	document.form1.textTime.value=theTimeNow;
}
// create the clock
function myClock(){
var clock=new Date()
var theHours=clock.getHours()
if (theHours>11)
{
theTimeSuffix="PM"
}
if (theHours>12)
var theHours=theHours-12
else
{
theTimeSuffix="AM"
}
var theMinutes=clock.getMinutes()
if (theMinutes<10)
var theMinutes="0"+theMinutes
var theSeconds=clock.getSeconds()
if (theSeconds<10)
var theSeconds="0"+theSeconds
theTimeNow=theHours+":"+theMinutes+":"+theSeconds+" "+theTimeSuffix
printTime()
}
function startTime(){ 
	myClock();
	setInterval("myClock()",1000);
	}

