
<!--
/* Functions that swaps images. */

var temp1,temp2;
var jumped = false;
var w_global = null;

/* Creates a Unique number per call on one client browser.
	DOES NOT CREATE A SITE-WIDE UNIQUE KEY! */
function createUUID() {
	var l_dDate = new Date();
	var l_nUUID = l_dDate.getTime().toString();
	return l_nUUID;
}


/* (reloads) the current page in window (win) without the query string (adds a UUID to make browser refresh) */
function cleanReload(win) {
	var myurl = getUrl(win, 0);
	win.document.location.replace(myurl);
}

/* gets the document url (minus query string if (clean)) */
function getUrl(win, clean) {
  var myurl = win.document.location.href;
  if (clean) {
    var loc = myurl.indexOf('?');
    if (loc > 0) {
      myurl = myurl.substring(0,loc);
    }
  }
  return myurl;
}

/* used to verify a user's request before connecting a link */
function verifyLink(message,myurl) {
	if (confirm(message)) {
		myurl += (myurl.indexOf('?')) ? "&null="+createUUID() : "?null="+createUUID();
		document.location.href = myurl;
	}
}

/* RTRIM() function duh */
function rtrim(str) {
	if (str.length) {
		var cutLoc, i, stop;
		i = str.length;
		stop = 0;
		do {
			if (str.charAt(i-1) == " ") {
				i--;
			} else {
				stop = 1;
			}
		} while (stop == 0 && i > 0)
		if (i < (str.length)) {
			str = str.substring(0,i);
		}
	}
	return str;
}


/* LTRIM() -removes leading spaces */
function ltrim(str) {
	if (str.length) {
		var cutLoc, i, stop;
		i = 0;
		stop = 0;
		do {
			if (str.charAt(i) == " ") {
				i++;
			} else {
				stop = 1;
			}
		} while (stop == 0 && i < str.length)
		if (i > 0) {
			str = str.substring(i,str.length);
		}
	}
	return str;
}

/* TRIM() leading and ending spaces */
function trim(str) {
	if (str.length) {
		str = rtrim(str);
	}
	if (str.length) {
		str = ltrim(str);
	}
	return str;
}


/* Function to swap a font tag's font class */
function NC_swapClass(textID,myClass) {
	obj=MM_findObj(textID);
	if (obj) obj.className=myClass;
}

/* Function to find a document object */
function MM_findObj(n, d) { //v3.0
  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); return x;
}

/* Functions that swap layers - used only in product nav menu */
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

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 that handle preload. */
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 MM_checkPlugin(plgIn, theURL, altURL, autoGo) { //v3.0
  var ok=false; document.MM_returnValue = false;
  with (navigator) if (appName.indexOf('Microsoft')==-1) ok=(plugins && plugins[plgIn]);
  else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
    if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) ok=window.MM_flash;
    else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) ok=window.MM_dir;
    else ok=autoGo; }
  if (!ok) theURL=altURL; if (theURL) window.location=theURL;
}

function popNew(loc,name,width,height) {
	pop = window.open(loc,name,'scrollbars,status,resizable,width=' + width + ',height=' + height);
	pop.focus();
}

function popNewResize(loc,name,width,height) {
	pop = window.open(loc,name,'status,resizable,width=' + width + ',height=' + height);
	pop.focus();
}

function popRestricted(loc,name,width,height) {
	pop = window.open(loc,name,'status,width=' + width + ',height=' + height);
	pop.focus();
}

function popNewNoChrome(loc,name,width,height) {
	pop = window.open(loc,name,'width=' + width + ',height=' + height);
	pop.focus();
}

function popReal(loc,name,width,height) {
	pop = window.open(loc,name,'scrollbars,status,toolbar,menubar,directories,location,resizable,width=' + width + ',height=' + height);
	pop.focus();
}
function openWindow (f_name, s_title, s_attrib) {
	w_global = window.open(f_name, s_title, s_attrib);
}

/* checks if text in a form field is a possible email address */
/*   x@x.xx  minimum  */
/*   usage: if (isemail('txt_username','Email not valid!')) submitForm('frm_login');  */
/* djh 2/7/01 added ',atloc' to the 4th line to fix bug with '.' before @ */
function isemail(field,message) {
	var obj=MM_findObj(field);
	var val=obj.value;
	var atloc=val.indexOf('@');
	var dotloc=val.indexOf('.',atloc);
	if ((atloc > 1) && (dotloc > atloc+1) && (val.length > dotloc+2)) {
		var bob=true;
	} else {
		alert(message);
		var bob=false;
	}
	return bob;
}

/* used to submit forms easily within divs, or from within other forms */
function submitForm(frm) { //v3.0
	var obj = MM_findObj(frm);
	obj.submit();
}
function submitformcheck(form) {
	var obj=MM_findObj(form);
	var frmname='_CF_check' + form + '(obj)';
	if (success=eval(frmname)) {
		obj.submit();
	}
	//return success;
}

