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 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_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

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_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following information is required:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function toggleClass(id, class_on, class_off) {
  if (!class_on) var class_on = 'on';
  if (!class_off) var class_off = 'off';
  var obj = document.getElementById(id);
  if (obj.className == class_on) {
    MM_changeProp(id,'','className',class_off,'SPAN');
  } else if (obj.className == class_off) {
    MM_changeProp(id,'','className',class_on,'SPAN');
  }
}

function toggleImage(id, on, off) {
  var obj = document.getElementById(id);
  if (obj.src == on) {
    MM_changeProp(id,'','src',off,'IMG');
  } else if (obj.src == off) {
    MM_changeProp(id,'','src',on,'IMG');
  }
}

function toggleImageGroup(num, prefix, num_items) {
  // turns back image whose id= prefix+1,2,3... num_items
  // toggles image whose the id=prefix+num
  // image_on and image_off are global vars (defined on the page that uses them)
  var on = image_on;
  var off = image_off;
  var id = prefix+num;
  var current_id;
  for (var i=1; i<=num_items; i++) {
    current_id = prefix+i;
    if (current_id == id) {
      toggleImage(current_id, on, off);
    } else {
      MM_changeProp(current_id,'','src',off,'IMG');
    }
  }
}

function changeMenu(id, index) {
  // sets the value of a drop-down menu with id to index
  // page must be loaded before this function can be used, place script at the end of the body (not onload)
  var _menu = document.getElementById(id);
  _menu.selectedIndex = index;
}

function toggleDisplay(id) {
  var obj = document.getElementById(id);
  if (obj.style.display == 'none') {
    obj.style.display = "";
  } else {
    obj.style.display = "none";
  }  
}

function toggleDisplayGroup(num, prefix, num_items) {
  // hides page content where the id= prefix+1,2,3... num_items
  // shows page content where the id=prefix+num
  var id = prefix+num;
  var element, current_id;
  for (var i=1; i<=num_items; i++) {
    current_id = prefix+i;
    element = document.getElementById(current_id);
    if (current_id == id) {
      toggleDisplay(id);
    } else {
      element.style.display = "none";
    }
  }
}
  
/*
        -------------------------------------------------------------------------------------------------
        Random Image/Link JavaScript(tm) by Jim Matvichuk

        This code may be used freely as long as this copyright notice
        remains with the code.
        
                        Copyright© 1997, Jim Matvichuk
                        Jim_Matvichuk@compuserve.com
                        All rights reserved

        Last Revision: August 19, 1997  
        -------------------------------------------------------------------------------------------------
        Instructions:
        There are two Script sections on this page to create the
        Random Image/Link. This section (which should be placed between
        your HEAD tags, after the title and any meta tgas) and the section 
        in the body of this document.
 
        You will need both sections to display the Image/link.
   
        Change the array elements:     ae_('your href and/or image');
        in this section AND place the Javascript section in the body of this 
        document between your BODY tags where you want it to appear.

*/

// Global vars----
G_total_sa = 0;                                 // total random elements
G_day = new Date();                             // date for seed
G_seed = G_day.getTime();                       // G_seed for random number


//---CHANGE THESE ARRAY ELEMENTS TO YOUR LINK/IMAGE
//---ADD/SUBTRACT AS MANY AS YOU NEED
// Just replace your URL and image tags between the single quotes:  ae_('   your stuff here   ');

 /*
  *  in order for the navigation drop-downs to    *
  *  go over the flash, add the wmode param tag   *
  *  <param name="wmode" value="transparent" />   *
  *  and the wmode attribute to the embed tag     *
  *  wmode="transparent"                          *
  
 -add to document
 <script language="javascript" type="text/javascript">document.write( sa[rand()] );</script>
 
 */
 
//------------------------------------------------------------------------------------
// Function to Create image/link Object Array
//------------------------------------------------------------------------------------
function ae_ (description) {
        G_total_sa++;
        sa [G_total_sa] = description;
}

//-------------------------------------------------------------------------------------
// function to create a random number from 1 to total number
// of array elements
//-------------------------------------------------------------------------------------
function rand() {
RN = parseInt(((G_seed - (parseInt(G_seed/1000,10) * 1000))/10)/100*G_total_sa + 1,10);
        return RN;
}
ae_('<img src="images/home/wood_church_lg.jpg" width="495" height="385" />');
ae_('<img src="images/home/white_church_lg.jpg" width="495" height="385" />');
ae_('<img src="images/home/dark_church_lg.jpg" width="495" height="385" />');

