 menuHover = function(nav) {
    var sfEls = document.getElementById(nav).getElementsByTagName("li");
    for (var i=0; i<sfEls.length; i++) {
      sfEls[i].onmouseover=function() {
        this.className+=" sfhover";
      }
      sfEls[i].onmouseout=function() {
        this.className=this.className.replace(new RegExp("\\s?sfhover\\b"), "");
      }
    }

    var listItem = document.getElementById(nav).getElementsByTagName('ul');
    for(var i=0;i<listItem.length;i++) {
      listItem[i].onmouseover=function() {
        var changeStyle = this.parentNode.getElementsByTagName('a');
        changeStyle[0].className+=" active";
      }

      listItem[i].onmouseout=function() {
        var changeStyle = this.parentNode.getElementsByTagName('a');
        changeStyle[0].className=this.className.replace(new RegExp("\\s?active\\b"), "");
      }
    }
  }

  function addEvent( obj, type, fn ) {
    if ( obj.attachEvent ) {
      obj['e'+type+fn] = fn;
      obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
      obj.attachEvent( 'on'+type, obj[type+fn] );
    } else
      obj.addEventListener( type, fn, false );
    }
  function removeEvent( obj, type, fn ) {
    if ( obj.detachEvent ) {
    obj.detachEvent( 'on'+type, obj[type+fn] );
    obj[type+fn] = null;
    } else
      obj.removeEventListener( type, fn, false );
    }

  addEvent(window, 'load', function () { menuHover('menu'); });
  
  
  
  //  
//  slideShow class
//  vars:
//  slideShowId						constructor param for the id of the image that will have the Slide Show 
//  slideShowLink					constructor param for the id of the link that will be around the image that has Slide Show, use '' for no link
//  slideShowSpeed					optional constructor param for the speed of the slide show, default = 5000
//  filterName						optional constructor param for the IE filter, default = blendTrans
//  filterAttr1						optional constructor param for the IE filter, default = duration=3
//  filterAttr2						optional constructor param for the IE filter
//  filterAttr3						optional constructor param for the IE filter
//  j								counter for the object
//  picArr							array of pictures
//  altArr							array of alt text
//  linkArr							array of links
//  methods:
//  addImage(n, img, alt, link)		add an image with alt text and a link, n specifies which postion in the arrays
//  runSlideShow()					continually calls nextSlide to run the Slide Show
//  nextSlide()						applies the transition and advances the Slide Show image 1 spot in the arrays
//  
function slideShow(slideShowId, slideShowLink, slideShowSpeed, filterName, filterAttr1, filterAttr2, filterAttr3) {
	this.slideShowId = document.getElementById(slideShowId);
	
	this.picArr = new Array();
	this.altArr = new Array();
	this.linkArr = new Array();
	
	// If junk data causes one slideshow to fail the others should not.
	if (this.slideShowId == null) {
		this.addImage = function(n, img, alt, link) { }
		this.runSlideShow = function() { }
		this.nextSlide = function() { }
		return;
	}
	
	var tmpElem = document.createElement('a');
	if (slideShowLink && slideShowLink != '')
		tmpElem.href = slideShowLink;
	else
		tmpElem.removeAttribute('href');
	
	tmpElem.style.border = 'none';
	tmpElem.style.background = 'transparent';
	tmpElem.id = slideShowId + '_link';
	this.slideShowLink = tmpElem;
	this.slideShowId.parentNode.insertBefore(tmpElem, this.slideShowId);
	this.slideShowId.parentNode.removeChild(this.slideShowId);
	this.slideShowLink.appendChild(this.slideShowId);

	this.j = 1;
	if (slideShowSpeed == null || slideShowSpeed == '')
		this.slideShowSpeed = 4000;
	else
		this.slideShowSpeed = slideShowSpeed * 1000;
	if (filterAttr1 == null || filterAttr1 == '')
		filterAttr1 = 2;
	if (filterName == null || filterName == '' || filterName.toLowerCase() == 'blendtrans')
		this.filterName = 'BlendTrans(duration=' + filterAttr1;
	else if (filterName.toLowerCase() != 'none')
		this.filterName = 'progid:DXImageTransform.Microsoft.' + filterName + ', duration=' + filterAttr1;
	if (filterAttr2 != null && filterAttr2 != '')
		this.filterName = this.filterName + ',' + filterAttr2;
	if (filterAttr3 != null && filterAttr3 != '')
		this.filterName = this.filterName + ',' + filterAttr3;
	this.filterName = this.filterName + ')';
	
	this.addImage = function(n, img, alt, link) {
		this.picArr[n] = new Image();
		this.picArr[n].src = img;
		this.altArr[n] = alt;
		this.linkArr[n] = link;
	}

	this.runSlideShow = function() {
		if (this.picArr.length > 1) {
			var self = this; 					//  reference to get around context loss of this during setTimeout()
			this.timeoutId = setTimeout(function() { self.nextSlide(); self.runSlideShow(); }, this.slideShowSpeed);
		}
	}

	this.nextSlide = function() {
		if (document.all && this.slideShowId.filters && filterName.toLowerCase() != 'none') {
			this.slideShowId.style.filter = this.filterName;
			this.slideShowId.filters.item(0).apply();
		}
		this.slideShowId.setAttribute('src', this.picArr[this.j].src);
		this.slideShowId.setAttribute('alt', this.altArr[this.j]);

		var slideLink = this.linkArr[this.j]
		if (slideLink && slideLink != '')
			tmpElem.href = slideLink;
		else
			tmpElem.removeAttribute('href');

		if (document.all && this.slideShowId.filters && filterName.toLowerCase() != 'none')
			this.slideShowId.filters.item(0).play();

		this.j++;
		if (this.j >= this.picArr.length)
			this.j = 0;
	}
}

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_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_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];}
}