/* used to ensure a combo's value is not "" */
function verifyCombo(form,cbo,message) {
	obj=MM_findObj(form);
	obj=eval('obj.'+cbo);
	var index=obj.selectedIndex;
	var val=obj.options[index].value;
	if (val == "") {
		if (message != "")
			alert(message);
		return false;
	} else {
		return true;
	}
}
/* used to ensure a combo's value is not "" */
function jumpToCombo(form,cbo) {
	obj=MM_findObj(form);
	obj=eval('obj.'+cbo);
	var index=obj.selectedIndex;
	var val=obj.options[index].value;
	if (val != "") {
		document.location.href=val;
	}
}

/* used to verify a user's request before connecting a link */
function verifyLink(message,myurl) {
	if (confirm(message)) {
		document.location.href=myurl;
	}
}

// djh 11/21/00
// This popup window will upload images to the server
// the set the parent text boxes to the correct value
//
function popUpload(p_ccaption, p_ctextname, p_noid, p_cpath) {
	popNew("uploadpop.cfm?caption=" + p_ccaption + "&textname=" + p_ctextname + "&oid=" + p_noid + "&path=" + p_cpath,"uploadwindow","270","190");
}

// These set of JavaScript functions are used for validation of a date entered into a text
// form field. The conversion is attempted when the field is blurred using the onBlur()
// JavaScript function. If the text can't be converted into a recognizable date, a message is
// generated via an alert box and focus is returned to the text field.

// The following functions were written by Tom Wittbrodt
// Copyright (c) 1998, 1999 Tom Wittbrodt
// License is granted if and only if this entire 
// copyright notice is included. 
function validate_date(date_field, desc) {
		if (!date_field.value)  
                return true;
        var in_date = stripCharString(date_field.value," ");
        in_date = in_date.toUpperCase();
        var date_is_bad = 0;  
        if (!allowInString(in_date,"/0123456789T+-"))
                date_is_bad = 1; // invalid characters in date
        if (!date_is_bad) { 
                var has_rdi = 0;
                if (in_date.indexOf("T") >= 0){ 
                        has_rdi = 1;
                }
                if (!date_is_bad && has_rdi && (in_date.indexOf("T") != 0)) { 
                        date_is_bad = 2; // relative date index character is not in first position
                }
                if (!date_is_bad && has_rdi && (in_date.length == 1)) { 
                        var d = new Date();
                                                var return_month = parseInt(d.getMonth() + 1).toString();
                                                return_month = (return_month.length==1 ? "0" : "") + return_month; 
                                                var return_date =  parseInt(d.getDate()).toString();
                                                return_date = (return_date.length==1 ? "0" : "") + return_date; 
                                        in_date = return_month + "/" + return_date + "/" + get_full_year(d);            
                        has_rdi = 0; // date doesn't have rdi char anymore (will also cause failure of add'l rdi checks, which is a good thing)
                }
                if (!date_is_bad && has_rdi && (in_date.length > 1) && !(in_date.charAt(1) == "+" || in_date.charAt(1) == "-")) {
                        date_is_bad = 3; // length of rdi string is greater than 1 but second char is not "+" or "-"
                }
                if (!date_is_bad && has_rdi && isNaN(parseInt(in_date.substring(2,in_date.length),10))) {
                        date_is_bad = 4; // rdi value is not a number
                }
                if (!date_is_bad && has_rdi && (parseInt(in_date.substring(2,in_date.length),10) < 0)) {
                        date_is_bad = 5; // rdi value is not a positive integer
                }
                if (!date_is_bad && has_rdi) {
                        var d = new Date();
                        ms = d.getTime();
                        offset = parseInt(in_date.substring(2,in_date.length),10);
                        if(in_date.charAt(1) == "+") {
                                ms += (86400000 * offset);
                        } else {
                                ms -= (86400000 * offset);
                        }
                        d.setTime(ms);
                                                var return_month = parseInt(d.getMonth() + 1).toString();
                                                return_month = (return_month.length==1 ? "0" : "") + return_month; 
                                                var return_date =  parseInt(d.getDate()).toString();
                                                return_date = (return_date.length==1 ? "0" : "") + return_date; 
                                        in_date = return_month + "/" + return_date + "/" + get_full_year(d);    
                        has_rdi = 0;
                }
        } 
        if (!date_is_bad) {
                var date_pieces = new Array();
                date_pieces = in_date.split("/");
                if (date_pieces.length == 2) {
                        var d = new Date();
                        in_date = in_date + "/" + get_full_year(d);
                        date_pieces = in_date.split("/");
                }
                if (date_pieces.length != 3 || parseInt(date_pieces[0],10) < 1 || parseInt(date_pieces[0],10) > 12 
                                || parseInt(date_pieces[1],10) < 1 || parseInt(date_pieces[1],10) > 31 
                                || (date_pieces[2].length != 2 && date_pieces[2].length != 4)) {
                        date_is_bad = 6;  // date is not in format of m[m]/d[d]/yy[yy]
                }
        }
        if (date_is_bad) {
                alert(desc + " must be in the format of mm/dd/yy, mm/dd/yyyy, t, t+n or t-n.");
                date_field.focus();
                return (false);
        }
        
        var ms = Date.parse(in_date);
        var d = new Date();
        d.setTime(ms);
                var return_date = d.toLocaleString();
                var return_month = parseInt(d.getMonth() + 1).toString();
                return_month = (return_month.length==1 ? "0" : "") + return_month; 
                var return_date =  parseInt(d.getDate()).toString();
                return_date = (return_date.length==1 ? "0" : "") + return_date; 
        return_date = return_month + "/" + return_date + "/" + get_full_year(d);
        date_field.value = return_date;
        return true;
}       // normalize the year to yyyy
function get_full_year(d) {
                var y = ""
                if (d.getFullYear() != null)
                {
                        y = d.getFullYear();
                        if (y < 1970) y+= 100;          
                } else
                {       
                y = d.getYear();
                if (y > 69  && y < 100) y += 1900;
                if (y < 1000) y += 2000;
                }
        return y;
}
// The following functions were written by Gordon McComb
// More information can be found here: http://www.javaworld.com/javaworld/jw-02-1997/jw-02-javascript.html
function stripCharString (InString, CharString)  {
        var OutString="";
   for (var Count=0; Count < InString.length; Count++)  {
        var TempChar=InString.substring (Count, Count+1);
      var Strip = false;
      for (var Countx = 0; Countx < CharString.length; Countx++) {
        var StripThis = CharString.substring(Countx, Countx+1)
         if (TempChar == StripThis) {
                Strip = true;
            break;
         }
      }
      if (!Strip)
        OutString=OutString+TempChar;
   }
        return (OutString);
}
function allowInString (InString, RefString)  {
        if(InString.length==0) return (false);
        for (var Count=0; Count < InString.length; Count++)  {
        var TempChar= InString.substring (Count, Count+1);
      if (RefString.indexOf (TempChar, 0)==-1)  
        return (false);
   }
   return (true);
}

