function changeMedia(inquiryForm, quote, option)
{
	var disableBooks = false;
	var disableCDs = false;
	var disableUSBs = false;
	
	if (option == 1 || option == 6 || option == 8 || option == 9)
	{
		disableBooks = true;
	}
	if (option == 0 || option == 6 || option == 7 || option == 9)
	{
		disableCDs = true;
	}
	if (option != 6 && option != 9)
	{
		disableUSBs = true;
	}
	if (option == 10)
	{
		disableBooks = true;
		disableCDs = true;
		disableUSBs = true;
	

		var totalPagesText = eval("inquiryForm.Q_" + quote + "_Pages_Total");
		totalPagesText.value = '';
		totalPagesText.disabled = true;
		
		var papersSubmittedText = eval("inquiryForm.Q_" + quote + "_Papers_Submitted");
		papersSubmittedText.value = '';
		papersSubmittedText.disabled = true;
		
		var papersAcceptedText = eval("inquiryForm.Q_" + quote + "_Papers_Accepted");
		papersAcceptedText.value = '';
		papersAcceptedText.disabled = true;
	}
	else
	{
		var totalPagesText = eval("inquiryForm.Q_" + quote + "_Pages_Total");
		totalPagesText.disabled = false;
		if (totalPagesText.value == '')
			totalPagesText.value = '0';

		var papersSubmittedText = eval("inquiryForm.Q_" + quote + "_Papers_Submitted");
		papersSubmittedText.disabled = false;
		if (papersSubmittedText.value == '')
			papersSubmittedText.value = '0';

		var papersAcceptedText = eval("inquiryForm.Q_" + quote + "_Papers_Accepted");
		papersAcceptedText.disabled = false;
		if (papersAcceptedText.value == '')
			papersAcceptedText.value = '0';
	}
	
	if (option == 7)
	{
		var bookQuantityText = eval("inquiryForm.Q_" + quote + "_Book_Copies");
		bookQuantityText.value = '1';
		bookQuantityText.disabled = false;
	}
	else
	{
		var bookQuantityText = eval("inquiryForm.Q_" + quote + "_Book_Copies");
		bookQuantityText.disabled = disableBooks;
		if (disableBooks)
			bookQuantityText.value = '';
		else if (bookQuantityText.value == '')
			bookQuantityText.value = '0';
	}
	
	var bookVolumesText = eval("inquiryForm.Q_" + quote + "_Volumes");
	bookVolumesText.disabled = disableBooks;
	if (disableBooks)
		bookVolumesText.value = '';
	else if (bookVolumesText.value == '')
		bookVolumesText.value = '1';
	
	var bookColorPagesText = eval("inquiryForm.Q_" + quote + "_Pages_Color");
	bookColorPagesText.disabled = disableBooks;
	if (disableBooks)
		bookColorPagesText.value = '';
	else if (bookColorPagesText.value == '')
		bookColorPagesText.value = '0';
		
	var bookTrimRadio = eval("inquiryForm.Q_" + quote + "_Book_Trim_Size");
	var checked = false;
	
	if(shouldDisable6x9(option))
	{
		disable6x9(bookTrimRadio);
	}
	else
	{
		for (var i = 0; i < bookTrimRadio.length; i++)
		{
			bookTrimRadio[i].disabled = disableBooks;
			if (!disableBooks && bookTrimRadio[i].checked)
				checked = true;
			else
				bookTrimRadio[i].checked = false;
		}
	}
	if (!disableBooks && !checked)
		bookTrimRadio[0].checked = true;
	
	if(shouldDisableOneColumn(option))
	{
		disableOneColumn(bookTrimRadio);
	}
	

	var bookCoverRadio = eval("inquiryForm.Q_" + quote + "_Book_Cover_Type");
	checked = false;
	for (var i = 0; i < bookCoverRadio.length; i++)
	{
		bookCoverRadio[i].disabled = disableBooks;
		if (!disableBooks && bookCoverRadio[i].checked)
			checked = true;
		else
			bookCoverRadio[i].checked = false;
	}
	if (!disableBooks && !checked)
		bookCoverRadio[0].checked = true;

	var bookColorsRadio = eval("inquiryForm.Q_" + quote + "_Book_Max_Cover_Colors");
	checked = false;
	for (var i = 0; i < bookColorsRadio.length; i++)
	{
		bookColorsRadio[i].disabled = disableBooks;
		if (!disableBooks && bookColorsRadio[i].checked)
			checked = true;
		else
			bookColorsRadio[i].checked = false;
	}
	if (!disableBooks && !checked)
		bookColorsRadio[0].checked = true;

	if (option == 8)
	{
		var cdQuantityText = eval("inquiryForm.Q_" + quote + "_CD_Copies");
		cdQuantityText.value = '1';
		cdQuantityText.disabled = false;
	}
	else
	{
		var cdQuantityText = eval("inquiryForm.Q_" + quote + "_CD_Copies");
		cdQuantityText.disabled = disableCDs;
		if (disableCDs)
			cdQuantityText.value = '';
		else if (cdQuantityText.value == '')
			cdQuantityText.value = '0';

	}
	
	var cdMultimediaText = eval("inquiryForm.Q_" + quote + "_Multimedia_Files");
	cdMultimediaText.disabled = disableCDs;
	if (disableCDs)
		cdMultimediaText.value = '';
	else if (cdMultimediaText.value == '')
		cdMultimediaText.value = '0';
	
	var cdExtraText = eval("inquiryForm.Q_" + quote + "_Extra_Files");
	cdExtraText.disabled = disableCDs;
	if (disableCDs)
		cdExtraText.value = '';
	else if (cdExtraText.value == '')
		cdExtraText.value = '0';

	var cdPackageRadio = eval("inquiryForm.Q_" + quote + "_CD_Package_Type");
	checked = false;
	for (var i = 0; i < cdPackageRadio.length; i++)
	{
		cdPackageRadio[i].disabled = disableCDs;
		if (!disableCDs && cdPackageRadio[i].checked)
			checked = true;
		else
			cdPackageRadio[i].checked = false;
	}
	if (!disableCDs && !checked)
		cdPackageRadio[0].checked = true;

	var labelColorsRadio = eval("inquiryForm.Q_" + quote + "_CD_Max_Label_Colors");
	checked = false;
	for (var i = 0; i < labelColorsRadio.length; i++)
	{
		labelColorsRadio[i].disabled = disableCDs;
		if (!disableCDs && labelColorsRadio[i].checked)
			checked = true;
		else
			labelColorsRadio[i].checked = false;
	}
	if (!disableCDs && !checked)
		labelColorsRadio[0].checked = true;

	if (option == 9)
	{
		var usbQuantityText = eval("inquiryForm.Q_" + quote + "_USB_Copies");
		usbQuantityText.value = '1';
		usbQuantityText.disabled = false;
	}
	else
	{
		var usbQuantityText = eval("inquiryForm.Q_" + quote + "_USB_Copies");
		usbQuantityText.disabled = disableUSBs;
		if (disableUSBs)
			usbQuantityText.value = '';
		else if (usbQuantityText.value == '')
			usbQuantityText.value = '0';
	}
}

