// ENTIRE FILE UPDATED 9-7-2009

// ######################################## sIFR ########################################
// ######################################## sIFR ########################################
// ######################################## sIFR ########################################

function initSIFR() {
var swfFont = { src: '../images/knowledge_regular.swf', ratios: [6,1.41,9,1.35,15,1.29,21,1.25,22,1.22,27,1.24,29,1.21,34,1.22,41,1.21,45,1.2,46,1.21,59,1.2,68,1.19,69,1.2,96,1.19,97,1.18,102,1.19,103,1.18,112,1.19,114,1.18,116,1.19,120,1.18,121,1.19,1.18] };
sIFR.activate(swfFont)
sIFR.replace(swfFont, {
	selector: 'h1',
	css: [ '.sIFR-root { color:#002c4f; text-transform: uppercase; }' ],
	wmode: 'transparent'
});



var swfFont = { src: '../images/knowledge_regular.swf', ratios: [6,1.41,9,1.35,15,1.29,21,1.25,22,1.22,27,1.24,29,1.21,34,1.22,41,1.21,45,1.2,46,1.21,59,1.2,68,1.19,69,1.2,96,1.19,97,1.18,102,1.19,103,1.18,112,1.19,114,1.18,116,1.19,120,1.18,121,1.19,1.18] };
sIFR.activate(swfFont)
sIFR.replace(swfFont, {
	selector: 'div#pageTitle',
	css: [ '.sIFR-root { color:#002c4f; text-transform: uppercase; line-height: .5em; }' ],
	wmode: 'transparent'
});


var swfFont = { src: '../images/knowledge_medium.swf', ratios: [6,1.41,9,1.35,15,1.29,21,1.25,22,1.22,27,1.24,29,1.21,34,1.22,41,1.21,45,1.2,46,1.21,59,1.2,68,1.19,69,1.2,96,1.19,97,1.18,102,1.19,103,1.18,112,1.19,114,1.18,116,1.19,120,1.18,121,1.19,1.18] };
sIFR.activate(swfFont)
sIFR.replace(swfFont, {
	selector: 'div#pageTitleBold',
	css: [ '.sIFR-root { color:#003479; text-transform: uppercase; line-height: .5em; }' ],
	wmode: 'transparent'
});


}

// ######################################## ROLLOVER ########################################
// ######################################## ROLLOVER ########################################
// ######################################## ROLLOVER ########################################
// ###### Insrtuctions ######
// Call to initiate preroll()
//<script type="text/javascript"> preroll(); <//script>
// class="over" added to images
// Rollover/preload script by Matt Ditter (Nov. 2007)
// version 1.6 (August 2008)
var prePaths = [], preImages = [], rollImages = [];
function addEvent(evt,func,obj) {
 obj = obj ? obj : window;
 if (obj.addEventListener) { obj.addEventListener(evt,func,false); return true; }
 else if (obj.attachEvent) { var ev = obj.attachEvent('on'+evt,func,event); return ev; }
 else return false;
}
function preload() {
 for (var i=0, path; path = prePaths[i]; i++) {
  var l = preImages.length;
  preImages[l] = new Image();
  preImages[l].src = path;
}}
function preroll() {
 var imgs, flag, path, dot, d = document, links = d.getElementsByTagName('a'), inps = d.getElementsByTagName('input');
 for (var i=0, a; a = links[i]; i++) {
  imgs = a.getElementsByTagName('img');
  flag = 0;
	if (a.onmouseover && imgs.length) a.onfocus = a.onmouseover;
  for (var j=0, img; img = imgs[j]; j++) {
   if (img.className.match(/(?:^|\s)over(?:\s|$)/i)) {
    path = img.src;
    dot = path.lastIndexOf('.');
    prePaths[prePaths.length] = path.substring(0,dot)+'-o'+path.substring(dot,path.length);
    flag = 1;
  }}
  if (flag) {
   addEvent('mouseover',imageRoll,a);
   addEvent('mouseout',imageRoll,a);
   addEvent('focus',imageRoll,a);
   addEvent('blur',imageRoll,a);
 }}
 for (var i=0, inp; inp = inps[i]; i++) {
  if (inp.type == 'image' && inp.className.match(/(?:^|\s)over(?:\s|$)/i)) {
   addEvent('mouseover',inputRoll,inp);
   addEvent('mouseout',inputRoll,inp);
   addEvent('focus',inputRoll,inp);
   addEvent('blur',inputRoll,inp);
 }}
 for (var i=0, arg; arg = arguments[i]; i++) prePaths[prePaths.length] = arg;
 addEvent('load',preload);
}
function imageRoll(e) {
 var imgs, path, dot, a = this.tagName ? this : e.srcElement;
 while (a.tagName != 'A' && a.parentNode) a = a.parentNode;
 if (a.tagName != 'A') return;
 imgs = a.getElementsByTagName('img');
 for (var i=0, img; img = imgs[i]; i++) {
  if (img.className.match(/(?:^|\s)over(?:\s|$)/i)) {
   path = img.src;
   dot = path.lastIndexOf('.');
   if (img.className.indexOf('activeimg') == -1)
    img.src = path.indexOf('-o.') == -1 ? path.substring(0,dot)+'-o'+path.substring(dot,path.length) : path.replace('-o.','.');
   else img.src = path.indexOf('-a.') == -1 ? path.replace('-o.','-a.') : path.replace('-a.','-o.');
}}}
function inputRoll(e) {
 var inp = this.type ? this : e.srcElement, path = inp.src, dot = path.lastIndexOf('.');
 inp.src = path.indexOf('-o.') == -1 ? path.substring(0,dot)+'-o'+path.substring(dot,path.length) : path.replace('-o.','.'); 
}
function roll(e) {
 var args = arguments;
 if (args.length < 2) for (var i=0, img; img = rollImages[i]; i++) img.src = img.old;
 else {
  var flag, path, ev, a;
  for (var i=0, img; img = document.getElementById(args[i]); i=i+2) {
   flag = 0;
   path = args[i+1];
   if (!i) {
    ev = window.event ? window.event : e;
    a = ev.target ? ev.target : ev.srcElement;
    if (!path || !ev) return;
    addEvent('mouseout',roll,a);
    addEvent('blur',roll,a);
   }
   for (var j=0, rollImg; rollImg = rollImages[j]; j++)
    if (img == rollImg) { flag = 1; break; }
   if (!flag) rollImages[rollImages.length] = img;
   if (!img.old) img.old = img.src;
   img.src = path;
}}}