//  Function to open a new window and place focus there.
// If the window is already opened focus will be placed.
var newWindow
function openWebTopWindow(URL, winName, chrome) {
	if (!newWindow || newWindow.closed) {
		newWindow = window.open(URL,winName,chrome)
		if (!newWindow.opener) {
			newWindow.opener = window
		}
	} else {
		// window's already open; bring to front
		newWindow.location = URL;
		newWindow.focus();
	}
}


// function to determine if value is an integer
function isInteger(inputVal) {
	inputStr = inputVal.toString();

	for (var i = 0; i < inputStr.length; i++) {
		var oneChar = inputStr.charAt(i);
		//if (i == 0 && oneChar == "-") {
		//	continue;
		//}

		if (oneChar < "0" || oneChar > "9") {
			return false;
		}
	}
	
	return true;
}

// function to check if value is number
function checkNumber(object_value)
    {
    //Returns true if value is a number or is NULL
    //otherwise returns false	

    if (object_value.length == 0)
        return true;

    //Returns true if value is a number defined as
    //   having an optional leading + or -.
    //   having at most 1 decimal point.
    //   otherwise containing only the characters 0-9.
	var start_format = " .+-0123456789";
	var number_format = " .0123456789";
	var check_char;
	var decimal = false;
	var trailing_blank = false;
	var digits = false;

    //The first character can be + - .  blank or a digit.
	check_char = start_format.indexOf(object_value.charAt(0))
    //Was it a decimal?
	if (check_char == 1)
	    decimal = true;
	else if (check_char < 1)
		return false;
        
	//Remaining characters can be only . or a digit, but only one decimal.
	for (var i = 1; i < object_value.length; i++)
	{
		check_char = number_format.indexOf(object_value.charAt(i))
		if (check_char < 0)
			return false;
		else if (check_char == 1)
		{
			if (decimal)		// Second decimal.
				return false;
			else
				decimal = true;
		}
		else if (check_char == 0)
		{
			if (decimal || digits)	
				trailing_blank = true;
        // ignore leading blanks

		}
	        else if (trailing_blank)
			return false;
		else
			digits = true;
	}	
    //All tests passed, so...
    return true
    }

		
//GET CURRENT YEAR FOR COPYWRITE DISPLAY
function get_current_year()	{
		var Today = new Date();
		var year_now = Today.getYear();
		//for differences between ie and mozilla
		if (year_now < 1500) {year_now = year_now + 1900;};
		
		return year_now;
}
		

//-->

