// JavaScript Document

function populateTimeList()
{
  var list = document.focusedsearch.role;
  var listValue = document.focusedsearch.role.options[list.selectedIndex].value;  
  var roleValue = new Array();
  roleValue[0] = 'career_advice';
  roleValue[1] = 'career_paths';
  roleValue[2] = 'college_info';
  roleValue[3] = 'jobs'; 
  roleValue[4] = 'prof_train';
  roleValue[5] = 'retail_training';
  roleValue[6] = 'indust_benchmark';
  roleValue[7] = 'hiring';
  roleValue[8] = 'mentor';
  roleValue[9] = 'indust_partner';
  roleValue[10] = 'prof_cert';
  roleValue[11] = 'tech_assist';
  roleValue[12] = '';
 
  var roleDisplay = new Array ();
  roleDisplay[0] = 'Career Advice';
  roleDisplay[1] = 'Career Paths';
  roleDisplay[2] =  'College/University Information';
  roleDisplay[3] =  'Jobs';
  roleDisplay[4] = 'Professional Training/Development';
  roleDisplay[5] =  'Retail Training/Curriculum';
  roleDisplay[6] =  'Industry Benchmarking Data';
  roleDisplay[7] =  'Hiring/Recruitment';
  roleDisplay[8] =  'Becoming a Mentor';
  roleDisplay[9] =  'Industry Partnerships';
  roleDisplay[10] = 'Professional Certification';
  roleDisplay[11] = 'Technical Assistance';
   roleDisplay[12] = 'Select what you are looking for.'; 
  //expert specific time slot availability, number corresponds to the times above
  var st = new Array("12", "0", "1", "2", "3");
  var ed = new Array("12", "1", "2", "10", "5");
  var js = new Array("12", "1", "3", "10", "5");
  var ic = new Array("12", "6", "3", "10", "4");
  var ra = new Array("12", "0", "1", "10", "3");
  var rm = new Array("12", "7", "10", "5");
  var re = new Array("12", "8", "6", "9");
  var wp = new Array("12", "0", "1", "10", "5" ,"11");

  
  if (listValue == 'st' || listValue == 'ed' || listValue == 'js' || listValue == 'ic' || listValue == 'ra' || listValue == 'rm' || listValue == 're'|| listValue == 'wp' ) {  

	var tempVar = listValue;
	var expertTimeLength= eval(tempVar).length;
		
	
	 document.focusedsearch.oppy.length = 0;
	 for (i=0;i<expertTimeLength;i++)
		{
		 var timeSlotVar = listValue+'['+i+']';
		 addOption(document.focusedsearch.oppy,roleDisplay[eval(timeSlotVar)], roleValue[eval(timeSlotVar)]);
		}

  } else if (listValue == ''){
     document.focusedsearch.oppy.length = 0;
      addOption(document.focusedsearch.oppy,"Please select your role first", ""); 
  }
}



function addOption(selectbox,text,value )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}

function makeArrayName(expertValue,listValue)
{
var str = listValue;
return str;
}


function validate_required(field,alerttxt){
	with (field){
			if (value==null||value==""){
			  alert(alerttxt);return false;
			  
			}else {
				return true;
			}
		
	}
}