// JavaScript Document

function doSearch()
{
	
	var theval = document.forms["searchform"].searchvalue.value;
	
	var addaster = '*';
	if (theval.substring(0,1) == '='){var addaster = ''};
	
	var thesearchfield = document.forms["searchform"].searchfield.value;
	//var thesearchview = document.forms["searchform"].searchview[1].checked;
	var theaction = "";
	var addaction = "";

	//alert(thesearchview);

	//if (theval == '')
//		{
//			alert('Please enter a search term.')
//		}
//	else
//	{
		if (document.forms["searchform"].searchview[0].checked == true)
		{
			theaction = "/search/default.asp?dbname=gelest&dataaction=search&metadata_directive=blind_gui&formgroup=basenp_form_group";
		}
		else
		{
			theaction = "/search/default.asp?dbname=gelest&dataaction=search&metadata_directive=blind_gui&formgroup=msds_form_group&homepage=true"
		}



		if (thesearchfield == 'pc')
			{
				addaction = "&MAIN.Catnum="
			}
		else if (thesearchfield == 'cas')
			{
				addaction = "&MAIN.CAS="
			}
		else if (thesearchfield == 'chemname')
			{
				addaction = "&MAIN.Name="
			}

		theaction = theaction + addaction + addaster + theval + addaster;
		document.forms["searchform"].action = theaction;
		document.forms["searchform"].submit();
	//}

}