function shouldDisableOneColumn(option)
{
	if(option == 0 || option == 2 || option == 3 || option == 4 || option == 5 || option == 7)
	{
		return true;
	}
	else
	{
		return false;
	}	
}

function disableOneColumn(bookTrimRadio)
{
	for (var i = 0; i < bookTrimRadio.length; i++)
	{
		if(bookTrimRadio[i].value == "8.5 x 11 x 1" || bookTrimRadio[i].value == "A4 x 1")
		{
			if(bookTrimRadio[i].checked)
			{
				bookTrimRadio[i].checked = false;
				bookTrimRadio[0].checked = true;
			}
			bookTrimRadio[i].disabled = true;
		}
	}
}

function shouldDisable6x9(option)
{
	if(option == 1 || option == 6 || option == 8)
	{
		return true;
	}
	else
	{
		return false;
	}	
}

function disable6x9(bookTrimRadio)
{
	var checked = true;
	for (var i = 0; i < bookTrimRadio.length; i++)
	{
		//bookTrimRadio[0].checked = true;
		if(bookTrimRadio[i].value == "6 x 9")
		{
			if(bookTrimRadio[i].checked)
			{
				bookTrimRadio[i].checked = false;
				bookTrimRadio[0].checked = true;
			}
			else
			{
				checked = false;
			}
			bookTrimRadio[i].disabled = true;
		}
		else
		{
			bookTrimRadio[i].disabled = false;
			if(!bookTrimRadio[i].checked && !checked)
			{
				checked = false;
			}
		}
	}
	if(!checked)
	{
		bookTrimRadio[0].checked = true;
	}
}

function enablePercent(inquiryForm, num)
{
    if (num == 1) {
	    inquiryForm.I_Sponsor_Percent_1.disabled = false;
	}
	else if (num == 2){
	    inquiryForm.I_Sponsor_Percent_2.disabled = false;
	}
	else if (num == 3){
	    inquiryForm.I_Sponsor_Percent_3.disabled = false;
	}
	else if (num == 4){
	    inquiryForm.I_Sponsor_Percent_4.disabled = false;
	}
	else if (num == 5){
	    inquiryForm.I_Sponsor_Percent_5.disabled = false;
	}
	else if (num == 6){
	    inquiryForm.I_Sponsor_Percent_6.disabled = false;
	}
	else if (num == 7){
	    inquiryForm.I_Sponsor_Percent_7.disabled = false;
	}
}

function disablePercent(inquiryForm, num)
{
	if (num == 1) {
	    inquiryForm.I_Sponsor_Percent_1.value = "";
	    inquiryForm.I_Sponsor_Percent_1.disabled = true;
	}
	else if (num == 2){
	    inquiryForm.I_Sponsor_Percent_2.value = "";
	    inquiryForm.I_Sponsor_Percent_2.disabled = true;
	}
	else if (num == 3){
	    inquiryForm.I_Sponsor_Percent_3.value = "";
	    inquiryForm.I_Sponsor_Percent_3.disabled = true;
	}
	else if (num == 4){
	    inquiryForm.I_Sponsor_Percent_4.value = "";
	    inquiryForm.I_Sponsor_Percent_4.disabled = true;
	}
	else if (num == 5){
	    inquiryForm.I_Sponsor_Percent_5.value = "";
	    inquiryForm.I_Sponsor_Percent_5.disabled = true;
	}
	else if (num == 6){
	    inquiryForm.I_Sponsor_Percent_6.value = "";
	    inquiryForm.I_Sponsor_Percent_6.disabled = true;
	}
	else if (num == 7){
	    inquiryForm.I_Sponsor_Percent_7.value = "";
	    inquiryForm.I_Sponsor_Percent_7.disabled = true;
	}
}

function calcPercent(inquiryForm)
{   
    var val = 0;
    var errorCond = 0;
    if (!(isNaN(inquiryForm.I_Sponsor_Percent_1.value)) && inquiryForm.I_Sponsor_Percent_1.value >= 0) {
        val = val + Number (inquiryForm.I_Sponsor_Percent_1.value);
	}
	else {  
	    errorCond = 1;
	    inquiryForm.I_Sponsor_Percent_1.value = "";
	}
	if (!(isNaN(inquiryForm.I_Sponsor_Percent_2.value)) && inquiryForm.I_Sponsor_Percent_2.value >= 0) {
        val = val + Number (inquiryForm.I_Sponsor_Percent_2.value);
	}
	else {  
	    errorCond = 1;
	    inquiryForm.I_Sponsor_Percent_2.value = "";
	}
	if (!(isNaN(inquiryForm.I_Sponsor_Percent_3.value)) && inquiryForm.I_Sponsor_Percent_3.value >= 0) {
        val = val + Number (inquiryForm.I_Sponsor_Percent_3.value);
	}
	else {  
	    errorCond = 1;
	    inquiryForm.I_Sponsor_Percent_3.value = "";
	}
	if (!(isNaN(inquiryForm.I_Sponsor_Percent_4.value)) && inquiryForm.I_Sponsor_Percent_4.value >= 0) {
        val = val + Number (inquiryForm.I_Sponsor_Percent_4.value);
	}
	else {  
	    errorCond = 1;
	    inquiryForm.I_Sponsor_Percent_4.value = "";
	}
	if (!(isNaN(inquiryForm.I_Sponsor_Percent_5.value)) && inquiryForm.I_Sponsor_Percent_5.value >= 0) {
        val = val + Number (inquiryForm.I_Sponsor_Percent_5.value);
	}
	else {  
	    errorCond = 1;
	    inquiryForm.I_Sponsor_Percent_5.value = "";
	}
	if (!(isNaN(inquiryForm.I_Sponsor_Percent_6.value)) && inquiryForm.I_Sponsor_Percent_6.value >= 0) {
        val = val + Number (inquiryForm.I_Sponsor_Percent_6.value);
	}
	else {  
	    errorCond = 1;
	    inquiryForm.I_Sponsor_Percent_6.value = "";
	}
	if (!(isNaN(inquiryForm.I_Sponsor_Percent_7.value)) && inquiryForm.I_Sponsor_Percent_7.value >= 0) {
        val = val + Number (inquiryForm.I_Sponsor_Percent_7.value);
	}
	else {  
	    errorCond = 1;
	    inquiryForm.I_Sponsor_Percent_7.value = "";
	}
	
	if (errorCond > 0) {
	    alert ("Sponsorship percentage should be a positive number");
	}

    inquiryForm.I_Sponsor_Percent_Total.value = val;
}

