<!--

   var adCache = new Array();

   adCache[ 0 ] = "../images/testimonials/001.jpg";
   adCache[ 1 ] = "../images/testimonials/002.jpg";
   adCache[ 2 ] = "../images/testimonials/003.jpg";
   adCache[ 3 ] = "../images/testimonials/004.jpg";
   adCache[ 4 ] = "../images/testimonials/005.jpg";
   adCache[ 5 ] = "../images/testimonials/006.jpg";
   adCache[ 6 ] = "../images/testimonials/007.jpg";
   adCache[ 7 ] = "../images/testimonials/008.jpg";
   // -------------------------------------------------------
   // Written by Jonathan Snook, http://www.snook.ca/jonathan
   // Add-ons by Robert Nyman, http://www.robertnyman.com
   // -------------------------------------------------------
   function getElementsByClassName( oElm, strTagName, strClassName ) {
      var arrElements       = ( strTagName == "*" && oElm.all ) ? oElm.all : oElm.getElementsByTagName( strTagName );
      var arrReturnElements = new Array();

      strClassName = strClassName.replace( /-/g, "\-" );

      var oRegExp = new RegExp( "(^|\s)" + strClassName + "(\s|$)" );
      var oElement;

      for( var i = 0; i < arrElements.length; i++ ) {
         oElement = arrElements[ i ];

         if( oRegExp.test( oElement.className ) ) {
            arrReturnElements.push( oElement ); } }

      return( arrReturnElements ) }
   // -------------------------------------------------------

   String.prototype.replaceAll =
      function( strTarget, strSubString ) {
         var strText         = this;
         var intIndexOfMatch = strText.indexOf( strTarget );

         while( intIndexOfMatch != -1 ) {
            strText         = strText.replace( strTarget, strSubString );
            intIndexOfMatch = strText.indexOf( strTarget ); }

         return( strText ); }

   function loadContent( refLink, contentId ) {
      try {
         sidenavLinks = getElementsByClassName( document, 'a', 'sidenav' );

         for( var i = 0; i < sidenavLinks.length; i++ ) {
            if( sidenavLinks[ i ] != refLink ) {
               sidenavLinks[ i ].style.backgroundPosition = 'top left'; } }

         refLink.style.backgroundPosition = 'top right';

         target     = document.getElementById( 'contentTarget' );
         newContent = document.getElementById( contentId );

         if( target.innerHTML == newContent.innerHTML ) {
            target.innerHTML = document.getElementById( 'content0' ).innerHTML; }
         else {
            sampleContent = newContent.innerHTML;
            sampleContent = sampleContent.replaceAll( 'feature_id', 'id' );

            target.innerHTML = sampleContent; } }
      catch( err ) {}

      return false; }

   function init() {
      try {
         adId            = Math.floor( Math.random() * adCache.length );
         adContainer     = document.getElementById( 'dynamicAd' );
         adContainer.src = adCache[ adId ]; }
      catch( err ) {}

      return true; }

   function checkEditor( docType ) {
      switch( docType ) {
         case 'HTML':
            document.getElementById( 'html_editor' ).style.display  = 'block';
            document.getElementById( 'pdf_uploader' ).style.display = 'none';

            break;
         case 'PDF':
            document.getElementById( 'pdf_uploader' ).style.display = 'block';
            document.getElementById( 'html_editor' ).style.display  = 'none';

            break;
         case 'BOTH':
            document.getElementById( 'html_editor' ).style.display  = 'block';
            document.getElementById( 'pdf_uploader' ).style.display = 'block';

            break;
         default:
            document.getElementById( 'html_editor' ).style.display  = 'none';
            document.getElementById( 'pdf_uploader' ).style.display = 'none';

            break; }

      return true; }

   function mask( e ) {
      var keynum, keychar, numcheck;

      if( window.event ) {
         keynum = e.keyCode; }
      else if( e.which ) {
         keynum = e.which }

      if( in_array( keynum, [ 8 ] ) ) { return true; }

      if( e.target ) {
         targ = e.target; }
      else if( e.srcElement ) {
         targ = e.srcElement; }

      if( targ.nodeType == 3 ) { targ = targ.parentNode; }

      keychar = String.fromCharCode( keynum );

      try {
         if( targ.getAttribute( 'auto' ).indexOf( targ.getAttribute( 'mask' ).substring( targ.value.length, targ.value.length + 1 ) ) > -1 ) {
            targ.value += targ.getAttribute( 'mask' ).substring( targ.value.length, targ.value.length + 1 ); } }
      catch( err ) {}

      if( targ.getAttribute( 'mask' ) ) {
         testChar = targ.getAttribute( 'mask' ).substring( targ.value.length, targ.value.length + 1 ); }
      else {
         return true; }

      switch( testChar ) {
         case '#':
            numcheck = /[0-9]/;

            break;
         case '$':
            numcheck = /[a-zA-Z]/;

            break;
         case '':
            return false;

            break;
         default:
            if( testChar === keychar ) { return true; } else { return false; }

            break; }

      return numcheck.test( keychar ); }

   function applyMaxLength( e ) {
      var keynum;

      if( window.event ) {
         keynum = e.keyCode; }
      else if( e.which ) {
         keynum = e.which }

      if( in_array( keynum, [ 8 ] ) || ( keynum == undefined ) ) { return true; }

      if( e.target ) {
         targ = e.target; }
      else if( e.srcElement ) {
         targ = e.srcElement; }

      if( targ.nodeType == 3 ) { targ = targ.parentNode; }

      if( targ.value.length >= targ.getAttribute( 'maxlength' ) ) {
         targ.value = targ.value.substring( 0, targ.getAttribute( 'maxlength' ) );

         alert( 'This field cannot exceed ' + targ.getAttribute( 'maxlength' ) + ' characters.' );

         return false; } }

   function applyInputMasks() {
      inputFields = document.getElementsByTagName( 'input' );

      for( var i = 0; i < inputFields.length; i++ ) {
         if( inputFields[ i ].getAttribute( 'mask' ) ) {
            try {
               inputFields[ i ].attachEvent( 'onkeypress', function() { return mask( event ); } ); }
            catch( err ) {
               inputFields[ i ].setAttribute( 'onkeypress', "return mask( event );" ); } } } }

   function applyMaxLengths() {
      textareas = document.getElementsByTagName( 'textarea' );

      for( var i = 0; i < textareas.length; i++ ) {
         if( textareas[ i ].getAttribute( 'maxlength' ) ) {
            try {
               textareas[ i ].attachEvent( 'onkeypress', function() { return applyMaxLength( event ); } ); }
            catch( err ) {
               textareas[ i ].setAttribute( 'onkeypress', "return applyMaxLength( event );" ); } } } }

   function in_array( t, a ) {
      for( var i = 0; i < a.length; i++ ) {
         if( a[ i ] === t ) { return true; } }

      return false; }

   function matchFields( a, b ) {
      if( a.value == b.value ) {
         a.style.backgroundColor = '#e2e2e2';
         b.style.backgroundColor = '#e2e2e2';

         return true; }
      else {
         a.style.backgroundColor = '#ffeedd';
         b.style.backgroundColor = '#ffeedd';

         a.focus();

         alert( "Please confirm these details before continuing.\n\n" + a.id + " must match " + b.id );

         return false; }

      return false; }

//-->