// ######################################## AUTOFILL ########################################
// ######################################## AUTOFILL ########################################
// ######################################## AUTOFILL ########################################

// Label Hider v1.4 by Matt Ditter (Jan. 2008)
function inputFocus() {
 if (this.value == this.title) {
  this.value = '';
  this.style.fontWeight = 'normal';
}}
function inputBlur() {
 if (!this.value) {
  this.value = this.title;
  if (this.parentNode.getElementsByTagName('label')[0].getElementsByTagName('strong').length) this.style.fontWeight = 'normal';
}}
function toggleLabel(a) {
 var d = document;
 if (!d.getElementById) return;
 var f = d.getElementById(a), labels = f.getElementsByTagName('label');
 f.className += ' ieJS';
 for (var i=0, label; label = labels[i]; i++) {
  var inpID = label.getAttribute('for');
    if (!inpID) inpID = label.attributes['for'].value; // IE Fix
  var inp = d.getElementById(inpID), kind = inp.type.toLowerCase();
    if (kind != 'checkbox' && kind != 'radio') label.className += ' formLabelHide';
  if (label.getElementsByTagName('strong').length) inp.style.fontWeight = 'normal';
  if (!inp.value && inp.title) inp.value = inp.title;
  inp.onfocus = inputFocus;
  inp.onblur = inputBlur
}}

// ################################ FORM VALIDATION 1 ################################

function validateForm(form) { 
		// Validate
		if (isEmpty( form.txtFirstName, "Please enter your first name.")) { return false; }
		if (isEmpty( form.txtLastName, "Please enter your last name.")) { return false; }
		if (emailValidator( form.txtEmail, "Invalid E-mail address. Please ensure e-mail address is formatted correctly, name@domain.xxx .")) { return false; }
		if (isPhoneNumber( form.txtPhone, "Invalid Phone number. Please ensure Phone number is formatted correctly, XXX-XXX-XXXX.")) { return false; }
		if (isEmpty( form.txtMessage, "Please enter a message.")) { return false; }
		form.submit();
		
	}

// If the length of the element's string is 0 then display helper message
function isEmpty(elem, helperMsg){
		if(elem.value.length == 0){
			alert(helperMsg);
			elem.focus(); // set the focus to this input
			return true;
		}
		return false;
	}

// E-Mail address validation
function emailValidator(elem, helperMsg){
		var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
		if(elem.value.match(emailExp)){
			return false;
		}else{
			alert(helperMsg);
			elem.focus();
			return true;
		}
	}

// Phone number validation
function isPhoneNumber(elem, helperMsg) {
		var phoneExp = /\d{3}\-\d{3}\-\d{4}/;
		if(elem.value.match(phoneExp) || elem.value==""){
			return false;
		}else{
			alert(helperMsg);
			elem.focus();
			return true;
		}
	}


