function closeAllMenus() {
  // conditionally redefined in menu.jsp
  }


var statementon = new Image();
statementon.src = "images/portal/frame_buttons/Fbutt_goto_on.gif";

var statementoff = new Image();
statementoff.src = "images/portal/frame_buttons/Fbutt_goto_off.gif";

var redeemon = new Image();
redeemon.src = "images/portal/frame_buttons/Fbutt_redeem_on.gif";

var redeemoff = new Image();
redeemoff.src = "images/portal/frame_buttons/Fbutt_redeem_off.gif";

var myon = new Image();
myon.src = "images/portal/frame_buttons/Fbutt_my_acct_on.gif";

var myoff = new Image();
myoff.src = "images/portal/frame_buttons/Fbutt_my_acct_off.gif";

var helpon = new Image();
helpon.src = "images/portal/frame_buttons/Fbutt_help_on.gif";

var helpoff = new Image();
helpoff.src = "images/portal/frame_buttons/Fbutt_help_off.gif";

var sson = new Image();
sson.src = "images/portal/content_buttons/Cbutt_savings_station_on.gif";

var ssoff = new Image();
ssoff.src = "images/portal/content_buttons/Cbutt_savings_station_off.gif";

var newson = new Image();
newson.src = "images/portal/content_buttons/Cbutt_news_on.gif";

var newsoff = new Image();
newsoff.src = "images/portal/content_buttons/Cbutt_news_off.gif";

var arton = new Image();
arton.src = "images/portal/content_buttons/Cbutt_articles_on.gif";

var artoff = new Image();
artoff.src = "images/portal/content_buttons/Cbutt_articles_off.gif";

var subon = new Image();
subon.src = "images/portal/content_buttons/Cbutt_subscribe_on.gif";

var suboff = new Image();
suboff.src = "images/portal/content_buttons/Cbutt_subscribe_off.gif";

var tryon = new Image();
tryon.src = "images/portal/content_buttons/Cbutt_trythis_on.gif";

var tryoff = new Image();
tryoff.src = "images/portal/content_buttons/Cbutt_trythis_off.gif";




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) { //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);
  }


// Displays popup windows
var Browser = navigator.appName.substring(0,9);
var Version = navigator.appVersion;
if ((Browser == 'Microsoft') && (Version.indexOf('MSIE ') != -1)) {
  Version = Version.substring(Version.indexOf('MSIE ')+5);
  }
Version = Version.substring(0,1);

// this function creates a new window
// note NO spaces in the window specs
function newPopwin(page) {
  Popwin = window.open(page,'Popup',
  'width=500,height=425,scrollbars=1,resizable=1,status=1,'+
  'menubar=0,toolbar=0,location=0,directories=0,copyhistory=0');
  Popwin.focus();
  }

// function popupWindow() 
// function: To open a popup window with parent/child ability. 
// parameters: urlStr- the URL of the file to load into the popup window (string) 
// childWindow- object reference to the popup window (string) 
// windowName- a string reference to the popup window (string) 
// W- the width in pixels 
// H- the height in pixels 
// T- boolean flag to display the toolbar ('yes' or 'no') 
// L- boolean flag to display the location field 
// M- boolean flag to display the menubar 
// S- boolean flag to display the scrollbars 
// R- boolean flag to allow the popup to be resized 
// ST- boolean flag to display the status bar 
// webtvPage- boolean flag for whether or not there should be an in-line 
// version of the page instead of a popup for webtv users ('yes' or 'no') 
// webtvMsg- message that appears in the status bar if no in-line page 
// version of the popup for webtv users (string) 

function popupWindow(urlStr, childWindow, windowName, W, H, T, L, M, S, R, ST, webtvPage, webtvMsg) { 
   if (navigator.appVersion.indexOf("WebTV") != -1) { 
      if (webtvPage) { 
         window.location = urlStr; 
      } else { 
         window.status = webtvMsg; 
      } 
   } else { 
      windowFeature = "width=" + W + ",height=" + H + ",toolbar=" + T + ",location=" + L + ",menubar=" + M + ",scrollbars=" + S + ",resizable=" + R + ",status=" + ST; 
      childWindow = new Object(); 
      childWindow = window.open(urlStr, windowName, windowFeature); 
      childWindow.focus(); 
      if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion) < 4)) { 
         // IE3 does not support parent/child browser relationships 
      } else { 
         childWindow.opener = self.parent; 
      } 
   } 
} 


// Displays Popup windows - variable size
IE = navigator.appName=="Microsoft Internet Explorer";
NS = navigator.appName=="Netscape";
bVer = parseInt(navigator.appVersion);

var newWin=null;

function popup(loc, name, width, height) {
  var _params = "width="+width+",height="+height+",resizable=yes,status=no";

  // CENTER ON BROWSERS WHICH SUPPORT JSCRIPT 1.2
  if (bVer >= 4) {
    _left = ( (screen.width-width) >>1 );
    _top = ( (screen.height-height) >>1 );
    }
  else {
    _left = ( (800-width) >>1 );
    _top = ( (600-height) >>1 );
    }

  if (IE) _params += ",top=" + _top + ",left=" + _left;
  else if (NS) _params += ",screenX=" + _left + ",screenY=" + _top;

  newWin = window.open(loc, name, _params);
  if ( newWin!=null && !(IE && bVer<5) )
  newWin.focus(); // MSIE4 DOESN'T FOCUS WINDOWS
  }

// function to verify that the ending date is after the beginning date
function dateRangeValid(month1, year1, month2, year2) {
   now = new Date();
   currMonth = now.getMonth()+1;
   currYear = now.getFullYear()+1;
   if (year2 < year1) {
      alert("Please select a valid date range.");
      return false;
   } else if ((currMonth < month1) && (currYear < year1)) {
      alert(currMonth + " " + month1 + " " + currYear + " " + year1);
      return false;
   } else {
      return true;
   }
}

function openAfgeReferralWindow(){
	popupWindow('afge_referral.jsp', 'afgeReferralObj', 'afgeReferralWin', 650, 600, 'no', 'no', 'no', 'no', 'yes', 'yes', 'no', 'WebTV does not support this feature');
}

function showAfgeAlert(){
	alert("Please login first in order to get credited for the referral bonus.");
}