
/* Creates access keys for all links */

function accesskeys() {
	if (document.getElementsByTagName)
	{
		var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
anchor.accessKey = anchor.innerHTML.substring(0,1);
}
}
}
window.onLoad = accesskeys;


/* Disables automatic Enter or Submit for a form button */

function disp(el) {
	el.children[1].style.display = (el.children[1].style.display==''?'block':'')
}
function checkKey(el) {
	if (event.keyCode==13)
		el.click()
}


/* Compares two fields in form to validate e-mail */

//--------------------------------
// This code compares two fields in a form and submit it
// if they're the same, or not if they're different.
//--------------------------------
function checkEmail(theForm) {
    if (theForm.email.value != theForm.valid_email.value)
    {
        alert('Those e-mail addresses do not match!');
        return false;
    } else {
        return true;
    }
}



/* Fades in text between span=fade tags -- needs onLoad in body tag */

var col=255;
function fade() { document.getElementById("fade").style.color="rgb(" + col + "," + col + "," + col + ")"; col-=5; if(col>0) setTimeout('fade()', 10); }


/* Detects whether page is trapped inside a framed site and breaks it out */

if (top.location !== self.location) {
top.location=self.location;
}


/* Open new windows */

function openNewWindow() {
  popupWin = window.open('http://webdesign.about.com/',
    'open_window',
    'menubar,toolbar,location,directories,status,scrollbars,resizable,dependent,width=700,height=480,left=0,top=0')
}

function MM_openBrWindow(theURL,winName,features) { /* v2.0 */
  window.open(theURL,winName,features);
}


/* Fix for IE for the Mac, which does not "auto-clear" floats and does not support :after, */

function fixmacie(classname){
var divs=document.getElementsByTagName("DIV");
  for(var d=0; d < divs.length;d++){
 if(divs[d].className.indexOf(classname)==0){
 divs[d].innerHTML+= "<div class='mac-clearfix'> <\/div>";
/* The above html tags get added to the end of
the cleared container if the browser is IE/mac. */
 } } }
function init(){
/* Check if the browser is IE5 Mac */
   if( navigator.appVersion.indexOf('Mac')!=-1 && document.all){
/* Pass the class name on the container to fixmacie
(must be the FIRST classname if multiple classnames
are used on the div!) */
 fixmacie("clearfix");
 } }
/* start the ball rolling when the page loads */
window.onLoad=init;


/* Form required field validation from Corpsite */

  function submit_page(form) {

        foundError = false;

    	if(foundError == false && isFieldBlank(form.Member_Number) == true) {
            alert("Please enter your member number.");
            foundError = true;
        }

    	if(foundError == false && isFieldBlank(form.New_Name) == true) {
            alert("Please enter your name.");
            foundError = true;
        }

    	if(foundError == false && isFieldBlank(form.New_Zipcode) == true) {
            alert("Please enter your zip code or postal code.");
            foundError = true;
        }

        if(foundError == false && isFieldBlank(form.Email) == true) {
            alert("You left the 'e-mail' field blank.");
            foundError = true;
        }

       // Now make sure the email is valid
        if(foundError == false && isValidEmail(form.Email) == false) {
            alert("You did not enter a valid email address.");
            foundError = true;
        }

   		if(foundError == false) {
            form.submit();
        }
    }

	// Check for a blank field
    function isFieldBlank(theField) {
        if(theField.value == "")
            return true;
        else
            return false;
    }

    // Check for a valid email address (Does it contain a "@")
    function isValidEmail(theField) {
                if(theField.value.indexOf('@', 0) == -1)
                        return false;
                else
                        return true;
    }


/* Ban smut from forms */


/* Reloads the window if Nav4 resized */

function MM_reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;
}}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);




/* Function for Rollover buttons. */

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 that swaps images. */

function showtab(id, newSrc) {
    var theImage = FWFindImage(document, id, 0);
    if (theImage) {
        theImage.src = newSrc;
    }
}

/* Functions that track and set toggle group button states. */

function FWFindImage(doc, name, j) {
    var theImage = false;
    if (doc.images) {
        theImage = doc.images[name];
    }
    if (theImage) {
        return theImage;
    }
    if (doc.layers) {
        for (j = 0; j < doc.layers.length; j++) {
            theImage = FWFindImage(doc.layers[j].document, name, 0);
            if (theImage) {
                return (theImage);
            }
        }
    }
    return (false);
}



/* Drop down menus */

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 tmt_findObj(n){
        var x,t; if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
        x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
        }else{x=document.getElementById(n)}return x;
}

/* v3.0A Modified by Al Sparber and Massimo Foti for NN6 Compatibility */
function MM_showHideLayers() { 
  var i,p,v,obj,args=MM_showHideLayers.arguments;if(document.getElementById){
   for (i=0; i<(args.length-2); i+=3){ obj=tmt_findObj(args[i]);v=args[i+2];
   v=(v=='show')?'visible':(v='hide')?'hidden':v;
   if(obj)obj.style.visibility=v;}} else{
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v;
}
    obj.visibility=v;
}}
}

 /* v4.01 */
function MM_setTextOfLayer(objName,x,newText) {
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}
/*  END Drop down menus */
