ContactUs = function() {
    return {
        init: function() {
            Event.observe($('frmContact'), 'submit', ContactUs.onSubmit);
        },
        
        onSubmit: function(evt) {
            Event.stop(evt);
            
            if($F('Name').strip() == '')
            {
                alert('Please enter Name.');                
                return false;
            }
            
            if($F('Email').strip() == '')
            {
                alert('Please enter Email.');                
                return false;
            }
            else
            {
                if(!NYWine.isEmail($F('Email')))
                {
                    alert('Please enter a valid Email.');                    
                    return false;
                }
            }
            
            Modalbox.show($('frmContact').action, 
	                        { 
	                            title: 'Contact Us', 
	                            width: 600,
	                            method: 'post',
	                            params: $('frmContact').serialize()
	                        });
            ContactUs.clearForm();
        },
        
        clearForm: function() {
            $('Name').value = '';
            $('Email').value = '';
            $('Address').value = '';
            $('City').value = '';
            $('State').value = '';
            $('Zip').value = '';
            $('Phone').value = '';
            $('Fax').value = '';
            $('Comments').value = '';            
        }
    };
}();


Event.observe(window, 'load', function() {
     ContactUs.init();
});