/*
Event.observe(window, "load", function() {
        new RSV({
                formID: "weddings_contact_form",
                onCompleteHandler: submitWeddingContact,
                rules: [
                        "required,contact_name,Please enter your favourite Name!!!",
                        "required,contact_email,Please enter your Email Address!!!",
                        "required,contact_phone,Please enter you Phone Number!!!"
                ]
        });
});
*/
function submitContactForm(contact) {
	submitOK = true;
	err_message = "";
	if(contact.contact_name.value == "") {
		submitOK = false;
		err_message += "Need to fill-in Name\n";
		}
	if(contact.contact_email.value == "") {
		submitOK = false;
		err_message += "Need to fill-in eMail\n";
		}
	if(contact.contact_phone.value == "") {
		submitOK = false;
		err_message += "Need to fill-in Phone\n";
		}
	if((contact.contact_event_date) && contact.contact_event_date.value == "") {
		submitOK = false;
		err_message += "Need to fill-in Event Date\n";
		}
	if((contact.contact_wed_date) && contact.contact_wed_date.value == "") {
		submitOK = false;
		err_message += "Need to fill-in Wedding Date\n";
		}
	var sdValues = [];
	for(var i = 1; i < contact.contact_hear_about_us.options.length; i++) {
		if(contact.contact_hear_about_us.options[i].selected == true) {
			sdValues.push(contact.contact_hear_about_us.options[i].value);
			}
		}
	if(sdValues.length == 0) {
		submitOK = false;
		err_message += "Need to select 'How did you hear about us?'\n";
		}
	if (submitOK) {
		$(contact).request({
			onFailure: function(reply) {
				alert("An error has occurred and the form has not been sent!");
				},
			onSuccess: function(reply) {		
				$('contact_form_div').hide();
				$('contact_form_thankyou').show();
				}
		});
		}
	else {
		alert(err_message);
		}
	return false;
	}
	
function galShowImage(image) {
	document.getElementById('gallery_main_image').innerHTML = "<img class='gallery-display-image' src='" + image.href + "' />";
	return false;
	}
	
document.observe("dom:loaded", function() {
	if($('slide-images')) {
		slideshow_init();
	}
	if($('gallery_main_image')) {
		$($$('.flower_gallery td a:not([href|="/gallery"])')).invoke('writeAttribute',"onclick","galShowImage(this); return false;");
	}
});