//******************************************************
/*  FONT SIZE FUNCTIONS */
//******************************************************
// Regular
function changeFont_normal(n)
{

//if (n == 1) {
  document.getElementById("content").style.fontSize = "11px";
  document.getElementById("content").style.lineHeight = "14px";
//} else {


//}  
  
}

// Medium
function changeFont_medium(n)
{
  document.getElementById("content").style.fontSize = "13px";
  document.getElementById("content").style.lineHeight = "15px";
}



// Large
function changeFont_large(n)
{
  document.getElementById("content").style.fontSize = "16px";
  document.getElementById("content").style.lineHeight = "18px";
}


//**************************************************************
	// Checks all checkboxes 
	//**************************************************************
	function checkAll()
	{
		document.frmSubscribe.bc.checked = true ;
		document.frmSubscribe.ab.checked = true ;
		document.frmSubscribe.sk.checked = true ;
		document.frmSubscribe.mb.checked = true ;
		document.frmSubscribe.on.checked = true ;
		document.frmSubscribe.qc.checked = true ;
		document.frmSubscribe.nl.checked = true ;
		document.frmSubscribe.pe.checked = true ;
		document.frmSubscribe.nb.checked = true ;
		document.frmSubscribe.ns.checked = true ;
		document.frmSubscribe.yt.checked = true ;
		document.frmSubscribe.nt.checked = true ;
		document.frmSubscribe.nu.checked = true ;
	}
	
	//**************************************************************
	// Unchecks all checkboxes
	//**************************************************************
	function uncheckAll()
	{
		document.frmSubscribe.bc.checked = false ;
		document.frmSubscribe.ab.checked = false ;
		document.frmSubscribe.sk.checked = false ;
		document.frmSubscribe.mb.checked = false ;
		document.frmSubscribe.on.checked = false ;
		document.frmSubscribe.qc.checked = false ;
		document.frmSubscribe.nl.checked = false ;
		document.frmSubscribe.pe.checked = false ;
		document.frmSubscribe.nb.checked = false ;
		document.frmSubscribe.ns.checked = false ;
		document.frmSubscribe.yt.checked = false ;
		document.frmSubscribe.nt.checked = false ;
		document.frmSubscribe.nu.checked = false ;
	}

/* Validates the document. Returns true if valid                  */
/* else Opens a window with an error message(s) and returns false */
function isValidSubscribe() {

	var errorMessages = "";
	var valid = true;
 
	/* find data entry errors */
	/* If an error occured, data input element is highlighted */
	with (document.frmSubscribe) {

		/* FIELD NAME = email -- Required and must be valid */
		email.value = trim(email.value);
		if (isBlank(email.value) || email.value == "") {
			errorMessages += "Please enter an email address.\n";
			valid = false;
			email.className  = "DisplayFieldError";
		} else {
		  if (isEmail(email.value)) {
			  email.className  = "DisplayFieldData";
				//valid = true
			} else {
			  errorMessages += "Please enter a valid email address.\n";
			  valid = false;
			  email.className  = "DisplayFieldError";
			}
		}
	
		/* Make sure they select atlest one province */
		if (
		bc.checked == false &&
		ab.checked == false &&
		sk.checked == false &&
		mb.checked == false &&
		on.checked == false &&
		qc.checked == false &&
		nl.checked == false &&
		pe.checked == false &&
		nb.checked == false &&
		ns.checked == false &&
		yt.checked == false &&
		nt.checked == false &&
		nu.checked == false) 
		{
			errorMessages += "Please select at least one province.\n";
			valid = false;
		} else { 	
		}

	}

	if (valid) {
		return true;
	} else {
    alert("" + errorMessages);
		return false;
	}
}

//*****************************************************************
/* Validates the document. Returns true if valid                  */
/* else Opens a window with an error message(s) and returns false */
function isValidUnSubscribe() {

	var errorMessages = "";
	var valid = true;
 
	/* find data entry errors */
	/* If an error occured, data input element is highlighted */
	with (document.frmUnSubscribe) {

		/* FIELD NAME = email -- Required and must be valid */
		email.value = trim(email.value);
		if (isBlank(email.value) || email.value == "") {
			errorMessages += "Please enter an email address.\n";
			valid = false;
			email.className  = "DisplayFieldError";
		} else {
		  if (isEmail(email.value)) {
			  email.className  = "DisplayFieldData";
				//valid = true
			} else {
			  errorMessages += "Please enter a valid email address.\n";
			  valid = false;
			  email.className  = "DisplayFieldError";
			}
		}
	}

	if (valid) {
		return true;
	} else {
    alert("" + errorMessages);
		return false;
	}
}

//********************************************************************************
//Function: trim (string)
//Purpose: Removes the white space at the edges
//Arguments: String
//Returns: String
//********************************************************************************
function trim(sString) 
{ 
  while (sString.substring(0,1) == ' ') 
  { 
    sString = sString.substring(1, sString.length); 
  } 
  while (sString.substring(sString.length-1, sString.length) == ' ') 
  { 
    sString = sString.substring(0,sString.length-1); 
  } 
return sString; 
} 

/*
 * Function: isBlank (inString)
 * Purpose: Is the String Blank or empty
 * Arguments: String
 * Returns: boolean
 **/
function isBlank (inString) {
	if (inString == null || inString.length == 0) {
		return true;
	} else {
		return false;
	}
}
