



	function submitContact()
	{
		$('contactErrors').style.display = 'none';
		$('contactErrors').innerHTML = '';
		
		var name = $('contactName').value;
		var email = $('contactEmail').value;
		var comments = $('contactComments').value;
		
		if(name == '' || email == '' || comments == ''){
			$('contactErrors').innerHTML = '<p class="red"><strong>Please fill out all the fields.</strong></p>';
			$('contactErrors').style.display = 'block';
			return false;
		}
		
		new Ajax.Request('/contact.ajax.php', {
	
			onSuccess : function(resp) {
				var data = resp.responseText.evalJSON();
	
				if(data.result == 'success'){
					$('contactForm').style.display = 'none';
					$('contactMessage').style.display = 'block';
				}
			},
	
			onFailure : function(resp) {},
	
			method : 'post',
			parameters : 'action=contact&' + $('contactForm').serialize()
	
		});
	}
	
	
	function submitStallWall()
	{
		$('stallErrors').style.display = 'none';
		$('stallErrors').innerHTML = '';
		
		var name = $('stallName').value;
		var email = $('stallEmail').value;
		var comments = $('stallComments').value;
		
		if(name == '' || email == '' || comments == ''){
			$('stallErrors').innerHTML = '<p class="red"><strong>Please fill out all the fields.</strong></p>';
			$('stallErrors').style.display = 'block';
			return false;
		}
		
		new Ajax.Request('/contact.ajax.php', {
	
			onSuccess : function(resp) {
				var data = resp.responseText.evalJSON();
	
				if(data.result == 'success'){
					$('stallForm').style.display = 'none';
					// close lightbox
					deactivateLightbox();
				}
			},
	
			onFailure : function(resp) {},
	
			method : 'post',
			parameters : 'action=stall&' + $('stallForm').serialize()
	
		});
	}
	
	
	
	function submitVideoShare()
	{
		$('videoErrors').style.display = 'none';
		$('videoErrors').innerHTML = '';
		
		var name = $('videoName').value;
		var email = $('videoEmail').value;
		var recipient = $('videoRecipient').value;
		var comments = $('videoComments').value;
		
		if(name == '' || email == '' || recipient == '' || comments == ''){
			$('videoErrors').innerHTML = '<p class="red"><strong>Please fill out all the fields.</strong></p>';
			$('videoErrors').style.display = 'block';
			return false;
		}
		
		new Ajax.Request('/contact.ajax.php', {
	
			onSuccess : function(resp) {
				var data = resp.responseText.evalJSON();
	
				if(data.result == 'success'){
					$('videoForm').style.display = 'none';
					// close lightbox
					deactivateLightbox();
				}
			},
	
			onFailure : function(resp) {},
	
			method : 'post',
			parameters : 'action=video&' + $('videoForm').serialize()
	
		});
	}
	
	
	
	function submitAdvertise()
	{
		$('advertiseErrors').style.display = 'none';
		$('advertiseErrors').innerHTML = '';
		
		
		
		if(	$('first_name').value == '' ||
			$('last_name').value == '' ||
			$('email').value == '' ||
			$('phone').value == '' ||
			$('URL').value == '' ||
			$('description').value == '' ||
			$('budget').value == ''
		){
			$('advertiseErrors').innerHTML = '<p class="red"><strong>Please fill out all the fields.</strong></p>';
			$('advertiseErrors').style.display = 'block';
			return false;
		}
		
		new Ajax.Request('/contact.ajax.php', {
	
			onSuccess : function(resp) {
				var data = resp.responseText.evalJSON();
	
				if(data.result == 'success'){
					$('advertiseForm').style.display = 'none';
					$('advertiseMessage').style.display = 'block';
				}
			},
	
			onFailure : function(resp) {},
	
			method : 'post',
			parameters : 'action=advertise&' + $('advertiseForm').serialize()
	
		});
	}


	function signupFocus(focus)
	{
		var input = $('signupInput');
		if(!focus && input.value == ''){
			input.value = 'Enter your e-mail address';
		}else if(focus && input.value == 'Enter your e-mail address'){
			input.value = '';
		}
	}
	
	
	function searchFocus(focus)
	{
		var input = $('searchInput');
		if(!focus && input.value == ''){
			input.value = 'Enter search terms';
		}else if(focus && input.value == 'Enter search terms'){
			input.value = '';
		}
	}
	
	
	function inviteFocus(focus)
	{
		var input = $('inviteInput');
		if(!focus && input.value == ''){
			input.value = "Enter friend's e-mail";
		}else if(focus && input.value == "Enter friend's e-mail"){
			input.value = '';
		}
	}
	
	
	function showSignup()
	{
		$('signupMessage').style.display = 'none';
		$('signupInput').value = '';
		signupFocus(false);
		$('signupForm').style.display = 'block';
	}
	
	
	function showInvite()
	{
		$('inviteMessage').style.display = 'none';
		$('inviteInput').value = '';
		inviteFocus(false);
		$('inviteForm').style.display = 'block';
	}
	
	
	
	
	function updateEmail()
	{
		$('updateErrors').style.display = 'none';
		$('updateErrors').innerHTML = '';
		
		var emailOld = $('emailOld').value;
		var emailNew = $('emailNew').value;
		
		if(emailOld == '' || emailNew == ''){
			$('updateErrors').innerHTML = '<p class="red"><strong>Please specify both email addresses.</strong></p>';
			$('updateErrors').style.display = 'block';
			return false;
		}
		
		new Ajax.Request('/signup.ajax.php', {
	
			onSuccess : function(resp) {
				var data = resp.responseText.evalJSON();
	
				if(data.result == 'success'){
					$('updateForm').style.display = 'none';
					$('updateMessage').style.display = 'block';
				}
			},
	
			onFailure : function(resp) {},
	
			method : 'post',
			parameters : 'action=update&old=' + emailOld + '&new=' + emailNew
	
		});
	}
	
	
	function unsubscribe()
	{
		$('unsubscribeErrors').style.display = 'none';
		$('unsubscribeErrors').innerHTML = '';
		
		var email = $('unsubscribeEmail').value;
		
		if(email == ''){
			$('unsubscribeErrors').innerHTML = '<p class="red"><strong>Please specify your email address.</strong></p>';
			$('unsubscribeErrors').style.display = 'block';
			return false;
		}
		
		new Ajax.Request('/signup.ajax.php', {
	
			onSuccess : function(resp) {
				var data = resp.responseText.evalJSON();
	
				if(data.result == 'success'){
					$('unsubscribeForm').style.display = 'none';
					$('unsubscribeMessage').style.display = 'block';
				}
			},
	
			onFailure : function(resp) {},
	
			method : 'post',
			parameters : 'action=unsubscribe&' + $('unsubscribeForm').serialize()
	
		});
	}
	
	
	function signup()
	{
		var email = $('signupInput').value;
		
		if(email == '' || email == 'Enter your e-mail address'){
			alert('Oops, you forgot to add your email address!');
			return false;
		}
		
		new Ajax.Request('/signup.ajax.php', {
	
			onSuccess : function(resp) {
				var data = resp.responseText.evalJSON();
	
				if(data.result == 'success'){
					//$('signupForm').style.display = 'none';
					//$('signupEmail').innerHTML = email;
					//$('signupMessage').style.display = 'block';
					goTo('/who-are-you/?contact_id=' + data.id);
				}
			},
	
			onFailure : function(resp) {},
	
			method : 'post',
			parameters : 'action=subscribe&email=' + email
	
		});
	}
	
	
	
	function submitDetails()
	{
		new Ajax.Request('/signup.ajax.php', {
	
			onSuccess : function(resp) {
				goTo('/thank-you/');
			},
	
			onFailure : function(resp) {
				goTo('/thank-you/');
			},
	
			method : 'post',
			parameters : 'action=details&' + $('detailsForm').serialize()
	
		});
	}
	
	
	function invite()
	{
		$('inviteErrors').style.display = 'none';
		$('inviteErrors').innerHTML = '';
		
		if($('inviteName').value == '' || $('inviteEmail').value == '' || $('inviteInputBody').value == ''){
			$('inviteErrors').innerHTML = '<p class="red"><strong>Please fill out all fields.</strong></p>';
			$('inviteErrors').style.display = 'block';
			return false;
		}
		
		new Ajax.Request('/signup.ajax.php', {
	
			onSuccess : function(resp) {
				var data = resp.responseText.evalJSON();
	
				if(data.result == 'success'){
					//goTo('/careergear-thanks/');
					goTo('/invite-thanks/');
					//$('inviteFormBody').style.display = 'none';
					//$('inviteMessageBody').style.display = 'block';
				}
			},
	
			onFailure : function(resp) {},
	
			method : 'post',
			parameters : 'action=invite&' + $('inviteFormBody').serialize()
	
		});
	}
	
	
	
	
	function sweepstakes()
	{
		$('inviteErrors').style.display = 'none';
		$('inviteErrors').innerHTML = '';
		
		if($('inviteName').value == '' || $('inviteEmail').value == '' || $('inviteInputBody').value == ''){
			$('inviteErrors').innerHTML = '<p class="red"><strong>Please fill out all fields.</strong></p>';
			$('inviteErrors').style.display = 'block';
			return false;
		}
		
		new Ajax.Request('/signup.ajax.php', {
	
			onSuccess : function(resp) {
				var data = resp.responseText.evalJSON();
	
				if(data.result == 'success'){
					goTo('/sweepstakes-thanks/');
					//$('inviteFormBody').style.display = 'none';
					//$('inviteMessageBody').style.display = 'block';
				}
			},
	
			onFailure : function(resp) {},
	
			method : 'post',
			parameters : 'action=sweepstakes&' + $('inviteFormBody').serialize()
	
		});
	}
	
	
	function goTo(url)
	{
		window.location.href = url;
	}