//------------------------------------------------------------------------------------------------
function ShowModallessWindow(pURL, pHeight, pWidth, pHasScrollBars) {
    var openWindow; 
    var strWindowWidth = pWidth;
    var strWindowHeight = pHeight;
    
    var strLeft = window.screen.availWidth;
    var strTop = window.screen.availHeight;
    strLeft = ((strLeft - strWindowWidth) / 2);
    strTop = ((strTop - strWindowHeight) / 2);

    if (openWindow) {
        if (!openWindow.close()) {
            openWindow.close();
        }
    }
    openWindow = window.open('' + pURL + '', "", "top=" + strTop + ",left=" + strLeft + ",height=" + strWindowHeight + ",width=" + strWindowWidth + ",status=0,resizable=1,scrollbars=" + pHasScrollBars + ",toolbar=0");
}

function ChangeEmploymentStatus()
{
	

	var employment = document.getElementById("employmentStatus");
	var industry = document.getElementById("industry");
	var position = document.getElementById("functional_role");
	
	if(employment!=null &&( employment.value ==8 || employment.value == 4) )
	{
		industry.value = 127;
		ChangeIndustry(127);
		position.disabled = true;
	}
	else
	{
			
		industry.value=0;
		ChangeIndustry(0);
		position.disabled = false;
	}
}


/* Industries ***/
function ReloadIndustry()
{
	var industry = document.getElementById("industry");
	var industryHidden = document.getElementById("industryHidden");
	var industryHiddenValue = industryHidden.value;
	
	ChangeIndustry(industry.value);	
	
	industryHidden.value= industryHiddenValue;

}

function ChangeIndustry(selectedValue)
{
	
	var subIndustrySelected = document.getElementById("subIndustry"+selectedValue);
	var industryHidden = document.getElementById("industryHidden");

	
	
	
	HideSubIndustries();
	
	if(subIndustrySelected!=null)
	{
		industryHidden.value=0;
		showObj(subIndustrySelected);
	}
	else
	{
		industryHidden.value = selectedValue;	
	}
}

function SelectSubIndustry(selectedValue)
{
	var industryHidden = document.getElementById("industryHidden");
	industryHidden.value =selectedValue;	
}


function HideSubIndustries()
{
	var form = document.forms[0];
	
	if(form!=null)
	{
		var x=0;
		
		for(x=0;x<form.length;x++)
		{
			var formElement = form[x];
			
			if(formElement.id.indexOf("subIndustry")==0)
			{
				hideObj(formElement);	
			}
		}
	}
}
/* Industries END******/


/*Positions *************************/

function ReloadPosition()
{
	var position = document.getElementById("functional_role");
	var positionHidden = document.getElementById("positionHidden");
	var positionHiddenValue = positionHidden.value;

	
	ChangePosition(position.value);	
	positionHidden.value = positionHiddenValue;

}

function ChangePosition(selectedValue)
{
	

	var subPositionSelected = document.getElementById("subPosition"+selectedValue);
	var positionHidden = document.getElementById("positionHidden");
	var residency_year = document.getElementById("residency_year");
	var residencyCombo = document.getElementById("residencyCombo");
	
	HideSubPositions();
	
	if(subPositionSelected!=null)
	{
		positionHidden.value=0;
		showObj(subPositionSelected);
	}
	else
	{
		positionHidden.value = selectedValue;
	}
	
	if(selectedValue==115)
	{
		
		showObj(residency_year);
	}
	else
	{
		residencyCombo.value =0;
		hideObj(residency_year);
	}
	
}

function SelectSubPosition(selectedValue)
{
	var positionHidden = document.getElementById("positionHidden");
	positionHidden.value =selectedValue;	
}


function HideSubPositions()
{
	var form = document.forms[0];
	
	if(form!=null)
	{
		var x=0;
		
		for(x=0;x<form.length;x++)
		{
			var formElement = form[x];
			
			if(formElement.id.indexOf("subPosition")==0)
			{
				hideObj(formElement);	
			}
		}
	}
}



