//image swap
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) { //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];}
}


//clear search box
function clearsearch() {
	document.searchform.search.value = "";
}

//email page URL
function emailpage(){
	var page = window.location.href;
	window.open('mailto:?X-Mailer=Mozilla 4.76 [en] (Windows NT 5.0; U) X-Accept-Language: en&subject=Visit this page on fepblue.org&body='+escape('While exploring fepblue.org, I came across the following information. To access this page, click on the link below.\n')+page);
}


//flash presentation window
function preswin(url,width,height){
	window.open(url,'preswin','width='+width+',height='+height+',toolbar=0,resizable=1,scrollbars=0,menubar=0,status=0,location=0,directories=0');
}


  // Increase Font Size
function increaseFontSize(){
	var max=1.075;
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseFloat(p[i].style.fontSize.replace("em",""));
      } else {
         var s = .95;
      }
      if(s<max) {
         s += .04;
      }
      p[i].style.fontSize = s+"em"
   }   
}
  // Decrease Font Size
function decreaseFontSize() {
	var min=.7;
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseFloat(p[i].style.fontSize.replace("em",""));
      } else {
         var s = .95;
      }
      if(s>min) {
         s -= .05;
      }
      p[i].style.fontSize = s+"em"
   }   
}
  
  
//start zipcode lookup scripts
function fillzip(){
	document.getElementById("zipstring").maxLength = 14;
	document.zipform.zipstring.value = "Enter ZIP Code";
}
function clearzip(){
	document.getElementById("zipstring").maxLength = 5;
	document.zipform.zipstring.value = "";
}

//get errors from URL
function getValue(varname){
  var url = window.location.href;
  var qparts = url.split("?");
  if (qparts.length == 0){
    return "";
  }
  var query = qparts[1];
  var value = "";
  if (query){
	  var vars = query.split("&");
	  for (i=0;i<vars.length;i++){
	    var parts = vars[i].split("=");
	    if (parts[0] == varname){
	      value = parts[1];
	      break;
	    }
	  }
	  value = unescape(value);
	  value.replace(/\+/g," ");
  }
  return value;
}

//check for errors
function errorcheck(){
	var error = getValue("error");
	switch(error){
	case "1":
		document.getElementById("errorbox").innerHTML = "Please enter a valid ZIP Code.";
	  break    
	case "2":
		document.getElementById("errorbox").innerHTML = "Sorry! The Basic Consumer Option is not currently available in your area.";
	  break    
	default:
	  document.getElementById("errorbox").innerHTML = "";
	} 
}


/* Added by Paul Menard 2008-09-05 */
/* This function is called from the dropdown jump section like on Standard Option Medical Benefits */

function go_jump() 
{
	if (document.jump_select_form.jump_select.options[document.jump_select_form.jump_select.selectedIndex].value != "none") 
	{
		location = document.jump_select_form.jump_select.options[document.jump_select_form.jump_select.selectedIndex].value;
	}
}


/*For the Local Care Management Popup windows*/
function newWindow(firstwin) {
		firstWindow = window.open(firstwin,
			'firstWin', 'scrollbars=yes,resizable=yes,width=400,height=400,left=100,top=105')
		firstWindow.focus()
}

function closeWindow() {
		newWindow = window.close('smallwindow.html','smallWin')
			window.close()
	
	}