///////////////////////////////////////////////////////////////////
// CREATE THE image/link OBJECT ARRAY
function sa () {}

// Rotates body images so that top image is not repeated within body
function rotateImages() {
  var top_pic = document.getElementById("top_pic");
  var bottom_pic = document.getElementById("bottom_pic");
  if (RN == 1) {
    top_pic.src = "images/home/white_church_sm.jpg";
    bottom_pic.src = "images/home/dark_church_sm.jpg";
  }
  if (RN == 2) {
    top_pic.src = "images/home/wood_church_sm.jpg";
    bottom_pic.src = "images/home/dark_church_sm.jpg";
  }
  if (RN == 3) {
    top_pic.src = "images/home/white_church_sm.jpg";
    bottom_pic.src = "images/home/wood_church_sm.jpg";
  }
  else {
   /*top_pic.src = "images/navigation/transparent.gif";
   bottom_pic.src = "images/navigation/transparent.gif";*/
  }
}


///////////////////////////////////////////////////////////////////
// FLASH DETECTOR
// documentation: http://www.dithered.com/javascript/flash_detect/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)
// with VBScript code from Alastair Hamilton (now somewhat modified)
///////////////////////////////////////////////////////////////////
var flashVersion = 0;
function getFlashVersion() {
  var latestFlashVersion = 9;
  var agent = navigator.userAgent.toLowerCase();   
   // NS3 needs flashVersion to be a local variable
   if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) {
      flashVersion = 0;
   }
  // NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Flash plugin in plugin array
  if (navigator.plugins != null && navigator.plugins.length > 0) {
    var flashPlugin = navigator.plugins['Shockwave Flash'];
    if (typeof flashPlugin == 'object') { 
      for (var i = latestFlashVersion; i >= 3; i--) {
            if (flashPlugin.description.indexOf(i + '.') != -1) {
               flashVersion = i;
               break;
            }
         }
    }
  }
  // IE4+ Win32:  attempt to create an ActiveX object using VBScript
  else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
     var doc = '<scr' + 'ipt language="VBScript"\> \n';
      doc += 'On Error Resume Next \n';
      doc += 'Dim obFlash \n';
      doc += 'For i = ' + latestFlashVersion + ' To 3 Step -1 \n';
      doc += '   Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
      doc += '   If IsObject(obFlash) Then \n';
      doc += '      flashVersion = i \n';
      doc += '      Exit For \n';
      doc += '   End If \n';
      doc += 'Next \n';
      doc += '</scr' + 'ipt\> \n';
      document.write(doc);
   }
  // WebTV 2.5 supports flash 3
  else if (agent.indexOf("webtv/2.5") != -1) flashVersion = 3;
  // older WebTV supports flash 2
  else if (agent.indexOf("webtv") != -1) flashVersion = 2;
  // Can't detect in all other cases
  else {
    flashVersion = flashVersion_DONTKNOW;
  }
  return flashVersion;
}
flashVersion_DONTKNOW = -1;
// required version of the flash player for the flash navigation menu
/*****************************/
var requiredVersion = 7;
/*****************************/
var my_flash_version = getFlashVersion();
var flash_detected = false;

// non-flash menu content 
function flashFound(flashVersion, requiredVersion) {
  if (flashVersion >= requiredVersion) {
    flash_detected = true;
    // write the flash content
    return true;
  } else {
// you either have a lower version of flash or you don't have it, or the browser can't use javascript to detect it (MAC IE 4.5)
    return false;
  }
}

//////////////////////////
// Email Obfuscator
// <a href="/site_map.phtml" onMouseOver="SetHREF(this, 'kyle', 'firstnetimpressions', 'com', 'FNI - Website Inquiry')" onFocus="SetHREF(this, 'kyle', 'firstnetimpressions', 'com', 'FNI - Website Inquiry')"><script>address("kyle", "firstnetimpressions", "com");< /script></a>
//////////////////////////

function address(name, dom, tld)
{
  var addr = name + '@' + dom + '.' + tld;
  document.write(addr);
}

function SetHREF(obj, box, dom, tld, sbj)
{
  var addr = 'mailto:' + box + '@' + dom + '.' + tld;
  addr = (sbj != null) ? addr + '?subject=' + sbj : addr;
  obj.href = addr;
}