/*Positions END******************/



function loadConcept(param) 
			{
				var mylink = "../image.aspx?image_src="+param;
				var load = window.open(mylink,'','scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no');
				load.focus();
			}


function right(e) {
if (navigator.appName == 'Netscape' && 
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' && 
(event.button == 2 || event.button == 3)) {
alert("Right click disabled.");
return false;
}
return true;
}



function disableReturn(evt) {
	var evt  = (evt) ? evt : ((event) ? event : null);
	var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
	if ((evt.keyCode == 13) && (node.type=="text")) { return false; }
}

function Shutdown()
{
	if(self.screenTop>9000)
	{
		var mywindow = window.open("../close.aspx","close","toolbar=no,top=0,status=yes,menubar=no,resizable=no,scrollbars=no,width=200,height=200");
	}
}


function UncheckColumn(checkbox) 
{
	 //documentation for this script at http://www.shawnolson.net/a/693/
     var theForm = checkbox.form, z = 0;
     while (theForm[z]) 
	{
	
		if(theForm[z].type=="checkbox")
		{

	  		if(theForm[z].id != checkbox.id && theForm[z].value==checkbox.value)
			{
	
      			theForm[z].checked = false;
			}

		}
      	z++;
     }
}


function CheckColumnSelected()
{
}

function UncheckColumnExclude(checkbox) 
{
	 //documentation for this script at http://www.shawnolson.net/a/693/
     var theForm = checkbox.form, z = 0;
     while (theForm[z]) 
	{
	
		if(theForm[z].type=="checkbox")
		{

	  		if(theForm[z].id != checkbox.id && theForm[z].value==checkbox.value)
			{

				var exc=theForm[z].alt;

				if(exc!=null)
				{
					
					if(exc.indexOf('*')>-1)
      				theForm[z].checked = false;
				}
			}

		}
      	z++;
     }
}

function CheckDual(checkbox,field_id)
{
	var field=document.getElementById(field_id);

	if(checkbox.checked==false)
	{
		field.value="";
		field.disabled=true;
	}
	else
	{
		field.disabled=false;
	}
}

function UncheckAnswers(checkboxes,checkbox,_reset)
{

	if(checkbox.checked)
	{

		var sep = checkboxes.split('|');

		var checkbs = sep[0];
		var col_excludes;
		var cexcludes;

		if(sep.length>1)
		{
			col_excludes=sep[1];
			cexcludes=col_excludes.split(',');
		}
		
		var temp = checkbs.split(',');

		for(x=0;x<temp.length;x++)
		{


			var _checkbox=document.getElementById(temp[x]);
			

			if(_checkbox!=null)
			{


				if(_reset==true)
				{
					if(_checkbox.style.visibility=='hidden')
					{
					if(_checkbox.checked==true)
						_checkbox.click();
					
					}
					else
					{
						_checkbox.checked=false;
					}
		
				}
		
				else
				{
					
					_checkbox.checked=false;
				}
				
			}
		}
		
	}

	else if(checkbox.checked==false && _reset==true)
	{

		var temp1 = checkboxes.split(',');

		for(w=0;w<temp1.length;w++)
		{
			var _checkbox=document.getElementById(temp1[w]);
			if(_checkbox!=null)
			{
				
				if(_checkbox.style.visibility=='hidden')
				{
					
					_checkbox.click();
				}
				
			}
		}
	}

	if(checkbox.checked)
	{
		if(cexcludes!=null)
		{
			if(cexcludes.length>0)
			{
					

				for(i=0;i<cexcludes.length;i++)
				{
				
					if(cexcludes[i].indexOf('*')>-1)
					{
						if(cexcludes[i].indexOf(checkbox.value)>-1)
						UncheckColumn(checkbox);
					}
					else
					{
						if(cexcludes[i].indexOf(checkbox.value)>-1)
						{
							UncheckColumnExclude(checkbox);
						}
					}
				}
			}
		}
	}
	
}


