function clearbox(thebox)
{
	// Clears a textbox [thebox], but only if it does not begin with "e.g."
	// "e.g." is the default text and should remain in the text box unless the user has entered something else
	if (thebox.value.substr(0,4)== "e.g.")
	{ 
  		thebox.value = "";
	}
}
function lostFocus(el, text)
{
	// When user has clicked on a text box [el]
	// If the box has been blanked out, then replace the text with the "e.g." example text [text]
  	if (el.value=="")
	  	el.value=text;
}
function jobType(el)
{
	// For Job Types;
	// if "All" is selected, then uncheck the rest
	// If Perm, Contract, Locum, or Supply is checked, then uncheck "All"
	if (el.value=="AdvTypeAll")
	{
		if (document.thisForm.AdvTypeAll.checked==true)
		{
			document.thisForm.AdvTypePermanent.checked=false;
			document.thisForm.AdvTypeContract.checked=false;
			document.thisForm.AdvTypeLocum.checked=false;
			document.thisForm.AdvTypeSupply.checked=false;
		}
	}
	else if (el.value=="AdvTypePermanent")
	{
		if (document.thisForm.AdvTypePermanent.checked==true)
		{
			document.thisForm.AdvTypeAll.checked=false;
		}
	}
	else if (el.value=="AdvTypeContract")
	{
		if (document.thisForm.AdvTypeContract.checked==true)
		{
			document.thisForm.AdvTypeAll.checked=false;
		}
	}
	else if (el.value=="AdvTypeLocum")
	{
		if (document.thisForm.AdvTypeLocum.checked==true)
		{
			document.thisForm.AdvTypeAll.checked=false;
		}
	}
	else if (el.value=="AdvTypeSupply")
	{
		if (document.thisForm.AdvTypeSupply.checked==true)
		{
			document.thisForm.AdvTypeAll.checked=false;
		}
	}
	// Have All sub-boxes been unchecked now??
	// Then set Select All
	if (document.thisForm.AdvTypePermanent.checked==false && 
		document.thisForm.AdvTypeContract.checked==false && 
		document.thisForm.AdvTypeLocum.checked==false && 
		document.thisForm.AdvTypeSupply.checked==false)
	{
		document.thisForm.AdvTypeAll.checked=true;
	}


	// For Job Types;
	// if "All" is selected, then uncheck the rest
	// If Perm, Contract, Locum, or Supply is checked, then uncheck "All"
	if (el.value=="TypeAll")
	{
		if (document.thisForm.TypeAll.checked==true)
		{
			document.thisForm.TypePermanent.checked=false;
			document.thisForm.TypeContract.checked=false;
			document.thisForm.TypeLocum.checked=false;
			document.thisForm.TypeSupply.checked=false;
		}
	}
	else if (el.value=="TypePermanent")
	{
		if (document.thisForm.TypePermanent.checked==true)
		{
			document.thisForm.TypeAll.checked=false;
		}
	}
	else if (el.value=="TypeContract")
	{
		if (document.thisForm.TypeContract.checked==true)
		{
			document.thisForm.TypeAll.checked=false;
		}
	}
	else if (el.value=="TypeLocum")
	{
		if (document.thisForm.TypeLocum.checked==true)
		{
			document.thisForm.TypeAll.checked=false;
		}
	}
	else if (el.value=="TypeSupply")
	{
		if (document.thisForm.TypeSupply.checked==true)
		{
			document.thisForm.TypeAll.checked=false;
		}
	}
	// Have All sub-boxes been unchecked now??
	// Then set Select All
	if (document.thisForm.TypePermanent.checked==false && 
		document.thisForm.TypeContract.checked==false && 
		document.thisForm.TypeLocum.checked==false && 
		document.thisForm.TypeSupply.checked==false)
	{
		document.thisForm.TypeAll.checked=true;
	}
	
}
function displayByID(id)
{
	document.getElementById(id).style.display = 'block';
}
function hideByID(id)
{
	document.getElementById(id).style.display = 'none';
}
function displayMore()
{
	displayByID('moreSearch');
	hideByID('showMore');
	hideByID('firstJobSearchSeperator');
	hideByID('firstSearchButton');
}
function displayAdvancedForm()
{
	displayByID('jobSearchAdvancedForm');
	hideByID('jobSearchForm');
}
function hideAdvancedForm()
{
	displayLess()
	hideByID('jobSearchAdvancedForm');
	displayByID('jobSearchForm');
}
function showSalary(el)
{
	document.getElementById('ADVsalaryAnnualFrom').style.display = 'none';
	document.getElementById('ADVsalaryAnnualTo').style.display = 'none';
	document.getElementById('ADVsalaryWeeklyFrom').style.display = 'none';
	document.getElementById('ADVsalaryWeeklyTo').style.display = 'none';
	document.getElementById('ADVsalaryDailyFrom').style.display = 'none';
	document.getElementById('ADVsalaryDailyTo').style.display = 'none';
	document.getElementById('ADVsalaryHourlyFrom').style.display = 'none';
	document.getElementById('ADVsalaryHourlyTo').style.display = 'none';
	
	if (el.value=="annual") {

		document.getElementById('ADVsalaryAnnualFrom').style.display = 'inline';
		document.getElementById('ADVsalaryAnnualTo').style.display = 'inline';
		resetToAll('ADVsalaryAnnualFrom','ALL');
		resetToAll('ADVsalaryAnnualTo','ALL');
		document.getElementById('ADVsalaryAnnualTo').disabled=true;
	}		
	else if (el.value=="weekly") {

		document.getElementById('ADVsalaryWeeklyFrom').style.display = 'inline';
		document.getElementById('ADVsalaryWeeklyTo').style.display = 'inline';
		resetToAll('ADVsalaryWeeklyFrom','ALL');
		resetToAll('ADVsalaryWeeklyTo','ALL');
		document.getElementById('ADVsalaryWeeklyTo').disabled=true;
	}	
	else if (el.value=="daily") {

		document.getElementById('ADVsalaryDailyFrom').style.display = 'inline';
		document.getElementById('ADVsalaryDailyTo').style.display = 'inline';
		resetToAll('ADVsalaryDailyFrom','ALL');
		resetToAll('ADVsalaryDailyTo','ALL');
		document.getElementById('ADVsalaryDailyTo').disabled=true;
	}	
	else if (el.value=="hourly") {
		
		document.getElementById('ADVsalaryHourlyFrom').style.display = 'inline';
		document.getElementById('ADVsalaryHourlyTo').style.display = 'inline';
		resetToAll('ADVsalaryHourlyFrom','ALL');
		resetToAll('ADVsalaryHourlyTo','ALL');
		document.getElementById('ADVsalaryHourlyTo').disabled=true;
	}
}
function initialDisable()
{
	document.getElementById('salaryAnnualTo').disabled=true;
	document.getElementById('ADVsalaryAnnualTo').disabled=true;
}
function enableTo(el,id)
{alert
	if (el.value=='ALL')
	{
		document.getElementById(id).disabled=true;
	}
	else
	{
		document.getElementById(id).disabled=false;
	}
}
function resetToAll(selBox, val)
{
	if (selBox=='salaryAnnualFrom')
	{
		for(i=0; i<document.thisForm.salaryAnnualFrom.length;i++)
		{ 
			if(document.thisForm.salaryAnnualFrom.options[i].value==val)
			{
				document.thisForm.salaryAnnualFrom.selectedIndex=i
			}
		}
	}
	else if (selBox=='salaryAnnualTo')
	{
		for(i=0; i<document.thisForm.salaryAnnualTo.length;i++)
		{
			if(document.thisForm.salaryAnnualTo.options[i].value==val)
			{
				document.thisForm.salaryAnnualTo.selectedIndex=i
			}
		}
	}
	else if (selBox=='salaryWeeklyFrom')
	{
		for(i=0; i<document.thisForm.salaryWeeklyFrom.length;i++)
		{
			if(document.thisForm.salaryWeeklyFrom.options[i].value==val)
			{
				document.thisForm.salaryWeeklyFrom.selectedIndex=i
			}
		}
	}
	else if (selBox=='salaryWeeklyTo')
	{
		for(i=0; i<document.thisForm.salaryWeeklyTo.length;i++)
		{ 
			if(document.thisForm.salaryWeeklyTo.options[i].value==val)
			{
				document.thisForm.salaryWeeklyTo.selectedIndex=i
			}
		}
	}
	else if (selBox=='salaryDailyFrom')
	{
		for(i=0; i<document.thisForm.salaryDailyFrom.length;i++)
		{ 
			if(document.thisForm.salaryDailyFrom.options[i].value==val)
			{
				document.thisForm.salaryDailyFrom.selectedIndex=i
			}
		}
	}
	else if (selBox=='salaryDailyTo')
	{
		for(i=0; i<document.thisForm.salaryDailyTo.length;i++)
		{ 
			if(document.thisForm.salaryDailyTo.options[i].value==val)
			{
				document.thisForm.salaryDailyTo.selectedIndex=i
			}
		}
	}
	else if (selBox=='salaryHourlyFrom')
	{
		for(i=0; i<document.thisForm.salaryHourlyFrom.length;i++)
		{ 
			if(document.thisForm.salaryHourlyFrom.options[i].value==val)
			{
				document.thisForm.salaryHourlyFrom.selectedIndex=i
			}
		}
	}
	else if (selBox=='salaryHourlyTo')
	{
		for(i=0; i<document.thisForm.salaryHourlyTo.length;i++)
		{ 
			if(document.thisForm.salaryHourlyTo.options[i].value==val)
			{
				document.thisForm.salaryHourlyTo.selectedIndex=i
			}
		}
	}
	else if (selBox=='ADVsalaryAnnualFrom')
	{
		for(i=0; i<document.thisForm.ADVsalaryAnnualFrom.length;i++)
		{ 
			if(document.thisForm.ADVsalaryAnnualFrom.options[i].value==val)
			{
				document.thisForm.ADVsalaryAnnualFrom.selectedIndex=i
			}
		}
	}
	else if (selBox=='ADVsalaryAnnualTo')
	{
		for(i=0; i<document.thisForm.ADVsalaryAnnualTo.length;i++)
		{
			if(document.thisForm.ADVsalaryAnnualTo.options[i].value==val)
			{
				document.thisForm.ADVsalaryAnnualTo.selectedIndex=i
			}
		}
	}
	else if (selBox=='ADVsalaryWeeklyFrom')
	{
		for(i=0; i<document.thisForm.ADVsalaryWeeklyFrom.length;i++)
		{
			if(document.thisForm.ADVsalaryWeeklyFrom.options[i].value==val)
			{
				document.thisForm.ADVsalaryWeeklyFrom.selectedIndex=i
			}
		}
	}
	else if (selBox=='ADVsalaryWeeklyTo')
	{
		for(i=0; i<document.thisForm.ADVsalaryWeeklyTo.length;i++)
		{ 
			if(document.thisForm.ADVsalaryWeeklyTo.options[i].value==val)
			{
				document.thisForm.ADVsalaryWeeklyTo.selectedIndex=i
			}
		}
	}
	else if (selBox=='ADVsalaryDailyFrom')
	{
		for(i=0; i<document.thisForm.ADVsalaryDailyFrom.length;i++)
		{ 
			if(document.thisForm.ADVsalaryDailyFrom.options[i].value==val)
			{
				document.thisForm.ADVsalaryDailyFrom.selectedIndex=i
			}
		}
	}
	else if (selBox=='ADVsalaryDailyTo')
	{
		for(i=0; i<document.thisForm.ADVsalaryDailyTo.length;i++)
		{ 
			if(document.thisForm.ADVsalaryDailyTo.options[i].value==val)
			{
				document.thisForm.ADVsalaryDailyTo.selectedIndex=i
			}
		}
	}
	else if (selBox=='ADVsalaryHourlyFrom')
	{
		for(i=0; i<document.thisForm.ADVsalaryHourlyFrom.length;i++)
		{ 
			if(document.thisForm.ADVsalaryHourlyFrom.options[i].value==val)
			{
				document.thisForm.ADVsalaryHourlyFrom.selectedIndex=i
			}
		}
	}
	else if (selBox=='ADVsalaryHourlyTo')
	{
		for(i=0; i<document.thisForm.ADVsalaryHourlyTo.length;i++)
		{ 
			if(document.thisForm.ADVsalaryHourlyTo.options[i].value==val)
			{
				document.thisForm.ADVsalaryHourlyTo.selectedIndex=i
			}
		}
	}
}