// Format Phone number
function formatPhone(userInput) {
	 if (userInput.value.length < 10) {
		 
		//alert("Phone number is too short. Please formatt the phone number as follows: xxx-xxx-xxxx.");
		//userInput.value = "";

	  } 
	// XXXXXXXXXX
	if (userInput.value.length == 10 ){
		/* Format a 10 digit number */ 
		_return = "";
		var ini = userInput.value.substring(0,3);
		_return+=ini+"-";
		var st = userInput.value.substring(3,6);
		_return+=st+"-";
		var end = userInput.value.substring(6,10);
		_return+=end;
		
		formattedPhone = _return;
		userInput.value = formattedPhone;
		   
	  }

	 if (userInput.value.length > 12) {
		 
		alert("Please formatt the phone number as follows: xxx-xxx-xxxx.");
		userInput.value = "";

	  } 

}



// ######################################## HIGHLIGHT ########################################
// ######################################## HIGHLIGHT ########################################
// ######################################## HIGHLIGHT ########################################

// See highlight.js

// ######################################## CASCADING ########################################
// ######################################## CASCADING ########################################
// ######################################## CASCADING ########################################

// INSTRUCTIONS - CALL TO LINE BELOW AT INSIDE CLOSING BODY TAG
//<script type="text/javascript"> fixMenu(); <//script>

/* START CASCADING MENU - HORIZONTAL */
	/* set colors and styles */
//		#cascadingMenu { margin:0; padding:0; list-style: none; float: left; }
//		#cascadingMenu ul { width: 23em; background: #002d44; float: left; margin: 0 0 0 -70px; display: inline; position: relative; padding: 5px 0; list-style: none; }
//		#cascadingMenu li { position: relative; float: left; display: block; }
//		#cascadingMenu li a { display: block; }
//		#cascadingMenu li li { float: none; clear: left; }
//		#cascadingMenu img { display: block; }
//		#ie #cascadingMenu li { display: inline; }
//			#cascadingMenu li ul a { color: #fff; text-decoration: none; padding: .3em 15px .3em 12px; font-weight: bold;  }
//			#cascadingMenu li ul a:hover, #cascadingMenu li ul a:focus, #cascadingMenu li ul a.active, #cascadingMenu li ul a.current { background: #13b4e9; }
	/* position sub-level drop-downs */ 
//		#cascadingMenu ul ul { top: 0; margin: -1px 0 0; position: static; display: block; padding: 0; }
	/* special classes */
//		#cascadingMenu li.sublist ul { position: relative; left: 0; border: 0; }
//			#cascadingMenu li.sublist ul a { font-weight:normal; color:#b9dde9; padding-left: 19px; background: url(../images/bg-prac-link.gif) 12px center no-repeat; }
//			#cascadingMenu li.sublist ul a:hover, #cascadingMenu li.sublist ul a:focus, #cascadingMenu li.sublist ul a.active, #cascadingMenu li.sublist ul a.current { color:#fff; background: #13b4e9 url(../images/bg-prac-link.gif) 12px center no-repeat;  }
//			#cascadingMenu li:hover li.sublist ul, #cascadingMenu li:focus li.sublist ul, #cascadingMenu li.menuover li.sublist ul, #cascadingMenu li li.menuover sublist ul{ position: relative; left: 0; }
	/* the magic - only edit where notated */
//		#cascadingMenu li:hover { z-index: 5; }
//		#ie #cascadingMenu li li a { height: 1%;} /* allows IE to use block hovers */
//		#ie6 li.menuover { z-index: 5; } /* overlay fix for IE6 */
		/* hides/shows all levels */
		/* hides 1st */ //#cascadingMenu ul, /*2nd*/ #cascadingMenu li:hover ul ul, #cascadingMenu li:focus ul ul, #cascadingMenu li.menuover ul ul, /*3rd*/ #cascadingMenu li:hover ul ul ul, #cascadingMenu li:focus ul ul ul, #cascadingMenu li.menuover ul ul ul { position: absolute; left: -9999px; z-index:  99; }
		/* shows 1st */ //#cascadingMenu li:hover ul, #cascadingMenu li:focus ul, #cascadingMenu li.menuover ul, #cascadingMenu li li.menuover ul, /*2nd*/ #cascadingMenu li li:hover ul, #cascadingMenu li li:focus ul, #cascadingMenu ul li.menuover ul, /*3rd*/ #cascadingMenu li li li:hover ul, #cascadingMenu li li li:focus ul, #cascadingMenu li li li.menuover ul { position: absolute; display: block; /* adjust position for left or right positioning here*/ left: 0; }
		/* shows 2nd */ //#cascadingMenu ul li:hover ul, #cascadingMenu ul li:focus ul, #cascadingMenu ul li.menuover ul, #cascadingMenu ul li li.menuover ul, /*2nd*/ #cascadingMenu ul li li:hover ul, #cascadingMenu ul li li:focus ul, #cascadingMenu ul ul li.menuover ul, /*3rd*/ #cascadingMenu ul li li li:hover ul, #cascadingMenu ul li li li:focus ul, #cascadingMenu ul li li li.menuover ul { position: absolute; display: block; /* adjust position for left or right positioning here*/ left: 24em; }
