<!--

/* functions for rollovers and image swapping */
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function swap_pic(source) {
	document.sidemenu1.src=("/home/images/menudots.jpg");
	document.sidemenu2.src=(source);
}

function pic_restore() {
	document.sidemenu1.src=("/home/images/eassdmenu2.jpg");
	document.sidemenu2.src=("/home/images/eassdmenu3.jpg");
}


// functions to validate user login fields on index.cfm
function validate_user(id, password) {
	id = trim(id);
	password = trim(password);
	if (parseFloat(navigator.appVersion) == 4.7) {
        alert("You must be running higher version than Netscape Navigator 4.7 to access this site.  If you do not have Netscape 4.76 installed on your computer, click on the Netscape 4.76 link on the left hand side of the page to download the software.  This upgrade must take place before 04/23/2003.");
		return false;
	}	
	else if (id == "") {
		alert ("You have not entered a user name."); 
		return false;
	}
	else if (password == ""){
		alert ("You have not entered a password.");
		return false;
	}
}

//function to check browser version to assist in the browser upgrade process
function check_browser() {
if (navigator.appName == "Microsoft Internet Explorer") {
        	alert("You are running MS Internet Explorer.  While this browser likely does support SSL, it is not currently supported by Oracle.");
			}
else if (navigator.appName == "Netscape" && parseFloat(navigator.appVersion) == 4.7){
			alert("You are running "+ navigator.appName+" "+parseFloat(navigator.appVersion)+". You will need to upgrade to Netscape 4.76");
			}
else if (navigator.appName == "Netscape" && parseFloat(navigator.appVersion) == 4.76){
			alert("You are running "+ navigator.appName+" "+parseFloat(navigator.appVersion)+". Your browser is compliant.  No download is necessary");
			}
else {
			alert("You are not running a supported browser.  If you do not already have Netscape 4.76, please download and install this browser.");
			}
}
// functions to validate email form home/feedback/email/..

function validate_email(name, email, subject){
		name = trim(name);
		email = trim(email);
		subject = trim(subject);
		if (name == "" )
        	{
                alert ( "Please enter your name in the form." );
                return false;
        	}	
			
		else {
			if (email == "" )
				{
					alert ( "Please enter your email address." );
	                return false;
    	    	}	
		else {
			if (subject == "" )
				{
					alert ( "Please enter a subject for the email." );
	                return false;
    	    	}	
			}
		}
}

//function to trim input fields
function trim ( inputStringTrim ) {
	fixedTrim = "";
	lastCh = " ";
	for (x=0; x < inputStringTrim.length; x++) {
	ch = inputStringTrim.charAt(x);
	if ((ch != " ") || (lastCh != " ")) { fixedTrim += ch; }
		lastCh = ch;
	}
	if (fixedTrim.charAt(fixedTrim.length - 1) == " ") {
		fixedTrim = fixedTrim.substring(0, fixedTrim.length - 1); }
	return fixedTrim
}

//function to validate the new message form in the discussion forum
function validate_form(subject, category) {
	subject = trim(subject);
	if (subject == "") {
		alert ("You have not entered the subject. Please enter the subject"); 
		window.document.forms[1].subject.focus();
		return false;
	}
	
	else {
			if (category == true) {
				alert ("Please select the category from the drop-down list.");
				window.document.forms[1].Category.focus();
				return false;
			}
		}
}


// This section is for popup windows
		function WindowOpen(url, WindowWidth, WindowHeight) {
			var height_width='width='+WindowWidth+',height='+WindowHeight;
			window.open(url,"",height_width);
			
		}
//A function for a popup w/ scrolling (used to be w/ location bar)
function PopUpLocation(url, WindowWidth, WindowHeight) {
			var attributes='width='+WindowWidth+',height='+WindowHeight+',scrollbars=yes';
			window.open(url,"",attributes);
			
		}
//function to check dates selected on the communications page 	
function compareDate(){
	varmonth1=window.document.forms[2].start_month.options[window.document.forms[2].start_month.selectedIndex].value;
	varday1=window.document.forms[2].start_day.options[window.document.forms[2].start_day.selectedIndex].value;
	varyear1=window.document.forms[2].start_year.options[window.document.forms[2].start_year.selectedIndex].value;
	varmonth2=window.document.forms[2].end_month.options[window.document.forms[2].end_month.selectedIndex].value;
	varday2=window.document.forms[2].end_day.options[window.document.forms[2].end_day.selectedIndex].value;
	varyear2=window.document.forms[2].end_year.options[window.document.forms[2].end_year.selectedIndex].value;
	vardate1 = varmonth1 + '/' + varday1 + '/' + varyear1;
	vardate2 = varmonth2 + '/' + varday2 + '/' + varyear2;
	
	vardate3 = "7/8/2002";
	var sysDate1 = window.document.forms[2].system_date1.value;
	var sysDate2 = window.document.forms[2].system_date2.value;
	
	var d1 = Date.parse(vardate1);
	var d2 = Date.parse(vardate2);
	var d3 = Date.parse(vardate3);
	var d4 = Date.parse(sysDate1);
	
	if (d1 > d2) {
  		alert ("Please enter valid dates. The start date should not be greater than end date.");
		return false;
	} 
	else if (d1 < d3) {
  		alert ("The start date should be greater than or equal to July 8, 2002. To view communications before this date, please select the appropiate link in the Archived Communications.");
		return false;
	}
	 else if (d1 > d4){
  		alert ("Please enter valid dates. Start date cannot be greater than today's date (" + sysDate2 +").");
		return false;
	} 
	else if (d2 > d4) {
	    alert ("Please enter valid dates. End date cannot be greater than today's date (" + sysDate2 +").");
		return false;
	}
	
}