function enableSaved(inquiryForm)
{
	inquiryForm.savedName.disabled = false;
	inquiryForm.savedYear.disabled = false;
	inquiryForm.savedEmail.disabled = false;
	inquiryForm.savedTitle.disabled = false;
}

function disableForm(inquiryForm)
{
	inquiryForm.savedName.disabled = true;
	inquiryForm.savedYear.disabled = true;
	inquiryForm.savedEmail.disabled = true;
	inquiryForm.savedTitle.disabled = true;
}

function updateSavedTitle(inquiryForm)
{
	var name = inquiryForm.savedName.value;
	var year = inquiryForm.savedYear.value;
	var title = name + " " + year;
	inquiryForm.savedTitle.value = title;
}

function checkInvalidCharsInAcronym(inquiryForm)
{
	//var invalidChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?"; // All special chars
	var invalidChars = "!@#$%^&*()+=[]\\\';,./{}|\":<>?";

	for (var i = 0; i < inquiryForm.I_Acronym_Name.value.length; i++) {
		if (invalidChars.indexOf(inquiryForm.I_Acronym_Name.value.charAt(i)) != -1) {
			alert ("Please do not include any special characters \n with the Acronym other than a hyphen.");
			inquiryForm.I_Acronym_Name.focus();
			return false;
		}
	}
	updateTitle(inquiryForm);
}

function checkInvalidCharsInSavedAcronym(inquiryForm)
{
	//var invalidChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?"; // All special chars
	var invalidChars = "!@#$%^&*()+=[]\\\';,./{}|\":<>?";

	for (var i = 0; i < inquiryForm.savedName.value.length; i++) {
		if (invalidChars.indexOf(inquiryForm.savedName.value.charAt(i)) != -1) {
			alert ("Please do not include any special characters \n with the Acronym other than a hyphen.");
			inquiryForm.savedName.focus();
			return false;
		}
	}
	updateSavedTitle(inquiryForm);
}

function updateTitle(inquiryForm)
{
	var name = inquiryForm.I_Acronym_Name.value;
	var year = inquiryForm.I_Year.value;
	var title = name + " " + year;
	inquiryForm.title.value = title;
}

function populateFinance(inquiryForm, contactType)
{
	var financeCheckbox = eval("inquiryForm.C_" + contactType + "_Finance_Chair");
	if (financeCheckbox.checked == true)
	{
		var name = eval("inquiryForm.C_" + contactType + "_Full_Name");
		inquiryForm.C_F_Full_Name.value = name.value;

		var aff = eval("inquiryForm.C_" + contactType + "_Affiliation");
		inquiryForm.C_F_Affiliation.value = aff.value;

		var addr1 = eval("inquiryForm.C_" + contactType + "_Address1");
		inquiryForm.C_F_Address1.value = addr1.value;

		var addr2 = eval("inquiryForm.C_" + contactType + "_Address2");
		inquiryForm.C_F_Address2.value = addr2.value;

		var city = eval("inquiryForm.C_" + contactType + "_City");
		inquiryForm.C_F_City.value = city.value;

		var state = eval("inquiryForm.C_" + contactType + "_State");
		inquiryForm.C_F_State.value = state.value;

		var country = eval("inquiryForm.C_" + contactType + "_Country");
		inquiryForm.C_F_Country.value = country.value;

		var code = eval("inquiryForm.C_" + contactType + "_Postal_Code");
		inquiryForm.C_F_Postal_Code.value = code.value;

		var email = eval("inquiryForm.C_" + contactType + "_Email");
		inquiryForm.C_F_Email.value = email.value;

		var phone = eval("inquiryForm.C_" + contactType + "_Telephone");
		inquiryForm.C_F_Telephone.value = phone.value;

		var fax = eval("inquiryForm.C_" + contactType + "_Fax");
		inquiryForm.C_F_Fax.value = fax.value;

		var signatory = eval("inquiryForm.C_" + contactType + "_Signatory");
		inquiryForm.C_F_Signatory.checked = signatory.checked;
	}
	else
	{
		inquiryForm.C_F_Full_Name.value = '';
		inquiryForm.C_F_Affiliation.value = '';
		inquiryForm.C_F_Address1.value = '';
		inquiryForm.C_F_Address2.value = '';
		inquiryForm.C_F_City.value = '';
		inquiryForm.C_F_State.value = '';
		inquiryForm.C_F_Country.value = '';
		inquiryForm.C_F_Postal_Code.value = '';
		inquiryForm.C_F_Email.value = '';
		inquiryForm.C_F_Telephone.value = '';
		inquiryForm.C_F_Fax.value = '';
		inquiryForm.C_F_Signatory.checked = false;
	}
	
	if (contactType == 'I')
	{
		if (inquiryForm.C_P_Same.checked == true)
			inquiryForm.C_P_Finance_Chair.checked = financeCheckbox.checked;
		if (inquiryForm.C_O_Same.checked == true)
			inquiryForm.C_O_Finance_Chair.checked = financeCheckbox.checked;
	}
	else if (contactType == 'P')
	{
		if (inquiryForm.C_P_Same.checked == true)
			inquiryForm.C_I_Finance_Chair.checked = financeCheckbox.checked;
	}
	else if (contactType == 'O')
	{
		if (inquiryForm.C_O_Same.checked == true)
			inquiryForm.C_I_Finance_Chair.checked = financeCheckbox.checked;
	}
}

