
//This begins the navigation script
function goTo() { //Begins navigation function
var list=document.navList.siteList //Variable points to the select object
location=list.options[list.selectedIndex].value //Location object uses the options array to change URLs
} //Ends function
//This ends the navigation script

// Begin Dynamic Clock in Status Bar
function statusTime() {
	var rightNow = new Date();
	var hrs = rightNow.getHours();
	var mins = rightNow.getMinutes();
	var secs = rightNow.getSeconds();
	setTimeout("statusTime()")
	status="The time is " + hrs + ":" + mins + ":" + secs;
}//End function

//The following dynamically sets the current date on the page.
var dayName = new Array 
("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
var monName = new Array 
("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")

var now = new Date;
/* End of date variables */
function timeMessage() {; // This function will render a time-sensitive message
// The following message will show before 1200 hours.
if (now.getHours() <12) {
	document.write("<p align='center' >Good Morning! ");
	} // Ends if statement;
else if (now.getHours() < 18) {
	document.write("<p align='center' >Good Afternoon! ");
	} // Ends else if statement;
else {
	document.write("<p align='center' >Good Evening! ");
	} // Ends else statement;
}; // Ends function
//This begins the navigation script
function goTo() { //Begins navigation function
var list=document.navList.siteList //Variable points to the select object
location=list.options[list.selectedIndex].value //Location object uses the options array to change URLs
} //Ends function
//This ends the navigation script

// Begin Dynamic Clock in Status Bar
function statusTime() {
	var rightNow = new Date();
	var hrs = rightNow.getHours();
	var mins = rightNow.getMinutes();
	var secs = rightNow.getSeconds();
	setTimeout("statusTime()")
	status="The time is " + hrs + ":" + mins + ":" + secs;
}
//End function

/*function hideIt(object) {
   object.style.visibility="hidden";
}

function showIt(object) {
   object.style.visibility="visible";
}
*/

//The following sniffs the browser and displays an appropriate Alert message.
//The following sniffs the browser and displays an appropriate Alert message.
function sniffer() {
if (navigator.appName == "Microsoft Internet Explorer") {
		alert("Thank you for using " + navigator.appName + ". You will be able to view all the features of this site.")
}
else {
function subWindow() {
var newWindow=window.open("","popup", "height=300, width=400, left=250, top=50");
newWindow.document.write("<html>");
newWindow.document.write("<head>");
newWindow.document.write("<title>");
newWindow.document.write("We're Sorry");
newWindow.document.write("</title>");
newWindow.document.write("</head>");
newWindow.document.write("<body background='images/sblg002.jpg' onblur='window.close()'>");
newWindow.document.write("<p align='center'><p>We're sorry, but your browser does not display transitions or messages in the Status bar. All other features of the site operate normally.</p>");
newWindow.document.write("<form>");
newWindow.document.write("<input type='button' value='Close Window' onclick='window.close()'>");
newWindow.document.write("</form>");
newWindow.document.write("</body>");
newWindow.document.write("</html>");
}
subWindow()
}

}		


// global variables for timeout and for current menu
var t=false,current;

function SetupMenu() {
   items=document.getElementsByTagName("li");
   for (i=0; i<items.length; i++) {
      if (items[i].className != "menu") continue;
      //set up event handlers
      thelink=findChild(items[i],"A");
      thelink.onmouseover=ShowMenu;
      thelink.onmouseout=StartTimer;
      //is there a submenu?
      if (ul=findChild(items[i],"UL")) {
         ul.style.display="none";
         for (j=0; j<ul.childNodes.length; j++) {
            ul.childNodes[j].onmouseover=ResetTimer;
            ul.childNodes[j].onmouseout=StartTimer;
         }
      }
   } 
}

// find the first child object of a particular type
function findChild(obj,tag) {
   cn = obj.childNodes;
   for (k=0; k<cn.length; k++) {
     if (cn[k].nodeName==tag) return cn[k];
   }
   return false;
}

function ShowMenu(e) {
   if (!e) var e = window.event;
   // which link was the mouse over?
   thislink = (e.target) ? e.target: e.srcElement;
   ResetTimer();
   // hide the previous menu, if any
   if (current) HideMenu(current);
   // we want the LI, not the link
   thislink = thislink.parentNode;
   current=thislink;
   // find the submenu, if any
   ul = findChild(thislink,"UL");
   if (!ul) return;
   ul.style.display="block";
}

function HideMenu(thelink) {
   // find the submenu, if any
   ul = findChild(thelink,"UL");
   if (!ul) return;
   ul.style.display="none";
}

function ResetTimer() {
   if (t) window.clearTimeout(t);
}

function StartTimer() {
   t = window.setTimeout("HideMenu(current)",500);
}

// Set up the menu when the page loads
window.onload=SetupMenu;

//Rollover from image map for Newsletters page
if(document.images) {
	spring = new Image;
	spring_rollover = new Image;
	summer = new Image;
	summer_rollover = new Image;
	newsBlank = new Image;
	spring.src = "images/springinfo.gif";
	summer.src = "images/summerinfo.gif";
	newsBlank.src = "images/blanknews.gif";
	}
else {
	spring = "";
	spring_rollover = "";
	summer = "";
	summer_rollover = "";
	newsBlank = "";
	document.spring.src = "";
	document.spring_rollover.src = "";
	document.summer.src = "";
	document.summer_rollover.src = "";
	document.newsBlank.src = "";
}	

//Code to test whether the browser handles images for rollovers on the Product Sheets page
if(document.images) {//checks to see if the browser handles images. If it does, the following is executed.
	var product1 = new Image;
	var product2 = new Image;
	product1.src = "images/productsheet1.gif";
	product2.src = "images/productsheet2.gif";
}
else { //This is what happens when the browser does not process images
	var product1 = "";
	var product2 = "";
}		

//Begin function for profile summary on the Customer Profiles page
function getSummary() {
	var profile = new Array ("Auburn", "Central Carolina", "Opelousas");
	var selectedTitle = document.profile
	for (var i=0; i<selectedTitle.length; i++) {
		if (selectedTitle.item[i].checked) {
		break
		}
	}
	//selectedTitle.description.value=selectedTitle.item[i].value
	document.getElementById("summary").innerHTML = "<h3 style=margin-top:3px;>" + profile[i] +"</h3><p>" +selectedTitle.item[i].value +"</p>";

}


// elements for setting a cookie on the Request for Information page
expireDate = new Date;
expireDate.setMonth(expireDate.getMonth() + 6);
userName = "";
if (document.cookie != "") {
	userName = document.cookie.split("=")[1] // splits cookie record into fields
	}
function setCookie() {
	userName = document.register.firstName.value + " " +
document.register.lastName.value;
	document.cookie = "userName=" + userName + "; expires=" +
expireDate.toGMTString()  // converts date into string
	}
//end elements for setting a cookie		

// The following is a utility that returns true if a string contains only whitespace characters.
function isblank(s) {
for (var i=0; i<s.length; i++) {
var c=s.charAt(i)
if ((c !="") && (c !="\n") && (c!="\t")) return false
}
return true
}
// End of utility that checks for whitespace characters
// A utility function that returns true if a string contains only 
// whitespace characters.
function isblank(s)
{
    for(var i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
    }
    return true;
}//End cookie function

/* This is the function that performs form verification. It will be invoked from the onSubmit() event handler. The handler should return whatever value this function returns. On this site, this function is called from the Request Information page.
*/
function checkField(f) {
var msg
var empty_fields = ""
var errors = ""
/* Loop through the elements of the form, looking for all text and textarea elements that don't have an "optional" property defined. Then, check for fields that are empty and make a list of them. Also, if any of these elements have a "min" or a "max" property defined, then verify that they are numbers and that they are in the right range. Put together error messages for fields that are wrong.
*/
for(var i = 0; i < f.length; i++) {
var e = f.elements[i]
if (((e.type == "text") || (e.type == "textarea")) && !e.optional) {
// first check if the field is empty
if ((e.value == null) || (e.value == "") || isblank(e.value)) {
empty_fields += "\n" + e.name
continue
}
// Now check for fields that are supposed to be numeric.
if (e.numeric || (e.min != null) || (e.max != null)) { 
var v = parseFloat(e.value)
if (isNaN(v) || 
((e.min != null) && (v < e.min)) || 
((e.max != null) && (v > e.max))) {
errors += "- The field " + e.name + " must be a number"
if (e.min != null) 
errors += " that is greater than " + e.min
if (e.max != null && e.min != null) 
errors += " and less than " + e.max
else if (e.max != null)
errors += " that is less than " + e.max
errors += ".\n"
}
}
}
}
/* Now, if there were any errors, display the messages, and return false to prevent the form from being submitted. Otherwise return true.
*/
if (!empty_fields && !errors) return true
msg  = "______________________________________________________\n\n"
msg += "The form was not submitted because of the following error(s).\n"
msg += "Please correct these error(s) and re-submit.\n"
msg += "______________________________________________________\n\n"
if (empty_fields) {
msg += "- The following required field(s) are empty:"  + empty_fields + "\n"
if (errors) msg += "\n"
}
msg += errors;
alert(msg);
return false;
}//End verification function
//-->