function CheckAnsweredOnlyOne(base,number,answer)
{
	result = false;
	
	var current_form = document.forms[0];
	
	for(x=0;x<current_form.length;x++)
	{
	
		var control = current_form[x];
		if(control !=null)
		{
			if(control.name.indexOf(base)>-1)
			{
				if(control.name!=answer)
				{
				
					if(control.checked==true)
					{
				
						result = true;
						break;
					}
				}
			}
		}
	}
	
	return result;
}


function ValidateDual(checkbox,field)
{
	if(checkbox.checked==true)
	{
		if(trim(field.value)=="")
		{
			alert("Please specify");
			field.focus();
			return false;
		}
	}
	return true;
}

function CheckSingleChoiceSelected(ctrls,answer)
{
	var result = false;
	var controls = ctrls.split(',');
	
	for(x=0;x<controls.length;x++)
	{
	
		var control = document.getElementById(controls[x]);
		if(control !=null)
		{
			if(control.id!=answer)
			{
				if(control.checked==true)
				{
					result = true;
					break;
				}
			}
		}
	}
	
	return result;
}


function validateCheck(amount)
{
	if (amount < 20.00) {
		alert("You must have a minimum of $20.00 in your account to request a check");
		return false;
	}
	return true;
}

function validateCheckAddress()
{
	var addr = document.getElementById("address1")
	if (addr.value=="") {
		alert("Your address is required to process a check request.");
		return false;
	}
	return true;
}


function isValidExpression(text_field_id,regex,range)
{
	var textfield = document.getElementById(text_field_id);
	if(textfield!=null)
	{
		if(textfield.value.length>0)
		{
			if(!trim(textfield.value).match(trim(regex))) 
			{

				textfield.focus();
				alert("The value in the selected box is not valid. Please review your answers");
				return false;		
			}
			
			if(range!=null)
			{
				if(range.length>0)
				{
					var temp = range.split('-');
					var lower_limit = parseInt(temp[0]);
					var upper_limit = parseInt(temp[1]);
					
					
					if(parseInt(textfield.value)>=lower_limit && parseInt(textfield.value)<=upper_limit)
					{}
					else
					{
						textfield.focus();
						alert("The value in the selected box is out of range. Valid range is "+range+". Please review your answers");
						return false;
					}
					
				}
			}
		}
	} 


	return true;
}



function isValidArithExpression(arithex)
{
	if(arithex!=null)
	{
		if(arithex.length>0)
		{
				
			var is_valid = eval(arithex);

			if(!is_valid)
			{
				var temp = arithex.split('\'');
				for(f=0;f<temp.length;f++)
				{
					if(temp[f].indexOf("Q")>-1)
					{
						var control = document.getElementById(temp[f]);
						if(control!=null)
						{
							control.focus();
						}
						alert("The answers you provided are invalid. Please review your answers according to the question's instructions");
							return false;
					}
				}
				return false;
			}
		}
	} 

	return true;
}


function checkArithExp(arithexp_vector)
{
	if(arithexp_vector!=null)
	{

		
		for(a=0;a<arithexp_vector.length;a++)
		{
			var arithex_logic ="";
			 arithex_logic+=arithexp_vector[a];
				
			 while(arithex_logic.indexOf("**")>-1)
			{
				arithex_logic=arithex_logic.replace('**','\'');
			}

			if(!isValidArithExpression(arithex_logic))
			{
				return false;
			}
		
		}
	}

	return true;
}

function checkRegExp(regex_vector)
{
	if(regex_vector!=null)
	{
		for(w=0;w<regex_vector.length;w++)
		{
			var validation_logic = regex_vector[w];
			var text_field_id=validation_logic[0];
			var regex=validation_logic[1];
			var range = validation_logic[2];

			if(!isValidExpression(text_field_id,regex,range))
			{
				return false;
			}
			
		}
	}

	return true;
}

