// ENTIRE FILE UPDATED 9-7-2009

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

function initSIFR() {

var swfFont = { src: 'uploads/Design2009/images/sifr.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#containerPageTitle h1',
	css: [ '.sIFR-root { color:#8c643e; text-transform: uppercase; line-height: 1em; }' ],
	wmode: 'transparent'
});

var swfFont = { src: 'uploads/Design2009/images/sifr.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#containerSubPageTitle h1',
	css: [ '.sIFR-root { color:#8c643e; text-transform: uppercase; line-height: 1em; }' ],
	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 VALIDATIONV2.JS ########################################
// ######################################## FORM VALIDATIONV2.JS ########################################
// ######################################## FORM VALIDATIONV2.JS ########################################

/*
 ValidateMain(form_object)
 USAGE:
 <input type="hidden" name="_^[A][--+B]" value="[C]"/>

 [A]: A valid javascript condition where 'f' is predefined to be the field object
 preceeding the hidden condition field, ge('name or id') returns given field object,
 and rc('name or id') returns string of 1s and 0s representing the checked or
 unchecked state of a group of fields with the given name or id
 
 [--+B]: Optional.  Defines the field name or id that should receive the focus
 after the pop up message.  By default, the field preceeding the hidden
 condition field receives the focus, however this may not be desirable
 
 [C]: Pop up message
 
 ValidateShort(form_object) and BufferFields()
 USAGE:
 Use this pair of functions to eliminate default text in a field upon submission.
 ValidateShort replaces ValidateMain for this purpose. It additionally
 predefines 'iv' as the initial value of the field preceeding the hidden condition
 field for use in the condition
 
 NOTE: iv is defined only for the field preceeding the hidden condition field,
 therefore, consecutive condition fields aren't supported for use with this var
 
 Buffer fields should be placed on the page after all forms that use ValidateShort
 
*/

var arrFormFields, iOffset=0;

//Buffer up to one hundred fields from forms on page
var arrFormFields=Array(100);
for(i=0;i<100;i++)
    arrFormFields[i]=Array(2);

//Validation code-------------------------------------------
function ValidateMain(frm){ 
    var i, k=0, f, iv, focus_value, value_pair, condition_value;
    e=frm.elements;
   
    for(i=0;i<e.length;i++){
        iv=getFieldByIndex(frm, i-1);

        if(e[i].name!=null){       
            if(e[i].name.substring(0,2)=='_^'){
                f=e[k];
           
                value_pair = e[i].name.split('--+');
               
                focus_value='';
                if(value_pair.length>1){
                    focus_value=value_pair[1];       
                    condition_value = value_pair[0].substring(2,value_pair[0].length);
                }
                else
                    condition_value=e[i].name.substring(2,e[i].name.length);
               
                //alert(condition_value);
               
                if(eval(condition_value)){
                    alert(e[i].value);
                   
                    if(focus_value!=''){
                        focus_value = ge(focus_value);       
                        focus_value.focus();
                        if(focus_value.type!='select-one')       
                            focus_value.select();
                    }
                    else{
                        e[k].focus();
                        if(e[k].type!='select-one')
                            e[k].select();
                    }               
                   
                    return false;
                }
            }
            else
                k=i;  
        } 
    }
   
    return true;
}
 
function ge(sIdName){
 var j=0;
 for(j=0;j<e.length;j++)
  if(e[j].id==sIdName||e[j].name==sIdName)
   return e[j];
 
 alert('ge: No name or id "'+sIdName+'"');
 return e[0];
}
 
function rc(sIdName){
 var j=0,sBString='';
 for(j=0;j<e.length;j++)
  if(e[j].id==sIdName||e[j].name==sIdName)
   sBString+=(e[j].checked)?'1':'0';  
 
  if(sBString=='')
   alert('rc: No name or id "'+sIdName+'"');
  return sBString;
 
}
//Validation code-----------------------------------   



//Buffer form index, field name, and field value into arrFormFields for all forms in document
function bufferFields(){
    var i,j;
    for(i=0;i<document.forms.length;i++){           
        for(j=0;j<document.forms[i].elements.length;j++){                                   
            arrFormFields[iOffset][0]=i;
            arrFormFields[iOffset][1]=document.forms[i].elements[j].name;
            arrFormFields[iOffset][2]='';
           
            if(document.forms[i].elements[j].type=='text' || document.forms[i].elements[j].type=='textarea'){
                arrFormFields[iOffset][2]=document.forms[i].elements[j].value;               
            }   
   
            //alert(arrFormFields[iOffset][0] + ', ' + arrFormFields[iOffset][1] + ', ' + arrFormFields[iOffset][2] + ', ' + iOffset);
            iOffset++;
        }       
    }
    return 0;
}
//Get field value from form object and field name in the arrFormFields array
function getFieldByName(frm, fieldName){
    var i,formIndex = getFormIndex(frm);
   
    for(i=0;i<iOffset;i++)
        if(arrFormFields[i][0]==formIndex&&arrFormFields[i][1]==fieldName){
            return arrFormFields[i][2];
        }
           
    return 0;
}
//Get field value from form object and element index in the arrFormFields array
function getFieldByIndex(frm, index){
    var i,j=-1,formIndex = getFormIndex(frm);

    for(i=0;i<iOffset;i++){
        if(arrFormFields[i][0]==formIndex&&j==-1)       
            j=i;
       
        if(i-j==index&&j!=-1)
            return arrFormFields[i][2];
    }
           
    return 0;
}

//Set value of all fileds that still have default values to null string in a given form
function clearDefaultValues(frm){
    var i;
    for(i=0;i<frm.elements.length;i++)
        if(frm.elements[i].value==getFieldByIndex(frm,i))
            frm.elements[i].value='';

    return true;
}

//Use this to validate short forms and clear default values
function ValidateShort(frm){
   
    if(ValidateMain(frm))
        return clearDefaultValues(frm);
   
    return false;

}

//Get form index for given form
function getFormIndex(frm){
    var i;
    for(i=0;i<document.forms.length;i++)
        if(document.forms[i]==frm)
            return i;
   
    return 0;
}



// ######################################## 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;
}}}}}}}}

