
// Ajax function to enable the 
//  ASHI VHI Tour <div>.
function enableVHI() {
	
	var proc_url = 'scripts/vhi_enable.php';
	var target_div = 'VHI';
	//var pars = 'action='+action;
	
	new Ajax.Updater(target_div, proc_url, { 
		method: 'get'
	});
}

// Helper funtion to show the
//  ASHI VHI tour.
function showVHI() {
	
	var win = new Window({
		className: "alphacube",
		title: "ASHI&reg; Virtual Home Inspection Tour",
		resizable: false, maximizable: false, minimizable: false,
		draggable:true, wiredDrag: true,
		zIndex: 100, top: 170, left: 120, width: 590, height: 520,
		url: "http://www.ashi.org/customers/vhi/vhi.htm",
		showEffect:Element.show, hideEffect: Element.hide,
		destroyOnClose: true	
	});
	
	win.showCenter();
}

// Ajax function to process the 
//  additional services menu.
function additionalServices(action) {
	
	var proc_url = 'scripts/addtlSrvProc.php';
	var target_div = 'AdditionalServices';
	var pars = 'action='+action;
	
	new Ajax.Updater(target_div, proc_url, { 
		method: 'get',
		parameters: pars
	});
}

// Ajax function to process the mailform,
//  send the email, and toggle the 
//  mail_sent, and form <div>'s.
function ProcessMailForm(){
	
	var url = 'scripts/contact.email.php';
	var pars = $('contact').serialize();
	var error_msg = 
		"The mail system is temorarily not working.\n"
	 + "Please use the link above to send email with"
	 + " your default email client.";
	
		if (emailCheck($F($('contact')['email']))) {
		
		ClearAll($('contact'));
	
		new Ajax.Request(url, {
			method: 'post', 
			parameters: pars,
			onSuccess: function(resp) {
				$('form', 'mail_sent').invoke('toggle');
			},
			onFailure: function(resp) {
	   		alert(error_msg);
	 		} 
		});
	}
}

// Ajax function to switch back the 
//  mail_sent and form <div>'s via
//  toggle().
function SendAnotherEmail() {
	LoadDefaults(); // Reload the default vals for the form
	$('form', 'mail_sent').invoke('toggle');
}