function checkSurvey(ctrls,regex_vector,arithex_vector,column_exclusive)
{


	var correct = false;
	var valid = true;
	var checked=false;
	var firstControl;

	if(trim(ctrls)!="")
	{
	var question=ctrls.split("|");
	
		for(z=0;z<question.length;z++)
		
		{
				var controls = question[z].split(",");
				var question_num=0;
				var open_question_alert=false;
				
			if(controls.length>=1)
			{
			
			var question_number=controls[0].split('_');
			
			
			question_num=question_number[0].substring(1,question_number[0].length);
				
		
				correct=false;
				valid=true;
				var invalid_control;
				
				for(x=0;x<controls.length;x++)
				{
					
					var ctrl  = document.getElementById(controls[x]);
					
					if(ctrl!=null)
					{
						var ctr_arr=controls[x].split("_");
					
						if(x==0)
						{
							firstControl=ctrl;
						}
				
						if(ctrl.selectedIndex)
						{
							if(ctrl.selectedIndex>=0)
							{
								correct=true;
								break;
							}	
			
						}
					else
						if(ctrl.checked)
						{
							correct=true;
							
			
							if(ctr_arr.length>=3)
							{	
								if(ctr_arr[2]=="D1")
								{	
									if(CheckSingleChoiceSelected(question[z],controls[x]))
									{
										valid=false;
										invalid_control=ctrl;
										break;
									}
				
								}
						
							}
							
						}
						
						else
						if(ctrl.type=="text" || ctrl.cols)
						{
							
							if(ctr_arr[3]=="DUAL")
								{
									var next_ctrl  = document.getElementById(controls[x+1]);
									if(!ValidateDual(next_ctrl,ctrl))
									{
										return false;
									}
								}
								
							open_question_alert=true;
							if(trim(ctrl.value)!="")
							{
							correct=true;
							break;
							}
						}
			
					}	
				}
				
				if(!correct)
				{
					if(open_question_alert)
					alert("Please type in your opinion");
					else
					alert("A response to one of the questions was missed, please check to see if you answered all questions before proceeding.");
					firstControl.focus();
					checked=false;
					break;
				}
				else if(!valid)
				{
					var parentControl = document.getElementById(invalid_control.id+"CT");
					alert("Invalid answer. The option \""+parentControl.title+"\" cannot be selected in conjunction with any other options. Please review your answers");
					invalid_control.focus();
					checked=false;
					break;
				}
				else{
				checked=true;
				}
			}
			else
			{
				correct=true;
				valid=true;
				checked=true;
			}
		}
	}
	else
	{
		checked=true;
	}
	
	


	if(!checkRegExp(regex_vector))
	{
		checked=false;
		return false;
	}
	

	if(!checkArithExp(arithex_vector))
	{
		checked=false;
		return false;
	}



	if(column_exclusive!=null)
	{

		if(column_exclusive.length>0)
		{

			var theForm = document.forms[0];
			
			
			var exclusive_array = column_exclusive.split(',');

			for(w=0;w<exclusive_array.length;w++)
			{
				var is_checked=false;
				var z=0;
				while (theForm[z]) 
				{
	
					if(theForm[z].type=="checkbox")
					{
						
	  					if(theForm[z].value==exclusive_array[w])
						{
							
							if(theForm[z].checked==true)
							{
								is_checked=true;
								break;
							}
							
						}
					}
					z++;
				}
      				
     			if(!is_checked)
				{
					alert("You must check at least one value on the column");
					checked=false;
					return false;
				}

			}
		}
	}

	return checked;
}


function LoadCarOwnership(carData)
{
	init(document.forms[0]);
	var cars=carData.split("|");
	for(x=0;x<cars.length;x++)
	{
		var car_values=cars[x].split(",");
		SetCarValues((x+1),car_values[0],car_values[1],car_values[2]);
	}
}

