// JavaScript Document

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 validateProviderNomination() {
	with(window.document.providerNomination) {
				if (Employername.value.length<1) {
				  alert("Please enter the Employer Name!");
				  	Employername.focus();
					return false;
				}//end if
				if (Physician_Last.value.length<1) {
				  alert("Please enter the Physician's Last Name!");
					Physician_Last.focus();
					return false;
				}//end if
				if (Physician_First.value.length<1) {
					alert("Please enter the Physician's First Name!");
					Physician_First.focus();
			    return false;
    		}//end if		
				
				if (specialty[0].checked == false && specialty[1].checked == false && specialty[2].checked == false && specialty[3].checked == false) {
					alert("Please enter a Specialty Type!");
			    return false;
    		}//end if		
				if (specialty[3].checked == true && specialty_other.value.length <1) {
					alert("Please enter a Specialty Type!");
					specialty.other.focus();
			    return false;					
				}
				if (Address_1.value.length <1) {
					alert("Please enter an Address!");
					Address_1.focus();
					
			    return false;					
				}
				if (City.value.length <1) {
					alert("Please enter a City!");
					City.focus();
			    return false;					
				}
				if (State.value.length <1) {
					alert("Please enter a State!");
					State.focus();
			    return false;					
				}
				if (Zip.value.length <1) {
					alert("Please enter an Zip Code!");
					Zip.focus();
			    return false;					
				}
				if (Phone.value.length <1) {
					alert("Please enter an Physician Phone Number!");
					Phone.focus();
			    return false;					
				}
	}//end with
	return true;
}//end validateProviderNomination

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.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);

  if(!x && document.getElementById) x=document.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  openBlueEdgeTour() 
{
	var width = screen.width;
	var the_availWidth = screen.availWidth;
	var location = window.location.host;
	 if (width=='1024' || width=="1024" || width=="1024") 
	{
		var hires = 'http://'+location+'/mmedia/blueedge/hires.htm';
		window.open(hires,'hires','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=905,height=660'); return false;
	}
	else if (width=='800' || width=="800" || width=="800") 
	{
		var lores = 'http://'+location+'/mmedia/blueedge/lores.htm';
		window.open(lores,'lores','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=667,height=480'); return false;
	}
	else  
	{	
		var hires = 'http://'+location+'/mmedia/blueedge/hires.htm';
		window.open(hires,'hires','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=905,height=660'); return false;
	}
}
function  openEmployerPortalTour() 
{
	var width = screen.width;
	var the_availWidth = screen.availWidth;
	var location = window.location.host;
	 if (width=='1024' || width=="1024" || width=="1024") 
	{
		var hires = 'http://'+location+'/mmedia/guided_tour/NM_employers/hires_emp_NM.htm';
		window.open(hires,'hires','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=905,height=660'); return false;
	}
	else if (width=='800' || width=="800" || width=="800") 
	{
		var lores = 'http://'+location+'/mmedia/guided_tour/NM_employers/lores_emp_NM.htm';
		window.open(lores,'lores','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=667,height=480'); return false;
	}
	else  
	{	
		var hires = 'http://'+location+'/mmedia/guided_tour/NM_employers/hires_emp_NM.htm';
		window.open(hires,'hires','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=905,height=660'); return false;
	}
}

function trim(str)
{
   	return str.replace(/^\s*|\s*$/g,'');
}

function validateSearch(searchstring)
{

	// validation if no search term is entered  
	if (trim(searchstring.value).length == 0)
	{ 
		alert("Please enter a search term."); 
		searchstring.focus();  
		return false;  
	}


	// regular expression to match alphanumeric characters, spaces, forward slashes, hyphens
	var re = /^[-"\w \/']+$/; 

	// validation fails if the input doesn't match the regular expression  
	if (!re.test(searchstring.value)) 
	{ 
		alert("Search terms contain invalid characters."); 
		searchstring.focus();  
		return false;  
	}
}


function open_phm_demo(theversion)
{
	thewidth = 1020;
	theheight = 710;
	thelink = "http://www.bcbsnm.com/mmedia/phm_tour/index.htm"; // default is full version in case no version specified
	var userwidth = screen.width;
	
	if (theversion == 'full')  	// full version
	{	thelink = "http://www.bcbsnm.com/mmedia/phm_tour/index.htm";	}

	if (theversion == 'nobp')	// non blue points version, link will change once we get this version
	{	thelink = "http://www.bcbsnm.com/mmedia/phm_tour/index.htm";	}


	if (userwidth == 800)
	{
		thewidth = 780;
		theheight = 540;
	}

	attString = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=0,left=0," + "width=" + thewidth + ",height=" + theheight;
	window.open(thelink, '', attString);
}