//function to validate the profile update form on the team page.
function validate_team_profile(){
	if (trim(document.forms[1].title.value) == ""){
		alert("You have not entered your job title. Please enter it.");
		return false;
	}	
	else if (!phoneNumberCheck(document.forms[1].work_phone.value)){
		alert("The work phone number entered is invalid. Please enter the phone number in 222-222-2222 format");
		return false;
	}
	else if (!phoneNumberCheck(document.forms[1].home_phone.value)){
		alert("The home phone number entered is invalid. Please enter the phone number in 222-222-2222 format");
		return false;
	}
	else if (!phoneNumberCheck(document.forms[1].cell_phone.value)){
		alert("The cell phone number entered is invalid. Please enter the phone number in 222-222-2222 format");
		return false;
	}
	else if (!phoneNumberCheck(document.forms[1].emergency_phone.value)){
		alert("The emergency phone number entered is invalid. Please enter the phone number in 222-222-2222 format");
		return false;
	}
}

//function to check the format of the phone no. entered in team profile update page. 
function phoneNumberCheck(number){

	if (trim(number) == "") {
		return true;
		} 
	else {

		//check for the xxx-xxx-xxxx format
		if ( number.indexOf("-")!=3 || number.indexOf("-",4)!=7 || number.length!=12)
		return false;

		//we extract all the numbers from the entry, excluding the hyphens
		var num = number.substr(0,3);
		num = num.concat(number.substr(4,3));
		num = num.concat(number.substr(8,4));

		//now we check that only digits are entered
		var c;
		for( i=0; i<10; i++ ){

			//convert the i-th character to ascii code value
			c = num.charCodeAt(i); 
			if( (c<48) || (c>57) ) return false;

	}
	}

return true;

}

//function to check dates selected on the headlines page 	
function compareHeadlinesDate(){
	varmonth1=window.document.forms[1].headline_month.options[window.document.forms[1].headline_month.selectedIndex].value;
	varday1=window.document.forms[1].headline_day.options[window.document.forms[1].headline_day.selectedIndex].value;
	varyear1=window.document.forms[1].headline_year.options[window.document.forms[1].headline_year.selectedIndex].value;
	varmonth2=window.document.forms[1].expiration_month.options[window.document.forms[1].expiration_month.selectedIndex].value;
	varday2=window.document.forms[1].expiration_day.options[window.document.forms[1].expiration_day.selectedIndex].value;
	varyear2=window.document.forms[1].expiration_year.options[window.document.forms[1].expiration_year.selectedIndex].value;
	vardate1 = varmonth1 + '/' + varday1 + '/' + varyear1;
	vardate2 = varmonth2 + '/' + varday2 + '/' + varyear2;
	
	var d1 = Date.parse(vardate1);
	var d2 = Date.parse(vardate2);
	
	if (d1 > d2) {
  		return false;
	} 
	else {
		return true;
	}
		
}


//function to check the headline form
function validateHeadlineForm(){
	if (trim(document.forms[1].headline.value) == ""){
		alert("You have not entered the Headline title. Please enter it.");
		return false;
	}	
	else if (! isNumber(document.forms[1].priority.value)){
		alert("The priorty entered is invalid. Please enter a valid number");
		return false;
	}
	else if (! compareHeadlinesDate()){
		alert("Please enter valid dates. The healine date should not be greater than expiration date.");
		return false;	
	}
	else if (trim(document.forms[1].summary.value) == ""){
		alert("You have not entered the Summary. Please enter it.");
		return false;
	}	

}

//function to check if the number entered on healine form is a valid number
function isNumber(number){
	if (trim(number) == "") {
		return false;
		} 
	else {
		var number_length
		var c;
		
		number_length = number.length	
			
		for( i=0; i<number_length; i++ ){
			
			//convert the i-th character to ascii code value
			c = number.charCodeAt(i); 
			
			if( (c<48) || (c>57) ) {
				error = false;
			}
			else {
				error = true;
			}
		}
		return error;
	}
}


//-->