function sameAsInquirer(inquiryForm, contactType)
{
	var name = eval("inquiryForm.C_" + contactType + "_Full_Name");
	var aff = eval("inquiryForm.C_" + contactType + "_Affiliation");
	var addr1 = eval("inquiryForm.C_" + contactType + "_Address1");
	var addr2 = eval("inquiryForm.C_" + contactType + "_Address2");
	var city = eval("inquiryForm.C_" + contactType + "_City");
	var state = eval("inquiryForm.C_" + contactType + "_State");
	var country = eval("inquiryForm.C_" + contactType + "_Country");
	var code = eval("inquiryForm.C_" + contactType + "_Postal_Code");
	var email = eval("inquiryForm.C_" + contactType + "_Email");
	var phone = eval("inquiryForm.C_" + contactType + "_Telephone");
	var fax = eval("inquiryForm.C_" + contactType + "_Fax");
	var general = eval("inquiryForm.C_" + contactType + "_General_Chair");
	var pubs = eval("inquiryForm.C_" + contactType + "_Pubs_Chair");
	var finance = eval("inquiryForm.C_" + contactType + "_Finance_Chair");
	var program = eval("inquiryForm.C_" + contactType + "_Program_Chair");
	var otherCheck = eval("inquiryForm.C_" + contactType + "_Other_Check");
	var other = eval("inquiryForm.C_" + contactType + "_Other");
	var signatory = eval("inquiryForm.C_" + contactType + "_Signatory");
	
	var sameCheckbox = eval("inquiryForm.C_" + contactType + "_Same");
	if (sameCheckbox.checked == true)
	{
		name.value = inquiryForm.C_I_Full_Name.value;
		aff.value = inquiryForm.C_I_Affiliation.value;
		addr1.value = inquiryForm.C_I_Address1.value;
		addr2.value = inquiryForm.C_I_Address2.value;
		city.value = inquiryForm.C_I_City.value;
		state.value = inquiryForm.C_I_State.value;
		country.value = inquiryForm.C_I_Country.value;
		code.value = inquiryForm.C_I_Postal_Code.value;
		email.value = inquiryForm.C_I_Email.value;
		phone.value = inquiryForm.C_I_Telephone.value;
		fax.value = inquiryForm.C_I_Fax.value;
		general.checked = inquiryForm.C_I_General_Chair.checked;
		pubs.checked = inquiryForm.C_I_Pubs_Chair.checked;
		finance.checked = inquiryForm.C_I_Finance_Chair.checked;
		program.checked = inquiryForm.C_I_Program_Chair.checked;
		otherCheck.checked = inquiryForm.C_I_Other_Check.checked;
		other.value = inquiryForm.C_I_Other.value;
		signatory.checked = inquiryForm.C_I_Signatory.checked;
	}
	else
	{
		name.value = '';
		aff.value = '';
		addr1.value = '';
		addr2.value = '';
		city.value = '';
		state.value = '';
		country.value = '';
		code.value = '';
		email.value = '';
		phone.value = '';
		fax.value = '';
		general.checked = false;
		pubs.checked = false;
		finance.checked = false;
		program.checked = false;
		otherCheck.checked = false;
		other.value = '';
		signatory.checked = false;
	}
}

function updateContact(inquiryForm, contactType, fieldName)
{
	if (contactType == 'I')
	{
		if (inquiryForm.C_P_Same.checked == true)
		{	
			var control = eval("inquiryForm.C_I_" + fieldName);
			var newControl = eval("inquiryForm.C_P_" + fieldName);
			if (control.type == "checkbox")
				newControl.checked = control.checked;
			else
				newControl.value = control.value;
		}
		if (inquiryForm.C_O_Same.checked == true)
		{	
			var control = eval("inquiryForm.C_I_" + fieldName);
			var newControl = eval("inquiryForm.C_O_" + fieldName);
			if (control.type == "checkbox")
				newControl.checked = control.checked;
			else
				newControl.value = control.value;
		}
		if (inquiryForm.C_I_Finance_Chair.checked == true)
		{	
			var control = eval("inquiryForm.C_I_" + fieldName);
			var newControl = eval("inquiryForm.C_F_" + fieldName);
			if (newControl != null)
			{
				if (control.type == "checkbox")
					newControl.checked = control.checked;
				else
					newControl.value = control.value;
			}
		}
	}
	else if (contactType == 'P')
	{
		if (inquiryForm.C_P_Same.checked == true)
		{	
			var control = eval("inquiryForm.C_P_" + fieldName);
			var newControl = eval("inquiryForm.C_I_" + fieldName);
			if (control.type == "checkbox")
				newControl.checked = control.checked;
			else
				newControl.value = control.value;
			if (inquiryForm.C_O_Same.checked == true)
			{
				var newControl = eval("inquiryForm.C_O_" + fieldName);
				if (control.type == "checkbox")
					newControl.checked = control.checked;
				else
					newControl.value = control.value;
			}
		}
		if (inquiryForm.C_P_Finance_Chair.checked == true)
		{	
			var control = eval("inquiryForm.C_P_" + fieldName);
			var newControl = eval("inquiryForm.C_F_" + fieldName);
			if (newControl != null)
			{
				if (control.type == "checkbox")
					newControl.checked = control.checked;
				else
					newControl.value = control.value;
			}
		}
	}
	else if (contactType == 'O')
	{
		if (inquiryForm.C_O_Same.checked == true)
		{	
			var control = eval("inquiryForm.C_O_" + fieldName);
			var newControl = eval("inquiryForm.C_I_" + fieldName);
			if (control.type == "checkbox")
				newControl.checked = control.checked;
			else
				newControl.value = control.value;
			if (inquiryForm.C_P_Same.checked == true)
			{
				var newControl = eval("inquiryForm.C_P_" + fieldName);
				if (control.type == "checkbox")
					newControl.checked = control.checked;
				else
					newControl.value = control.value;
			}
		}
		if (inquiryForm.C_O_Finance_Chair.checked == true)
		{	
			var control = eval("inquiryForm.C_O_" + fieldName);
			var newControl = eval("inquiryForm.C_F_" + fieldName);
			if (newControl != null)
			{
				if (control.type == "checkbox")
					newControl.checked = control.checked;
				else
					newControl.value = control.value;
			}
		}
	}
	else if (contactType == 'F')
	{
		if (inquiryForm.C_I_Finance_Chair.checked == true)
		{	
			var control = eval("inquiryForm.C_F_" + fieldName);
			var newControl = eval("inquiryForm.C_I_" + fieldName);
			if (control.type == "checkbox")
				newControl.checked = control.checked;
			else
				newControl.value = control.value;
		}
		if (inquiryForm.C_P_Finance_Chair.checked == true)
		{	
			var control = eval("inquiryForm.C_F_" + fieldName);
			var newControl = eval("inquiryForm.C_P_" + fieldName);
			if (control.type == "checkbox")
				newControl.checked = control.checked;
			else
				newControl.value = control.value;
		}
		if (inquiryForm.C_O_Finance_Chair.checked == true)
		{	
			var control = eval("inquiryForm.C_F_" + fieldName);
			var newControl = eval("inquiryForm.C_O_" + fieldName);
			if (control.type == "checkbox")
				newControl.checked = control.checked;
			else
				newControl.value = control.value;
		}
	}
}

function inquirerCheckSignatory(inquiryForm)
{
	var check = inquiryForm.C_I_Signatory.checked;
	
	if(inquiryForm.C_P_Same.checked)
		inquiryForm.C_P_Signatory.checked = check;
	else
		inquiryForm.C_P_Signatory.checked = false;

	if(inquiryForm.C_O_Same.checked)
		inquiryForm.C_O_Signatory.checked = check;
	else
		inquiryForm.C_O_Signatory.checked = false;

	if(inquiryForm.C_I_Finance_Chair.checked)
		inquiryForm.C_F_Signatory.checked = check;
	else
		inquiryForm.C_F_Signatory.checked = false;
}

