// JavaScript Document for lightbox validation.

function validateLightBox() {

	$('#taf').validate({
											 
		rules: {
			
			name: 'required',
			email: {
				required: true,
				email: true
			},
			friendname: 'required',
			friendemail: {
				required: true,
				email: true
			},
			verification: 'required'
			
		},
		
		messages: {
			name: '',
			friendname: '',
			email: {
				required: '',
				email: ''
			},
			friendemail: {
				required: '',
				email: ''
			},
			verification: ''
		},
		
		errorElement: 'em',
		
		onfocusout: false,
		
		onkeyup: false,
		
						submitHandler: function(){
							
							jQuery.post('/glide-define/taf.php', {
								'name': $("#yourName").attr("value"),
								'email': $("#yourEmail").attr("value"),
								'friendname': $("#friendName").attr("value"),
								'friendemail': $("#friendEmail").attr("value"),
								'key': key
							});
							
							
							$(document).scrollTop(0);
							$('#lightBoxPage1').css('display', 'none');
							
							$('#lightBoxContent').load('taf-thanks.php #lightBoxPage2', function() {
							
								$('#lightBox').queue(function() {
									
									$('#lightBoxPage2').css('display', 'none');
									$('#lightBoxPage2').slideDown('slow');
									$(this).dequeue();
									
								});
								
							}); 
							
							return false; 
							
						}

		
	});
	
	
};




