jQuery(document).ready(function($){
	var $anchors=$('*[data-flexmenu]')
	$anchors.each(function(){
		$(this).addflexmenu(this.getAttribute('data-flexmenu'))
	})

	$('.slides').cycle({ 
		fx:     	'fade', 
    	timeout:	6000, 
    	speed:   	1000,
    	next:   	'#next', 
    	prev:   	'#prev',
    	pager:  	'#slider-pager' 
		
	});
	
	var options = {
		url:			'do.form1.mail.php',
		beforeSubmit:	validate,
		clearForm:		true,
		success:		function (){
							alert("Your message has been sent, thank you for your interest!");
						},
		error:			function (){
							alert("Could not send your message at this time");
						}    
	};
					
	$('#headform').ajaxForm(options); 
	
	var optionsmain = {
		url:			'do.form2.mail.php',
		beforeSubmit:	validatemain,
		clearForm:		true,
		success:		function (){
							alert("Your message has been sent, thank you for your interest!");
						},
		error:			function (){
							alert("Could not send your message at this time");
						}    
	};
					
	$('#mainform').ajaxForm(optionsmain); 
	
})

function validate(formData, jqForm, options) { 
	var form = jqForm[0]; 
	if (!form.firstname.value || !form.lastname.value) {
		alert('Please enter a value for both first and last names'); 
		return false; 
	} else if (!form.email.value) {
		alert('Please enter a value for the email field'); 
		return false; 
	}
}

function validatemain(formData, jqForm, options) { 
	var form = jqForm[0]; 
	if (!form.fullname.value || !form.companyname.value) {
		alert('Please enter a value for both name and company fields'); 
		return false; 
	} else if (!form.email.value) {
		alert('Please enter a value for the email field'); 
		return false; 
	}
}