function primaryCheckSignatory(inquiryForm)
{
	var check = inquiryForm.C_P_Signatory.checked;
	
	if(inquiryForm.C_P_Same.checked)
	{
		inquiryForm.C_I_Signatory.checked = check;
		if(inquiryForm.C_O_Same.checked)
			inquiryForm.C_O_Signatory.checked = check;
		else
			inquiryForm.C_O_Signatory.checked = false;
	}
	else
	{
		inquiryForm.C_I_Signatory.checked = false;
		inquiryForm.C_O_Signatory.checked = false;
	}

	if(inquiryForm.C_P_Finance_Chair.checked)
		inquiryForm.C_F_Signatory.checked = check;
	else
		inquiryForm.C_F_Signatory.checked = false;
}

function optionalCheckSignatory(inquiryForm)
{
	var check = inquiryForm.C_O_Signatory.checked;
	
	if(inquiryForm.C_O_Same.checked)
	{
		inquiryForm.C_I_Signatory.checked = check;
		if(inquiryForm.C_P_Same.checked)
			inquiryForm.C_P_Signatory.checked = check;
		else
			inquiryForm.C_P_Signatory.checked = false;
	}
	else
	{
		inquiryForm.C_I_Signatory.checked = false;
		inquiryForm.C_P_Signatory.checked = false;
	}

	if(inquiryForm.C_O_Finance_Chair.checked)
		inquiryForm.C_F_Signatory.checked = check;
	else
		inquiryForm.C_F_Signatory.checked = false;
}

function financeCheckSignatory(inquiryForm)
{
	var check = inquiryForm.C_F_Signatory.checked;
	
	if(inquiryForm.C_I_Finance_Chair.checked)
		inquiryForm.C_I_Signatory.checked = check;
	else
		inquiryForm.C_I_Signatory.checked = false;
		
	if(inquiryForm.C_P_Finance_Chair.checked)
		inquiryForm.C_P_Signatory.checked = check;
	else
		inquiryForm.C_P_Signatory.checked = false;

	if(inquiryForm.C_O_Finance_Chair.checked)
		inquiryForm.C_O_Signatory.checked = check;
	else
		inquiryForm.C_O_Signatory.checked = false;
}

function calcAcceptanceRate(inquiryForm, quote)
{
	var submitted = eval("inquiryForm.Q_" + quote + "_Papers_Submitted");
	var s = submitted.value;
	var accepted = eval("inquiryForm.Q_" + quote + "_Papers_Accepted");
	var a = accepted.value;
	var rate = eval("inquiryForm.Q_" + quote + "_Acceptance_Rate");
	var rNum = '';
	var rString = "";
	
	if (isNumber(s) && isNumber(a) && Number(s) != 0 && Number(a) != 0)
	{
		rNum = Number(a)/Number(s);
		rNum = rNum * 100;
		rString = String(rNum);
		var dec = rString.indexOf(".") + 3;
		if (rString.length > dec)
			rate.value = rString.substring(0, dec) + '%';
		else
			rate.value = rString + '%';
	}
	else
		rate.value = '0%';
}

function isNumber(sText)
{
	var ValidChars = "0123456789.";
	var IsNumber=true;
	var Char;
	
	for (i = 0; i < sText.length && IsNumber == true; i++) 
	{ 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) 
		{
			IsNumber = false;
		}
	}
	

	return IsNumber;
}

