function sales_events_form(path, email_id) {
	close_request_catalog_form();
	close_email_us_form();
	var new_path = path + '&email=' + $(email_id).value;
	
	new Ajax.Request(new_path, {
		method: 'get',
		parameters: { randid: Math.random() },
		onSuccess: function(transport) {
			showModalDialog(transport.responseText);
		}
	});
}

function close_sales_events_form() {
	if ($('salesEvents')) {
		document.getElementById('salesEvents').style.display='none'; close_modal();
	}
}

function request_catalog_form(path) {
	close_sales_events_form();
	close_email_us_form();
	
	new Ajax.Request(path, {
		method: 'get',
		parameters: { randid: Math.random() },
		onSuccess: function(transport) {
			showModalDialog(transport.responseText);
			$('request_catalog_popup_div').style.visibility = 'visible';
		}
	});
}

function close_request_catalog_form() {
	if ($('request_catalog_popup_div')) {
		$('request_catalog_popup_div').innerHTML = '';
		$('request_catalog_popup_div').style.visibility = 'hidden';
	}
}

function email_us_form(path) {
	close_sales_events_form();
	close_request_catalog_form();
	
	new Ajax.Request(path, {
		method: 'get',
		parameters: { randid: Math.random() },
		onSuccess: function(transport) {
			showModalDialog(transport.responseText);
		}
	});
}

function close_email_us_form() {
	if ($('email_us_popup_div')) {
		$('email_us_popup_div').innerHTML = '';
		$('email_us_popup_div').style.visibility = 'hidden';
	}
}

function submit_email_us_form(servlet_path) {
	new Ajax.Request(servlet_path, {
		method: 'post',
		parameters: { randid: Math.random() },
		onSuccess: function(transport) {
			showModalDialog(transport.responseText);
		},
		postBody: get_form_values('email_us')
	});
}

function submit_request_catalog_form(servlet_path) {
	new Ajax.Request(servlet_path, {
		method: 'post',
		parameters: { randid: Math.random() },
		onSuccess: function(transport) {
			if (transport.getHeader('ACDC_ERROR') == 't') {
				showModalDialog(transport.responseText);
			} else {
				//close_request_catalog_form();
				close_modal();
			}
		},
		postBody: get_form_values('request_catalog')
	});
}

function submit_sales_events_form(servlet_path) {
	new Ajax.Request(servlet_path, {
		method: 'post',
		parameters: { randid: Math.random() },
		onSuccess: function(transport) {
			if (transport.getHeader('ACDC_ERROR') == 't') {
				showModalDialog(transport.responseText);
			} else {
				close_sales_events_form();
			}
		},
		postBody: get_form_values('sales_events')
	});
}
