$(document).ready(function(){// check the user signin	$('#submit').click(save_events);	// show create event form when add your event link clicked	$('#create_event').click(function(){	$('#event_form').slideToggle('slow',function(){	get_account_fields();											});	});	// options listed for display purposes			// style these options with css to fit your application			$("#contact").slideLock({							labelText: "Slide the black box to the right to Unlock this form - Then Click Submit.",				noteText: "Unlocking the form this way proves you're human and not an autobot",				lockText: "Locked",				unlockText: "Unlocked",				iconURL: "images/arrow_right.png",				inputID: "sliderInput",				onCSS: "#333",				offCSS: "#aaa",				inputValue: 1,				saltValue: 9,				checkValue: 10,				submitID: "#submit"						});}); // this is the end of the top $Jquery groupingfunction get_account_fields(){	if(typeof user_relator == 'undefined') {    var user_relator = ''; // if it doesn't exist make it empty.	}	//alert(user_relator);	jQuery.ajax({	type:"POST",	url:"code/get_account_fields.php",	data:'user_relator='+user_relator,	cache:false,	success:function(response){		var data = response.split('|');		var test = data[0];		if(test == 1) // 0 failed lookup.		{		$('#name').val(data[1]);		$('#phone').val(data[3]);		$('#email').val(data[3]);		$('#address').val(data[4]);		$('#city').val(data[5]);		$('#state').val(data[6]);		$('#zip').val(data[7]);		}	}			});}// add a comment.  If user_relator or session['relator'] is set comment will be tagged to user.function save_events(){var errors = "";var name = $('#name').val();var phone = $('#phone').val();var email = $('#email').val();var organization = $('#organization').val();var address = $('#address').val();var city = $('#city').val();var state = $('#state').val();var zip = $('#zip').val();var location_pick = $('#location').val();var location = $('#location option:selected').val();var startdate = $('#startdate option:selected').val();var enddate = $('#enddate option:selected').val();var startdate2 = $('#startdate2 option:selected').val();var startdate3 = $('#startdate3 option:selected').val();var startdate4 = $('#startdate4 option:selected').val();var hour = $('#hour option:selected').val();var minutes = $('#minutes option:selected').val();var title = $('#title').val();var for_print = $('#for_print').val();var description = $('#description').val();var category = $('#category option:selected').val();var url = $('#url').val();var ampm = $('#ampm option:selected').val();var sliderInput = $('#sliderInput').val();if(name == '')errors+='Name Field.\n'if(phone == '')errors+='PHone Field.\n'if(email == '')errors+='Email Field.\n'if(organization == '')errors+='organization Field.\n'if(address == '')errors+='Address Field.\n'if(city == '')errors+='City Field.\n'if(state == '')errors+='State Field.\n'if(zip == '')errors+='Zip Field.\n'if(location == '')errors+='Location Field.\n'if(startdate == '')errors+='Event Date Field.\n'if(hour == '')errors+='Time Field.\n'if(title == '')errors+='Title of Event Field.\n'if (errors){	alert('The following required fields were left blank:\n'+errors);  	return false;}description = description.replace('&','~~');jQuery.ajax({	type:"POST",	url:"code/save_event.php",	data:'name='+name+'&phone='+phone+'&email='+email+'&organization='+organization+'&address='+address+'&city='+city+'&state='+state+'&zip='+zip+'&location='+location+'&startdate='+startdate+'&enddate='+enddate+'&startdate2='+startdate2+'&startdate3='+startdate3+'&startdate4='+startdate4+'&hour='+hour+'&minutes='+minutes+'&title='+title+'&for_print='+for_print+'&description='+description+'&category='+category+'&url='+url+'&ampm='+ampm+'&sliderInput='+sliderInput,	cache:false,	success:function(response){		//alert(response);		$('#event_form').toggle('slow');	}			});return false; // make the form not submit no matter what.}