function checkGeneralInfo(inquiryForm)
{
	var isValid = true;
	var alertString = '';
	
	// set the dates
	var date;
	date = inquiryForm.Conference_Start_Date_Month.value + "/" + inquiryForm.Conference_Start_Date_Day.value + "/" + inquiryForm.Conference_Start_Date_Year.value;
	inquiryForm.I_Conference_Start_Date.value = date
	date = inquiryForm.Conference_End_Date_Month.value + "/" + inquiryForm.Conference_End_Date_Day.value + "/" + inquiryForm.Conference_End_Date_Year.value;
	inquiryForm.I_Conference_End_Date.value = date
	date = inquiryForm.Delivery_Date_Month.value + "/" + inquiryForm.Delivery_Date_Day.value + "/" + inquiryForm.Delivery_Date_Year.value;
	inquiryForm.I_Delivery_Date.value = date
	date = inquiryForm.Call_For_Papers_Date_Month.value + "/" + inquiryForm.Call_For_Papers_Date_Day.value + "/" + inquiryForm.Call_For_Papers_Date_Year.value;
	inquiryForm.I_Call_For_Papers_Date.value = date
	date = inquiryForm.Paper_Submission_Date_Month.value + "/" + inquiryForm.Paper_Submission_Date_Day.value + "/" + inquiryForm.Paper_Submission_Date_Year.value;
	inquiryForm.I_Paper_Submission_Date.value = date
	date = inquiryForm.Acceptance_Notification_Date_Month.value + "/" + inquiryForm.Acceptance_Notification_Date_Day.value + "/" + inquiryForm.Acceptance_Notification_Date_Year.value;
	inquiryForm.I_Acceptance_Notification_Date.value = date
	date = inquiryForm.Final_Papers_Due_Date_Month.value + "/" + inquiryForm.Final_Papers_Due_Date_Day.value + "/" + inquiryForm.Final_Papers_Due_Date_Year.value;
	inquiryForm.I_Final_Papers_Due_Date.value = date
	
	if (inquiryForm.validate.value == "none")
		return true;
	

	if (alertString.length == 0 && inquiryForm.C_I_Email.value.length == 0)
		alertString = 'Please provide an email address for the inquirer.';	
	if (alertString.length == 0 && inquiryForm.I_Acronym_Name.value.length == 0)
		alertString = 'Please provide a conference acronym.';
	if (alertString.length == 0 && (inquiryForm.I_Year.value.length == 0 || inquiryForm.I_Year.value.length != 4))
		alertString = 'Please provide a valid year for the conference (YYYY).';
	if (alertString.length == 0 && !isNumber(inquiryForm.I_Year.value))
		alertString = 'Please provide a four digit year for the conference year (YYYY).';
	
	if (alertString.length == 0 && inquiryForm.validate.value == "false")
		return true;
	
	if (alertString.length == 0 && inquiryForm.C_I_Full_Name.value.length == 0)
		alertString = 'Please provide a name for the inquirer.';
	if (alertString.length == 0 && inquiryForm.I_Conference_Name.value.length == 0)
		alertString = 'Please provide a full conference title.';
	if (alertString.length == 0 && inquiryForm.Conference_Start_Date_Day.value.length == 0)
		alertString = 'Please select a day for the conference start date.';
	if (alertString.length == 0 && inquiryForm.Conference_Start_Date_Month.value.length == 0)
		alertString = 'Please select a month for the conference start date.';
	if (alertString.length == 0 && (inquiryForm.Conference_Start_Date_Year.value.length == 0 || inquiryForm.Conference_Start_Date_Year.value.length != 4))
		alertString = 'Please provide a valid year for the conference start date (YYYY).';
	if (alertString.length == 0 && !isNumber(inquiryForm.Conference_Start_Date_Year.value))
		alertString = 'Please provide a four digit year for the conference start date (YYYY).';
	if (alertString.length == 0 && (inquiryForm.Conference_End_Date_Year.value.length == 0 || inquiryForm.Conference_End_Date_Year.value.length != 4))
		alertString = 'Please provide a valid year for the conference end date (YYYY).';
	if (alertString.length == 0 && !isNumber(inquiryForm.Conference_End_Date_Year.value))
		alertString = 'Please provide a four digit year for the conference end date (YYYY).';
	if (alertString.length == 0 && inquiryForm.I_Conference_City.value.length == 0)
		alertString = 'Please provide a city for the conference.';
	if (alertString.length == 0 && inquiryForm.I_Conference_Country.value.length == 0)
		alertString = 'Please provide a country for the conference.';
	if (alertString.length == 0 && inquiryForm.C_P_Full_Name.value.length == 0)
		alertString = 'Please provide a name for the primary contact.';
	if (alertString.length == 0 && inquiryForm.C_P_Email.value.length == 0)
		alertString = 'Please provide an email address for the primary contact.';	
	if (alertString.length == 0)
	{
		if (inquiryForm.C_I_Signatory.checked)
		{
			if (inquiryForm.C_I_Affiliation.value.length == 0)
				alertString = 'Please provide the inquirer\'s affiliation.';
			if (alertString.length == 0 && inquiryForm.C_I_Address1.value.length == 0)
				alertString = 'Please provide an address for the inquirer.';
			if (alertString.length == 0 && inquiryForm.C_I_City.value.length == 0)
				alertString = 'Please provide a city for the inquirer.';
			if (alertString.length == 0 && inquiryForm.C_I_Country.value.length == 0)
				alertString = 'Please provide a country for the inquirer.';
			if (alertString.length == 0 && inquiryForm.C_I_Postal_Code.value.length == 0)
				alertString = 'Please provide a postal code for the inquirer.';
			if (alertString.length == 0 && inquiryForm.C_I_Telephone.value.length == 0)
				alertString = 'Please provide a telephone number for the inquirer.';
		}
		else if (alertString.length == 0 && inquiryForm.C_P_Signatory.checked)
		{
			if (inquiryForm.C_P_Affiliation.value.length == 0)
				alertString = 'Please provide the primary contact\'s affiliation.';
			if (alertString.length == 0 && inquiryForm.C_P_Address1.value.length == 0)
				alertString = 'Please provide an address for the primary contact.';
			if (alertString.length == 0 && inquiryForm.C_P_City.value.length == 0)
				alertString = 'Please provide a city for the primary contact.';
			if (alertString.length == 0 && inquiryForm.C_P_Country.value.length == 0)
				alertString = 'Please provide a country for the primary contact.';
			if (alertString.length == 0 && inquiryForm.C_P_Postal_Code.value.length == 0)
				alertString = 'Please provide a postal code for the primary contact.';
			if (alertString.length == 0 && inquiryForm.C_P_Telephone.value.length == 0)
				alertString = 'Please provide a telephone number for the primary contact.';		
		}
		else if (alertString.length == 0 && inquiryForm.C_O_Signatory.checked)
		{
			if (inquiryForm.C_O_Full_Name.value.length == 0)
				alertString = 'Please provide a full name for the optional contact.';
			if (alertString.length == 0 && inquiryForm.C_O_Affiliation.value.length == 0)
				alertString = 'Please provide the optional contact\'s affiliation.';
			if (alertString.length == 0 && inquiryForm.C_O_Address1.value.length == 0)
				alertString = 'Please provide an address for the optional contact.';
			if (alertString.length == 0 && inquiryForm.C_O_City.value.length == 0)
				alertString = 'Please provide a city for the optional contact.';
			if (alertString.length == 0 && inquiryForm.C_O_Country.value.length == 0)
				alertString = 'Please provide a country for the optional contact.';
			if (alertString.length == 0 && inquiryForm.C_O_Postal_Code.value.length == 0)
				alertString = 'Please provide a postal code for the optional contact.';
			if (alertString.length == 0 && inquiryForm.C_O_Telephone.value.length == 0)
				alertString = 'Please provide a telephone number for the optional contact.';
			if (alertString.length == 0 && inquiryForm.C_O_Email.value.length == 0)
				alertString = 'Please provide an email address for the optional contact.';
		}
		else if (alertString.length == 0 && inquiryForm.C_F_Signatory.checked)
		{
			if (inquiryForm.C_F_Affiliation.value.length == 0)
				alertString = 'Please provide the finance chair\'s affiliation.';
			if (alertString.length == 0 && inquiryForm.C_F_Address1.value.length == 0)
				alertString = 'Please provide an address for the finance chair.';
			if (alertString.length == 0 && inquiryForm.C_F_City.value.length == 0)
				alertString = 'Please provide a city for the finance chair.';
			if (alertString.length == 0 && inquiryForm.C_F_Country.value.length == 0)
				alertString = 'Please provide a country for the finance chair.';
			if (alertString.length == 0 && inquiryForm.C_F_Postal_Code.value.length == 0)
				alertString = 'Please provide a postal code for the finance chair.';
			if (alertString.length == 0 && inquiryForm.C_F_Telephone.value.length == 0)
				alertString = 'Please provide a telephone number for the finance chair.';		
		}
		else
			alertString = 'Please specify a publication agreement signatory.';
	}
	if (alertString.length == 0 && inquiryForm.Delivery_Date_Day.value.length == 0)
		alertString = 'Please select a day for the delivery date of the conference proceedings.';
	if (alertString.length == 0 && inquiryForm.Delivery_Date_Month.value.length == 0)
		alertString = 'Please select a month for the delivery date of the conference proceedings.';
	if (alertString.length == 0 && (inquiryForm.Delivery_Date_Year.value.length == 0 || inquiryForm.Delivery_Date_Year.value.length != 4))
		alertString = 'Please provide a valid year for the delivery date of the conference proceedings (YYYY).';
	if (alertString.length == 0 && !isNumber(inquiryForm.Delivery_Date_Year.value))
		alertString = 'Please provide a four digit year for the delivery date (YYYY).';
	if (alertString.length == 0)
	{
		var checked = false;
		for (var i = 0; i < inquiryForm.I_Delivery_Date_Type.length; i++)
		{
			if (inquiryForm.I_Delivery_Date_Type[i].checked)
			{
				checked = true;
				break;
			}
		}
		if (!checked)
			alertString = 'Please specify if the proceedings are to be delivered pre-conference or post-conference.';
	}
	
	if (alertString.length == 0 && (inquiryForm.Call_For_Papers_Date_Day.value.length != 0 || inquiryForm.Call_For_Papers_Date_Month.value.length != 0 || inquiryForm.Call_For_Papers_Date_Year.value.length != 0))
	{	
		if (alertString.length == 0 && inquiryForm.Call_For_Papers_Date_Day.value.length == 0)
			alertString = 'Please select a day for for the call for papers date.';
		if (alertString.length == 0 && inquiryForm.Call_For_Papers_Date_Month.value.length == 0)
			alertString = 'Please select a month for for the call for papers date.';
		if (alertString.length == 0 && (inquiryForm.Call_For_Papers_Date_Year.value.length == 0 || inquiryForm.Call_For_Papers_Date_Year.value.length != 4))
			alertString = 'Please provide a valid year for the call for papers date (YYYY).';
		if (alertString.length == 0 && !isNumber(inquiryForm.Call_For_Papers_Date_Year.value))
			alertString = 'Please provide a four digit year for the call for papers date (YYYY).';
	}
	if (alertString.length == 0 && (inquiryForm.Paper_Submission_Date_Day.value.length != 0 || inquiryForm.Paper_Submission_Date_Month.value.length != 0 || inquiryForm.Paper_Submission_Date_Year.value.length != 0))
	{	
		if (alertString.length == 0 && inquiryForm.Paper_Submission_Date_Day.value.length == 0)
			alertString = 'Please select a day for for the paper submission date.';
		if (alertString.length == 0 && inquiryForm.Paper_Submission_Date_Month.value.length == 0)
			alertString = 'Please select a month for for the paper submission date.';
		if (alertString.length == 0 && (inquiryForm.Paper_Submission_Date_Year.value.length == 0 || inquiryForm.Paper_Submission_Date_Year.value.length != 4))
			alertString = 'Please provide a valid year for the paper submission date (YYYY).';
		if (alertString.length == 0 && !isNumber(inquiryForm.Paper_Submission_Date_Year.value))
			alertString = 'Please provide a four digit year for the paper submission date (YYYY).';
	}
	if (alertString.length == 0 && (inquiryForm.Acceptance_Notification_Date_Day.value.length != 0 || inquiryForm.Acceptance_Notification_Date_Month.value.length != 0 || inquiryForm.Acceptance_Notification_Date_Year.value.length != 0))
	{	
		if (alertString.length == 0 && inquiryForm.Acceptance_Notification_Date_Day.value.length == 0)
			alertString = 'Please select a day for for the acceptance notification date.';
		if (alertString.length == 0 && inquiryForm.Acceptance_Notification_Date_Month.value.length == 0)
			alertString = 'Please select a month for for the acceptance notification date.';
		if (alertString.length == 0 && (inquiryForm.Acceptance_Notification_Date_Year.value.length == 0 || inquiryForm.Acceptance_Notification_Date_Year.value.length != 4))
			alertString = 'Please provide a valid year for the acceptance notification date (YYYY).';
		if (alertString.length == 0 && !isNumber(inquiryForm.Acceptance_Notification_Date_Year.value))
			alertString = 'Please provide a four digit year for the acceptance notification date (YYYY).';
	}
	if (alertString.length == 0 && (inquiryForm.Final_Papers_Due_Date_Day.value.length != 0 || inquiryForm.Final_Papers_Due_Date_Month.value.length != 0 || inquiryForm.Final_Papers_Due_Date_Year.value.length != 0))
	{	
		if (alertString.length == 0 && inquiryForm.Final_Papers_Due_Date_Day.value.length == 0)
			alertString = 'Please select a day for for the final papers due date.';
		if (alertString.length == 0 && inquiryForm.Final_Papers_Due_Date_Month.value.length == 0)
			alertString = 'Please select a month for for the final papers due date.';
		if (alertString.length == 0 && (inquiryForm.Final_Papers_Due_Date_Year.value.length == 0 || inquiryForm.Final_Papers_Due_Date_Year.value.length != 4))
			alertString = 'Please provide a valid year for the final papers due date (YYYY).';
		if (alertString.length == 0 && !isNumber(inquiryForm.Final_Papers_Due_Date_Year.value))
			alertString = 'Please provide a four digit year for the final papers due date (YYYY).';
	}
	
	if (alertString.length > 0)
	{
		isValid = false;
		alert(alertString);
	}

	
	return isValid;
}