/* END CASCADING MENU - HORIZONTAL */


// Fix Cascading Menus v1.6 by Matt Ditter (Jan. 2008; updated May 2009)
// Enables drop downs in IE6, supports tabbing through sublists,
// and adds rollover to top-level image on sublist mouseover
var lastMenuLink = null;
function fixMenu() {
 var lists = document.getElementsByTagName('ul');
 for (var i=0, list; list = lists[i]; i++) {
  if (list.id && !list.id.indexOf('cascadingMenu')) {
   var lis = list.getElementsByTagName('li');
   for (var j=0, li; li = lis[j]; j++) {
    var anchors = li.getElementsByTagName('a'), sublists = li.getElementsByTagName('ul');
    if (li.className && (li.className == 'itemFirst' || li.className == 'itemLast')) {
     var parLIs = li.parentNode.getElementsByTagName('li');
     if (li != parLIs[0] && li != parLIs[parLIs.length-1]) li.className = '';
    }
    if (anchors.length) {
     if (li.parentNode == list) anchors[0].onblur = function() { lastMenuLink = this; }
     else if (sublists.length) {
      anchors[0].onblur = function() {
     	 var n = this.parentNode;
       while (n) {
        if (n.tagName == 'LI') { n.className = n.className.replace(/(?:^|\s)menuover(?:\b|$)/gi,'');	break; }
        n = n.parentNode;
     }}}
     anchors[0].onfocus = function() {
      var n = this.parentNode;
      while (n) {
       var p = n.parentNode, topLI = p && p.tagName == 'UL' && p.id && !p.id.indexOf('cascadingMenu');
       if (topLI && lastMenuLink && (n.getElementsByTagName('a')[0] != lastMenuLink)) {
        var lastMenuItem = lastMenuLink.parentNode;
        while (lastMenuItem) {
         if (lastMenuItem.tagName == 'LI') break;
         else lastMenuItem = lastMenuItem.parentNode;
        }
        lastMenuItem.className = lastMenuItem.className.replace(/(?:^|\s)menuover(?:\b|$)/gi,'');
        var lastItems = lastMenuItem.getElementsByTagName('li');
        if (lastItems)
         for (var k=0, lastItem; lastItem = lastItems[k]; k++)
          lastItem.className = lastItem.className.replace(/(?:^|\s)menuover(?:\b|$)/gi,'');
        lastMenuLink = null;
       }
       if (n.tagName == 'LI') n.className += ' menuover';
       n = n.parentNode;
     }}
     if (sublists.length) {
      li.onmouseover = function() {
       this.className += ' menuover';
       var listPic = this.getElementsByTagName('img')[0];
       if (listPic && listPic.className.match(/(?:^|\s)over(?:\b|$)/gi) && listPic.src.indexOf ('/blank.gif') == -1) {
        var path = listPic.src, dot = path.lastIndexOf('.');
        if (path.indexOf('-o.') == -1) listPic.src = path.substring(0,dot)+'-o'+path.substring(dot,path.length);
      }} 
      li.onmouseout = function() {
       this.className = this.className.replace(/(?:^|\s)menuover(?:\b|$)/gi,'');
       var listPic = this.getElementsByTagName('img')[0];
       if (listPic && listPic.className.match(/(?:^|\s)over(?:\b|$)/gi) && listPic.src.indexOf ('/blank.gif') == -1) {
        var path = listPic.src;
        if (path.indexOf('-o.') > -1) listPic.src = path.replace(/\-o\./gi,'.');
      }}
      anchors[anchors.length-1].onblur = function() {
       var n = this.parentNode;
       while (n) {
        if (n.tagName == 'LI') {
         var subLinks = n.getElementsByTagName('a');
         if (subLinks[subLinks.length-1] == this) n.className = n.className.replace(/(?:^|\s)menuover(?:\b|$)/gi,'');
        }
        n = n.parentNode;
        if (n == list) break;
}}}}}}}}
