//////////////////////////////////// BEGIN USER-DEFINED INFORMATION ///////////////////////////////////////////////////////////////////////

//enter email addresses to send the form info to. separate multiple addresses with a comma

var mail_to = "akhil.saklani@theattorneystore.com, mspychalski@galyen.com, pgalyen@galyen.com";


//A list of form mail subjects, depending on which form is being interacted with. Put each inside curly braces in the following form: 
// { formIdAtrribute: "mail subject string", formIdAtrribute: "mail subject string" } Separate different id/message pairs with a comma

var mail_subjects = $H({ ContactForm: "Immigration Contact Form" }); 


//the phrase to present to the user once their form has been successfully submitted

var mail_success_msg = "Thank you! You form has been received and we will contact you soon."; 


//the phrase to present to the user in case something goes wrong with the mailing process. Contact number, etc.

var mail_failure_msg = "Something has gone wrong. Please contact us at 1-866-378-4705."; 

///////////////////////////////////// END USER-DEFINED INFORMATION //////////////////////////////////////////////////////////////////////

function mailform(formId) {	
	var labels = new Array();
	var mail_info = new Array;
	
	mail_info[0] = mail_to;
	mail_info[1] = mail_subjects[formId];
	mail_info[2] = mail_success_msg;
	mail_info[3] = mail_failure_msg;
	
	mail_info = mail_info.toJSON();
	
	$$('label').each(function(n) {labels.push([n.innerHTML, n.next().name])});
	var labels = labels.toJSON();
	var data = Form.serialize($(formId));
	new Ajax.Updater('form_response', '/form-mailer.php', {parameters: {labels: labels, data: data, mail_info: mail_info}});
}