function checkInquirySelection(inquiryForm)
{
	var checked = false;
	var choice = '';
	
	for (var i = 0; i < inquiryForm.quoteType.length; i++)
	{
		if (inquiryForm.quoteType[i].checked)
		{
			checked = true;
			choice = i;
			break;
		}
	}
	
	if (!checked)
		alert('Please select an option to proceed with your inquiry.');
	else
	{	
		if (choice == 1)
		{
			if (inquiryForm.savedName.value.length == 0)
			{
				checked = false;
				alert('Please provide the acronym used for the conference publication inquiry data.');
			}
			else if (inquiryForm.savedYear.value.length == 0)
			{
				checked = false;
				alert('Please provide the year for the conference publication inquiry data.');
			}
			else if (inquiryForm.savedEmail.value.length == 0)
			{
				checked = false;
				alert('Please provide the inquirer\'s email address used to create the conference publication inquiry.');
			}
		}
	}
	if (checked)
	{
		// check to see if we need to set the search flag
		if (choice == 1)
		{
			if (inquiryForm.origQuoteType.value != "saved")
				inquiryForm.findInquiry.value = true;
			else if (inquiryForm.origSavedYear.value != inquiryForm.savedYear.value)
				inquiryForm.findInquiry.value = true;
			else if (inquiryForm.origSavedName.value != inquiryForm.savedName.value)
				inquiryForm.findInquiry.value = true;
			else if (inquiryForm.origSavedEmail.value != inquiryForm.savedEmail.value)
				inquiryForm.findInquiry.value = true;
			else
				inquiryForm.findInquiry.value = false;
		}
		else
		{
			if (inquiryForm.origQuoteType.value != "new")
				inquiryForm.findInquiry.value = "empty";
			else
				inquiryForm.findInquiry.value = false;
		}
	}
	return checked;
}