function SetCarValues(car_num,make_value,model_value,year_value)
{
	var make = document.getElementById("make"+car_num);
	var model = document.getElementById("model"+car_num);
	var year = document.getElementById("year"+car_num);
	
	make.value=make_value;
	
	if(car_num==1)
	{
	listmodelofcar.populate();
	}
	else
	{
	listmodelofcar2.populate();
	}
	
	model.value=model_value;
	year.value=year_value;
}


function CheckCheckBox(ctrl_name,_value)
{
	var ctrl=document.getElementById(ctrl_name);
	
	if(ctrl!=null)
	{
		if(ctrl.value==_value)
		{
			ctrl.checked=true;
		}
	}
}

function checkAgree()
{
	
	var agree = document.getElementById("agree");
	
	
	if(!agree.checked)
	{
		
		alert("You must agree to the Terms and Conditions to continue.  If you do not agree to the Terms and Conditions, please exit the sign up process.");
		agree.focus();
		return false;
	}
	
	return true;	
}

function showFrame(ctrl_name)
{
	if(document.getElementById)
	{
		document.getElementById(ctrl_name).style.visibility="visible";
	}
}



function ShowTermsAgreement()
{
	if(document.getElementById)
	{
		var terms_conditions =document.getElementById("terms_conditions");
	
		if(terms_conditions.style.visibility=="visible")
		{
			terms_conditions.style.visibility="hidden";
		}
		else
		{
			terms_conditions.style.visibility="visible";
		}
		
	}
}

function showCityState(root)
{
	if(document.getElementById)
	{
	var stateCombo =document.getElementById("stateCombo");
	var cityT=document.getElementById("cityText");
	var city = document.getElementById("city");
	var state = document.getElementById("state");
	var changeImage = document.getElementById("changeImage");
	var override= document.getElementById("overrideV");
	
	if(stateCombo.style.visibility=="visible")
	{
		stateCombo.style.visibility="hidden";
		cityT.style.visibility="hidden";
		city.style.visibility="visible";
		state.style.visibility="visible";
		changeImage.src=root+"WEB-APP/images/change.gif";
		override.value=0;

	}
	else
	{
		stateCombo.style.visibility="visible";
		cityT.style.visibility="visible";
		city.style.visibility="hidden";
		state.style.visibility="hidden";
		changeImage.src=root+"WEB-APP/images/changeT.gif";
		override.value=1;
		cityT.focus();
		
	}
		
	}
}

function hideFrame(ctrl_name)
{
		if(document.getElementById)
	{
		document.getElementById(ctrl_name).style.visibility="hidden";
	}
}


function removeChildFromList() 
{


	var listField = document.getElementById("childrenList");
	
   if ( listField.length == -1) 
   {  // If the list is empty
      alert("There are no values which can be removed!");
   }
    else 
	{
      var selected = listField.selectedIndex;
      if (selected == -1) 
	  {
         alert("You must select an entry to be removed!");
      }
	   else 
	  {  // Build arrays with the text and values to remain
         var replaceTextArray = new Array(listField.length-1);
         var replaceValueArray = new Array(listField.length-1);
         for (var i = 0; i < listField.length; i++) 
		 {
            // Put everything except the selected one into the array
            if ( i < selected) { replaceTextArray[i] = listField.options[i].text; }
            if ( i > selected ) { replaceTextArray[i-1] = listField.options[i].text; }
            if ( i < selected) { replaceValueArray[i] = listField.options[i].value; }
            if ( i > selected ) { replaceValueArray[i-1] = listField.options[i].value; }
         }
         listField.length = replaceTextArray.length;  // Shorten the input list
         for (i = 0; i < replaceTextArray.length; i++)
		  { // Put the array back into the list
            listField.options[i].value = replaceValueArray[i];
            listField.options[i].text = replaceTextArray[i];
         }
      } // Ends the check to make sure something was selected
   } // Ends the check for there being none in the list

}


