function doSubmit(choice) {
			document.myForm.action.value = choice;
			if (validations()) {
			document.myForm.submit();
			}
		}

function doReject() {
		document.myForm.action.value = 'Reject';
		document.myForm.submit();
	}

function doRejectSend() {
	document.myForm.action.value = 'Send';
	if(confirm("Ready to Send?\n\nPressing OK will send\nyour message to the originating persion\nand set the RFP posting status to \"Rejected\".")) {
		document.myForm.action.value = "Send";
		document.myForm.submit();
	}
	}	
	
function doPublish() {
	document.myForm.action.value = 'Publish';
	if(confirm("Ready to Publish?\n\nPressing OK will email\nthe originating company,\ninforming them that\ntheir RFP has published.\n\nAll Chamber members will receive\nan email alert regarding the RFP.")) {
		document.myForm.action.value = "Publish";
		document.myForm.submit();
	}
}
		
function confirmDelete() {
	if(confirm("Are you Sure you want to DELETE this RFP?")) {
		document.myForm.action.value = "Delete";
		document.myForm.submit();
	}
}

function validations()  {
	if(document.myForm["s_firstname"].value == '' || document.myForm["s_lastname"].value == '') {
		alert("Please provide the First and Last Name\nof the Contact Person");
		return false;
	}
	if(document.myForm["s_company"].value == '') {
		alert("Please provide a Company Name");
		return false;
	}
	if(document.myForm["s_address_1"].value == '') {
		alert("Please provide a Street or P.O. Address");
		return false;
	}
	if(document.myForm["s_city"].value == '') {
		alert("Please provide your City");
		return false;
	}
	if(document.myForm["s_zip"].value == '') {
		alert("Please provide your Zip Code");
		return false;
	}
	if(document.myForm["s_phone"].value == '') {
		alert("Please provide a Phone Number");
		return false;
	}
	if(document.myForm["s_email"].value == '') {
		alert("Please provide an Email Address");
		return false;
	}
	if(document.myForm["s_projectName"].value == '') {
		alert("Please provide a Name for your Project");
		return false;
	}
	if(document.myForm["s_projectDescription"].value == '') {
		alert("Please provide a Description for your Project");
		return false;
	}
	
	// validate upload form fields
	for (var x = 1; x <= 3; x++) {
		var tempvar = "doc_upload_" + x;
	   	var uploadField = document.myForm[tempvar].value;
		if (uploadField != '') {
			var suffix = right(uploadField,3);
			var suffix = suffix.toUpperCase();
			if(suffix != "DOC" && suffix !="PDF" && suffix !="XLS") {
				alert("Only Microsoft Word,\nAdobe PFD,\ or Microsoft Excel\nDocuments\nare allowed for upload.");
				return false;
			}
		}
	}

	return true;
}

function right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}


function fillData() {
	document.myForm.s_firstname.value = "John";
	document.myForm.s_lastname.value = "Doe";
	document.myForm.s_company.value = "ACME Machinery, Inc.";
	document.myForm.s_address_1.value = "123 Second Avenue";
	document.myForm.s_address_2.value = "";
	document.myForm.s_city.value = "Collinsville";
	document.myForm.s_state.selectedIndex = 46;
	document.myForm.s_zip.value = "12345";
	document.myForm.s_phone.value = "276-555-1212";
	document.myForm.s_fax.value = "276-444-2323";
	document.myForm.s_email.value = "john@chatmoss.com";
	document.myForm.s_website.value = "www.chatmoss.com";
	document.myForm.s_projectName.value = "Construction of 30,000 Sq. Ft. Facility";
	document.myForm.s_projectDescription.value = "We are looking for someone to build a building for us.";
	
	document.myForm.i_closingYear.selectedIndex = 0;
	document.myForm.i_closingMonth.selectedIndex = 8;
	document.myForm.i_closingDay.selectedIndex = 14;
	document.myForm.s_closingTime.selectedIndex = 4;
	
	document.myForm.s_conference.selectedIndex = 2;
	
	document.myForm.i_conferenceYear.selectedIndex = 0;
	document.myForm.i_conferenceMonth.selectedIndex = 6;
	document.myForm.i_conferenceDay.selectedIndex = 0;
	document.myForm.s_conferenceTime.value.selectedIndex = 1;
	
	document.myForm.s_conferenceLocation.value = "Dutch Inn";
	document.myForm.s_responseMethod.selectedIndex = 3;

}