function checkInquiryRequest(inquiryForm)
{
	if (inquiryForm.validate.value == "false")
		return true;
		
	var isValid = false;
	
	for (var i = 1; i < 7; i++)
	{
		isValid = false;
		var mediaTypeValue;
		var mediaType = eval("inquiryForm.Q_" + i + "_Quote_Type");
		for (var j = 0; j < mediaType.length; j++)
		{
			if (mediaType[j].checked)
			{
				isValid = true;
				mediaTypeValue = mediaType[j].value;
				break;
			}
		}
		
		if (!isValid)
		{
			alert('Please select a media type for each quote.  You are not required to request all six quotes.  To omit a quote variation, select \'No Quote\' as the media type.');
			break;
		}
		else
		{
			var bookCount = eval("inquiryForm.Q_" + i + "_Book_Copies");
			if (!bookCount.disabled && bookCount.value.length == 0)
			{
				isValid = false;
				alert('Please specify a book quantity for Quote ' + i);
				break;
			}
			if (!bookCount.disabled && !isNumber(bookCount.value))
			{
				isValid = false;
				alert('Please provide a numeric book quantity for Quote ' + i);
				break;
			}
			if (!bookCount.disabled && mediaTypeValue == "Editorial Only - Book" && bookCount.value != 1)
			{
				isValid = false;
				alert('Book quantity for the Editorial Book in Quote ' + i + ' must be equal to 1.');
				break;
			}
			var cdCount = eval("inquiryForm.Q_" + i + "_CD_Copies");
			if (!cdCount.disabled && cdCount.value.length == 0)
			{
				isValid = false;
				alert('Please specify a cd quantity for Quote ' + i);
				break;
			}
			if (!cdCount.disabled && !isNumber(cdCount.value))
			{
				isValid = false;
				alert('Please provide a numeric cd quantity for Quote ' + i);
				break;
			}
			if (!cdCount.disabled && mediaTypeValue == "Editorial Only - Electronic" && cdCount.value != 1)
			{
				isValid = false;
				alert('CD quantity for the Editorial CD in Quote ' + i + ' must be equal to 1.');
				break;
			}
			var usbCount = eval("inquiryForm.Q_" + i + "_USB_Copies");
			if (!usbCount.disabled && usbCount.value.length == 0)
			{
				isValid = false;
				alert('Please specify a usb quantity in Quote ' + i);
				break;
			}
			if (!usbCount.disabled && !isNumber(usbCount.value))
			{
				isValid = false;
				alert('Please provide a numeric usb quantity for Quote ' + i);
				break;
			}
			var volumes = eval("inquiryForm.Q_" + i + "_Volumes");
			if (!volumes.disabled && volumes.value.length == 0)
			{
				isValid = false;
				alert('Please specify a quantity for volumes in Quote ' + i);
				break;
			}
			if (!volumes.disabled && !isNumber(volumes.value))
			{
				isValid = false;
				alert('Please provide a numeric quantity for volumes in Quote ' + i);
				break;
			}
			if (!volumes.disabled && Number(volumes.value) > 5)
			{
				isValid = false;
				alert('Please enter a volume quantity that is less than or equal to 5 for Quote ' + i);
				break;
			}
			var totalPages = eval("inquiryForm.Q_" + i + "_Pages_Total");
			if (!totalPages.disabled && totalPages.value.length == 0)
			{
				isValid = false;
				alert('Please specify a quantity for total pages in Quote ' + i);
				break;
			}
			if (!totalPages.disabled && !isNumber(totalPages.value))
			{
				isValid = false;
				alert('Please provide a numeric quantity for total pages in Quote ' + i);
				break;
			}
			var accepted = eval("inquiryForm.Q_" + i + "_Papers_Accepted");
			if (!accepted.disabled && accepted.value.length == 0)
			{
				isValid = false;
				alert('Please specify a quantity for papers accepted in Quote ' + i);
				break;
			}
			if (!accepted.disabled && !isNumber(accepted.value))
			{
				isValid = false;
				alert('Please provide a numeric quantity for accepted papers in Quote ' + i);
				break;
			}
		}
	}
	return isValid;
}

function setStartAction(inquiryForm)
{
	var choice = '';
	
	for (var i = 0; i < inquiryForm.quoteType.length; i++)
	{
		if (inquiryForm.quoteType[i].checked)
		{
			choice = i;
			break;
		}
	}
	
	if (choice == 0 || choice == 1)
	{
		inquiryForm.action = 'generalInfo.asp';
	}
	
	return true;
}

function setAction(inquiryForm, location, validation)
{
	inquiryForm.action = location;
	
	inquiryForm.validate.value = validation;
	
	return true;
}

function setSearchFlag(inquiryForm, flagValue)
{
	inquiryForm.findInquiry.value = flagValue;
	return true;
}

function emailCheck(str) {
		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		
		var returnString = "";
		if (str.indexOf(at)==-1){
		   returnString = returnString + "Email address is not valid. Email does not have '@'.\n";
		}

		if (str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   returnString = returnString + "Email address is not valid. Email position of '@' no correct.\n";
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    returnString = returnString + "Email address is not valid. Email must have at least one '.' and must not be first or last character.\n";
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    returnString = returnString + "Email address is not valid. Email must only contain one '@'.\n";
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    returnString = returnString + "Email address is not valid. Email must contain at least one '.' after the '@'.\n";
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    returnString = returnString + "Email address is not valid.\n";
		 }
		
		 if (str.indexOf(" ")!=-1){
		    returnString = returnString + "Email address is not valid. Email must not contain whitespace.\n";
		 }

 		 return returnString;	
	}
	
// Returns a copy of the string, with leading and trailing whitespace omitted.
if (!String.prototype.trim) {
    String.prototype.trim = function()
	{
		var firstChar = -1, lastChar = -1;
		for (var i = 0; i < this.length; i++) {
			if (!String.isWhitespace(this.charAt(i))) {
				if (firstChar == -1) firstChar = i;
				lastChar = i;
			}
		}
		if (firstChar == -1) return "";
		else return this.substring(firstChar, lastChar + 1);
	}
}

// Determines if the specified character is white space according to Java.
if (!String.isWhitespace) {
    String.isWhitespace = function(ch)
	{
		if (ch == ' '  || // Space
			ch == '\t' || // Horizontal tab ('\u0009')
			ch == '\n' || // Newline / Line feed ('\u000A')
			ch == '\v' || // Vertical tab ('\u000B')
			ch == '\f' || // Form feed ('\u000C')
			ch == '\r' || // Carriage return ('\u000D')
			ch == '\u001C' || // File separator
			ch == '\u001D' || // Group separator
			ch == '\u001E' || // Record separator
			ch == '\u001F')   // Unit separator
			return true;
		else
			return false;
	}
}

// Determines if the specified character is white space according to Java.
if (!String.prototype.hasNumeric) {
    String.prototype.hasNumeric = function()
	{
		if (this.match("[0-9]+")) {
			return true;
		}
		return false;
	}
}