function updateChild(genderV,dobV)
{

	var dob = dobV.split("/");
	var gender = genderV;
	
	var genderT="";
	
	if(gender=="M")
	{
		genderT="Male";
	}
	else
	{
		genderT="Female";
	}
	
	var list = document.getElementById("childrenList");
	var len=list.length++;
	list.options[len].text=genderT+" DOB:"+dobV;
	list.options[len].value=gender+"|"+dobV;
}


function addChild()
{
	var gender = document.getElementById("child_gender");
	var list = document.getElementById("childrenList");
	var month=document.getElementById("child_month");
	var day=document.getElementById("child_day");
	var year=document.getElementById("child_year");
	
	if(gender.value!=0)
	{
		var len=list.length++;
		var myoption = new Option(gender.options[gender.selectedIndex].text+" DOB:"+month.options[month.selectedIndex].text+"/"+day.value+"/"+year.value,gender.value+"|"+month.value+"/"+day.value+"/"+year.value); 
		list.options[len]=myoption;
	
	}
	else
	{
		alert("Please select the gender of your child");
	}	
}



function zipFunc()
{
	var zip = document.getElementById("zip");
	var zip_invisible = document.getElementById("zipInvisible");
	var zipButton = document.getElementById("zipButton");
	
	if(trim(zip.value)=="")
	{
		alert("Please provide you 5 digit zip code and click the white arrow to confirm state/city");
		zip.focus();
	}
	else
	{
	
	if(isInteger(trim(zip.value)))
	{
		if(trim(zip.value)!=trim(zip_invisible.value))
		{
		zipButton.focus();
		}
	}
	else
	{
		alert("Invalid zip code. Please provide a 5 digit zip code and click the white arrow to confirm state/city");
		zip.focus();
		return false;
	}
}
	
}




function UnCheckAllByName(base_name)
{
	
	var x =0;
	
	for(x=0;x<document.forms[0].length;x++)
	{
		var element= document.forms[0][x];
		
		if(element.name.indexOf(base_name)==0)
		{
			
			if(element.type=="checkbox" || element.type=="radio")
			{
				element.checked=false;	
			}
		
		}
	}
}	


function CheckAllByName(base_name)
{
	
	var x =0;
	
	for(x=0;x<document.forms[0].length;x++)
	{
		var element= document.forms[0][x];
		
		if(element.name.indexOf(base_name)==0)
		{
			if(element.type=="checkbox")
			{
				element.checked=true;	
			}
			else if(element.type=="radio")
			{
				var y =0;
				
				for(y=0;y<element.length;y++)
				{
					element[y].checked=true;	
				}
			}
		}
	}
}	



function chgInsurance(obj)
{
	if(obj!=null)
	{
		
		var insurance_companies = document.getElementById("insurance_type_companies_tbl");
		var med_insurance_type = document.getElementById("med_insurance_type");
		var temp = obj.name.split(":");
		var obj_id = temp[1];
		
		if(obj.checked)
		{
		

		


		
		if(obj_id=="4")
		{
			insurance_companies.style.visibility="hidden";
			insurance_companies.style.display="none";
			
			med_insurance_type.style.visibility="hidden";
			med_insurance_type.style.display="none";
			
			UnCheckAllByName("insurance_company_cl");
			UnCheckAllByName("health_insurance_type_rbl");
		}
		else
		{
			insurance_companies.style.visibility="visible";
			insurance_companies.style.display="";
			
		
		
		}
		
		if(obj_id=="1")
		{
			med_insurance_type.style.visibility="visible";
			med_insurance_type.style.display="";
		}
		
		
		}
		else
		{
		
			var i =0;
			var ischecked=false;
			
			for(i=0;i<document.forms[0].length;i++)
			{
				var element = document.forms[0][i];
				
				if(element.type=="checkbox")
				{
					
					
					if(element.name.indexOf(temp[0])==0)
					{
					
						if(element.checked)
						{
							ischecked = true;
							break;
						}
					}
				}
			}
			
			
			if(!ischecked)
			{
			insurance_companies.style.visibility="hidden";
			insurance_companies.style.display="none";
			
			UnCheckAllByName("insurance_company_cl");
			}
			
			
			if(obj_id=="1")
			{
			med_insurance_type.style.visibility="hidden";
			med_insurance_type.style.display="none";
			UnCheckAllByName("health_insurance_type_rbl");
			}
		}
	}
}


