﻿/* This function bypasses the target="_blank" tag disallowed in XHTML.

     Instead, use <a rel="external" href="... "> to allow validation */
     
     
function externalLinks() {  
 if (!document.getElementsByTagName) return;  
 var anchors = document.getElementsByTagName("a");  
 for (var i=0; i<anchors.length; i++) {  
   var anchor = anchors[i];  
   if (anchor.getAttribute("href") &&  
       anchor.getAttribute("rel") == "external")  
     anchor.target = "_blank";  
 }  
}  
window.onload = externalLinks;

/* This script will clear the email sign up form boxes */


function clickclear(thisfield, defaulttext) {
if (thisfield.value == defaulttext) {
thisfield.value = "";
}
}
function clickrecall(thisfield, defaulttext) {
if (thisfield.value == "") {
thisfield.value = defaulttext;
}
}


/* This will set up the main banners for rotating.*/

function changeBanner(value) 
	{
  		bnr = document.getElementById("gallery");
  		bnr.style.marginTop=value;
	}
	
/*  This will validate the end date for events on the calendar is equyal to or greater than the beginning date. */

function EventEndDateCheck()
{
  var frm = document.forms["event_edit_form"];
  if(frm.event_end_date.value < frm.event_start_date.value)
  {
    alert('You must have an end date equal to or greater than the start date for your event!');
    return false;
  }
  else
  {
    return true;
  }
}

/*  This will toggle visible and invisible divs by the ID */

function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

/* The changebox function is for password fields where we want to show the word "password" before they enter thier hidden info */
 function changeBox()
 {
    document.getElementById('pass1').style.display='none';
    document.getElementById('pass2').style.display='';
    document.getElementById('password').focus();
 }
 function restoreBox() 
 {
    if(document.getElementById('password').value=='')
    {
      document.getElementById('pass1').style.display='';
      document.getElementById('pass2').style.display='none';
    }
 }



