
function approvalContactSub(){
	var parentsname = $('#parentsName').val();
	var address = $('#address').val();
	var address1 = $('#address1').val();
	var email = $('#email').val();
	var phone = $('#phone').val();
	var childsname = $('#childsName').val();
	var childsage = $('#childsAge').val();
	var form_id = $('#form_id_contact').val();
	
	var dataStr = "parent-s-name="+parentsname+"&form_id="+form_id+"&address="+address+"&address1="+address1+"&email="+email+"&phone="+phone+"&child-s-name="+childsname+"&child-s-age="+childsage;

	$.ajax({  
	   type: "POST",  
	   url: "/form-proc/dynamic-proc/",  
	   data: dataStr,  
	   success: function(msg) { 
			$('#opDone').html(msg);
			$("#opDone").dialog();
	   },
		error:function (xhr, ajaxOptions, thrownError){
			alert(xhr.status);
			alert(thrownError);
		}   
	 });  
}

$(function() {
	// This initialises carousels on the container elements specified, in this case, carousel1.
	//timer = setTimeout('shift()', delay);
	$("a.enlarge").fancybox();
	
	var container = $('#validate');
	// validate the form when it is submitted
	var validator = $("#homeInfoForm").validate({
		errorContainer: container,
		errorLabelContainer: $("ol", container),
		wrapper: 'li',
		meta: "validate",
		invalidHandler: function(form, validator) {
			$( "#validate" ).dialog();
        },
		submitHandler: function() {
			approvalContactSub();
		}
	});
	
	$("a.videoPrev").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'padding' : 0,
		'width'  : 370,
		'height' : 301,
		'type'    : 'swf',
		'href'    : this.href,
		'overlayShow'	:	false
	});

});
