


	function myFormSubmit (oForm, oEle, val)
	{
		oEle.value = val;
		disableForm(oForm);
		oForm.submit();
	}

	function disableForm(theform) {
		if (document.all || document.getElementById) {
			for (i = 0; i < theform.length; i++) {
				var tempobj = theform.elements[i];
					if (tempobj.type.toLowerCase() == "submit")
						tempobj.disabled = true;
		  }
  	}
	}

	function myFormAddAnother(oEle, val) {
		oEle.value = val;
	}

	var popupHandle;

	function closePopup() {
		if(popupHandle != null && !popupHandle.closed) 
			popupHandle.close();
	}	

	function displayPopup(url,name,height,width) {
		var properties = "toolbar=0, location=0, scrollbars=1, height=" + height;
		properties = properties + ", width=" + width;
		var leftprop, topprop, screenX, screenY, cursorX, cursorY, padAmt;

		if(navigator.appName == "Microsoft Internet Explorer") {
			screenY = document.body.offsetHeight;
			screenX = window.screen.availWidth;
		} else {
			screenY = window.outerHeight;
			screenX = window.outerWidth;
		}		
		leftvar = (screenX - width) / 2;
		rightvar = (screenY - height) / 2;

		if(navigator.appName == "Microsoft Internet Explorer") {
			leftprop = leftvar;
			topprop = rightvar;
		} else {
			leftprop = (leftvar - pageXOffset);
			topprop = (rightvar - pageYOffset);
		}	
		properties = properties + ", left=" + leftprop + ", top=" + topprop;		

		closePopup();
		popupHandle = open(url,name,properties);
	}				

	
	function displayPopupNoScroll(url,name,height,width) {
		var properties = "toolbar=0, location=0, scrollbars=0, statusbar=0, 	height=" + height;
		properties = properties + ", width=" + width;
		var leftprop, topprop, screenX, screenY, cursorX, cursorY, padAmt;

		if(navigator.appName == "Microsoft Internet Explorer") {
			screenY = document.body.offsetHeight;
			screenX = window.screen.availWidth;
		} else {
			screenY = window.outerHeight;
			screenX = window.outerWidth;
		}		
		leftvar = (screenX - width) / 2;
		rightvar = (screenY - height) / 2;

		if(navigator.appName == "Microsoft Internet Explorer") {
			leftprop = leftvar;
			topprop = rightvar;
		} else {
			leftprop = (leftvar - pageXOffset);
			topprop = (rightvar - pageYOffset);
		}	
		properties = properties + ", left=" + leftprop + ", top=" + topprop;		

		closePopup();
		popupHandle = open(url,name,properties);
		popupHandle.opener=self;
	}				
	
function showlink(windowRef, url) {
    windowRef.location.href = url;
}

	
	function chgImg(o, v) {
		o.src = v;
	}

	function textCounter(field,cntfield,maxlimit) {
		if (field.value.length > maxlimit) {
			field.value = field.value.substring(0, maxlimit);
			alert('Maximum character count is ' + maxlimit + '.');
		}	else {
			cntfield.value = maxlimit - field.value.length;
		}
	}

	
	
	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) { //v3.0
	  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); 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_openBrWindow(theURL,winName,features) { //v2.0
	  window.open(theURL,winName,features);
	}
	
	
	
function showMore(theid)
{
	var el = document.getElementById(theid);
	if (el.style.display == 'none')
	{
		el.style.display = 'block';
		el = document.getElementById('more' + theid);
    el.innerHTML = '<img border="0" src="/images/FE/share/minus.gif" width="11" height="14">';
	} else {
		el.style.display = 'none';
		el = document.getElementById('more' + theid);
		el.innerHTML = '<img border="0" src="/images/FE/share/plus.gif" width="11" height="14u">';
	}
}



function joinNewsletter(oEmail, oZip) {
//  alert(form.zip.value);
//  alert("yo");

  if (oEmail.value == 'Email') {                //Is email filled?
    alert("Please enter your email address.");
    oEmail.focus();
    return false;
  }
  if (isFilled(oEmail) == false) {                //Is email filled?
    alert("Please enter your email address.");
    oEmail.focus();
    return false;
  }
  if (isEmail(oEmail) == false) {                //Is email filled?
    alert("Please enter your full email address.");
    oEmail.focus();
    return false;
  }
  if (isEmailGov(oEmail) == false) {                //Is email filled?
    alert("Please enter a non-.gov email address.");
    oEmail.focus();
    return false;
  }
  if(oZip.value == 'Zip') {
     alert("Please enter your zip/postal code.");
     oZip.focus();
     return false;
  }  
  if (isFilled(oZip) == false) {                //Is ZipCode filled?
     alert("Please enter your zip/postal code.");
     oZip.focus();
     return false;
  }

//  alert("yo");
  return true;
}


function joinNewsletterERLC(oEmail, oZip) {
//  modified joinNewsletter() for ERLC
//  valid email is always required, but zip is optional

  if (oEmail.value == 'Email' || !isFilled(oEmail) || !isEmail(oEmail)) {                //Is email filled?
    alert("Please enter a valid email address.");
    oEmail.focus();
    return false;
  }
 
  if (isEmailGov(oEmail) == false) {                //Is email filled?
    alert("Please enter a non-.gov email address.");
    oEmail.focus();
    return false;
  }
  
  if(oZip.value != 'Zip (optional)' && isFilled(oZip)) {//if not default value and not blank (both of which are okay), then must be valid zip code
  	if (!isZipCode(oZip)) {			 //Valid Zip Code?
     alert("Please enter a valid zip/postal code.");
     oZip.focus();
     return false;
    }
  }  

  return true;
}





// BEGIN FORM VALIDITY SCRIPT


// Check for proper e-mail address format
function isEmail(elm) {
    if (elm.value.indexOf("@") != "-1" &&
        elm.value.indexOf(".") != "-1" &&
        elm.value != "")
    return true;
    else return false;
}
// Check for proper e-mail address domain
function isEmailGov(elm) {
    if (elm.value.indexOf(".gov") != "-1" &&
        elm.value != "")
    return false;
    else return true;
}
// Check for no null field and an integer
function isNumber(elm) {
    var elmstr = elm.value + "";
    if (elmstr.length == 0) return false;
    for (var i = 0; i < elmstr.length; i++) {
        if (elmstr.charAt(i) < "0" || elmstr.charAt(i) > "9") return false;
    }
return true;
}
// Check for proper zip code format
function isZipCode(elm) {
var elmstr = elm.value + "";
    if ((elmstr.length != 5) && (elmstr.length != 10)) { return false }
    for (i=0; i < elmstr.length; i++) {
        if ((elmstr.length == 10) && (i == 5)) {
        if (elmstr.charAt(i) != "-") { return false }
    } else {
        if ((elmstr.charAt(i) < "0") || (elmstr.charAt(i) > "9")) { return false }
        }
    }
return true;
}
// Check for null and empty fields
function isFilled(elm) {
    if (elm.value == "" ||
        elm.value == null)
    return false;
    else return true;
}


function breakout_of_frame(url)
{
  // see http://www.thesitewizard.com/archive/framebreak.shtml
  // for an explanation of this script and how to use it on your
  // own website
  if (url==null)
	{url=document.location.href;}
  if (top.location != location) {
    top.location.href = url;
  }
}
