
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];}
}
	
function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}
	
function PrintThisPage()
{
	var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,";
		
	sOption+="scrollbars=yes,width=750,height=600,left=100,top=25";

	var sWinHTML = document.getElementById('content').innerHTML;

	var winprint=window.open("","",sOption);
	winprint.document.open();
	winprint.document.write('<html><LINK href=/lmc2/css/css.css rel=Stylesheet><body>');
	winprint.document.write(sWinHTML);
	winprint.document.write('<\/body><\/html>');
	winprint.document.close();
	winprint.focus();
}


/*
	Milonic DHTML Website Navigation Menu
	Written by Andy Woolley
	Copyright 2002 (c) Milonic Solutions Ltd. All Rights Reserved.
	Plase vist http://www.milonic.co.uk/menu/ or e-mail menu3@milonic.com
	You may use this menu on your web site  free of charge as long as you
	place prominent links to http://www.milonic.co.uk/menu and you inform
	us of your intentions with your URL  AND ALL copyright notices remain
	in place in all files including your home page.
	Comercial support contracts are available on request if you cannot comply with the above rules.
*/

//From find_physician.htm
function Edits(type)
 {
 if (document.WebProvSrch.selSpecialty != null) {
  	if (document.WebProvSrch.selSpecialty.value == "-" ||
		document.WebProvSrch.selSpecialty.value == "")
	   {
  		alert('Specialty:<a NAME="SpecialtySearch"> is required!');
  		return false;
  	   }
  }
	return true;
 }
 function NameEdits(type)
 {
	document.WebNameSrch.searchType.value = "Name";
 if (document.WebNameSrch.txtSearchLname != null) {
  	if (document.WebNameSrch.txtSearchLname.value == "-" ||
		document.WebNameSrch.txtSearchLname.value == "")
	   {
  		alert('Last Name: is required!');
  		return false;
  	   }
  }
	return true;
 }

var subZipDist = true;
var validZip = true;
var zipAllowableValues = "0123456789";
function checkEditsEnhanced() {
	var subFlag = true;

	if (Edits('criteria')) {
		checkZipDistance();
	} else {
		subFlag = false;
	}

	if ((subFlag == true) && (subZipDist == true)) {
		document.WebProvSrch.submit();
	}
} //checkEditsEnhanced

function checkZipDistance() {
	var zipCode = document.WebProvSrch.selZipCode;
	var distance = document.WebProvSrch.selDistance;
	if ( (zipCode != null) && (distance != null) ) {
	  subZipDist = true; //initializer
  	  if ((zipCode.value == "")  && (distance.value != "")){
  		alert('Zip Code is required!');
  		subZipDist = false;
  		zipCode.focus();
  	   }

//  	  if ((zipCode.value != "")  && (distance.value == "")){
//  		alert('Distance is required!');
//  		subZipDist = false;
//  		distance.focus();
//  	   }
  	  if ((zipCode.value != "")  && (distance.value == "")){
  		document.WebProvSrch.selDistance.value=0;
  		distance.value=0;
  	   }

  	  if ((zipCode.value != "")  && (distance.value != "")){

  		var trimmedZip = Trim(zipCode.value);
  		if (trimmedZip=="") {
  		  alert('Zip Code must not contain spaces.');
  		  subZipDist = false;
  		  zipCode.focus();
  		} else {
  			checkZipAllowableValues();
  			if (validZip == false) {
  			alert('Zip Code must be numeric.');
  			subZipDist = false;
  			zipCode.focus();
  			} else {//check for length of zipcode field.
  				var lenZip = zipCode.value.length;
  				if (lenZip != 5) {
  					alert('Please enter a 5 digit Zip Code.');
  					subZipDist = false;
  					zipCode.focus();
  				} //zipcode length is 5
  			} //zipcpde is numeric
  		} //zipcode doesn't contain spaces
  	   } //((zipCode.value != "")  && (distance.value != ""))

    } //!= null
} //checkZipDistance

function checkZipAllowableValues() {
	validZip = true; //init
	var checkZip = document.WebProvSrch.selZipCode.value;
	for (i = 0;  i < checkZip.length;  i++)
			{
			ch = checkZip.charAt(i);
			for (j = 0;  j < zipAllowableValues.length;  j++)
			if (ch == zipAllowableValues.charAt(j))
			break;
			if (j == zipAllowableValues.length)
			{
			validZip = false;
			break;
			}
	} //for
}

function Trim(s) {
  // Remove leading spaces and carriage returns
  while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r')) {
    s = s.substring(1,s.length); }
  // Remove trailing spaces and carriage returns
  while ((s.substring(s.length-1,s.length) == ' ') ||
         (s.substring(s.length-1,s.length) == '\n') ||
         (s.substring(s.length-1,s.length) == '\r'))  {
    s = s.substring(0,s.length-1);
  }
  return s;
}