function changeUSABorn(obj)
{	
	if (obj.value==1){
		
		us_time.style.visibility='hidden'; 
		us_time.style.display='none';
		UnCheckAllByName("time_in_us_rbl");
	} 
	else{ 
		us_time.style.visibility='';
		us_time.style.display=''; 
	}
}



function ValidateZipCode()
{
var zip = document.getElementById("zip");
var zip_invisible = document.getElementById("zipInvisible");
var zipButton = document.getElementById("zipButton");
var validZipCode = document.getElementById("validZipCode");


if(isInteger(trim(zip.value)))
	{

	

	
		if(validZipCode.value==0 || trim(zip.value)!=trim(zip_invisible.value))
		{
			if(trim(zip.value)!="")
			{
				alert("Please click the white arrow to confirm state/city");
				return false;
				//document.forms[0].submit=false;
			}
		}
		else
		{
			return true;	
		}
	}
	else
	{
		zip.focus();
		
	}
		
		return false;
}

function DisableZipCode()
{
	var zip = document.getElementById("zip");
	var zip_invisible = document.getElementById("zipInvisible");
	var zipButton = document.getElementById("zipButton");
	
	alert("In order for you to update your address, please contact help@focusfwdonline.com");
	zip.value = zip_invisible.value;
	zip.focus();
	return false;
}

function CheckZipCode()
{
	var zip = document.getElementById("zip");
	var zip_invisible = document.getElementById("zipInvisible");
	var zipButton = document.getElementById("zipButton");
	var validZipCode = document.getElementById("validZipCode");
	
	validZipCode.value=1;
	return true;
}


function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}

function showObj(obj){
	obj.style.visibility="visible";
	obj.style.display="";
}

function hideObj(obj){
	obj.style.visibility="hidden";
	obj.style.display="none";
}

function addExpertiseAreas(rolefield, field, objTable)
{

	var doctorRole= new Array("None", "Cardiology","Dermatology","Endocrinology","Gastroenterology","Gynecology","Internal Medicine","Nephrology","Neurology","Oncology","Orthopedics","Pediatrics","Plastic Surgery","Primary Care","Rheumatology","Urology","Other");
	var doctorRoleId = new Array(25,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
	var nurseRole = new Array("None","LPN","RN","BSN","Nurse Practitioner","Nurse Manager","Nurse Midwife", "Other");
	var nurseRoleId = new Array(24,17,18,19,20,21,22,23);

	var role = rolefield[rolefield.selectedIndex].value;
	var showCombo = 0;
	
	field.options.length=0;
	if (role==24) //Doctor
	{
	 	for(var i=0; i<doctorRole.length; i++) 	
 	 	field.options[field.options.length] = new Option(doctorRole[i], doctorRoleId[i]);	
		showCombo=1;
	}
	else if(role==41) 
	{
		for(var j=0; j<nurseRole.length; j++) 	
 	 	field.options[field.options.length] = new Option(nurseRole[j], nurseRoleId[j]);	
		showCombo=1;
	}
	else
	{
		field.selectedIndex=0;
		showCombo=0;
	}


	if (showCombo==1)
	{
		showObj(objTable);
	}
	else
	{
		hideObj(objTable);
	}	
}