jQuery().ready(function () {
	// set up tabs
	$('#share li a').click(function () {
		$this = $(this);
		if ($this.attr('class') == 'selected') return;
		$('#share .pane').hide().parent().find('.' + $this.attr('rel')).show();
		$('#share li a').attr('class', '');
		$this.attr('class', 'selected');
	});

	// set up forms
	$("#share input[name='url']").focus();
	$('#key').keypress(function (e) {
		return (e.which == 45 || e.which == 43 || e.which == 95 || e.which == 8 ||
			(e.which >= 48 && e.which <= 57) ||
			(e.which >= 65 && e.which <= 90) || 
			(e.which >= 97 && e.which <= 122)
		)
			? true
			: false;
	}).keyup(function (e) {
		$('#dyn-url span').html(
			($(this).val() == '')
				? '[random]'
				: $(this).val()
		);
	});

	$("form[name='create']").submit(function () {
		/*
			encapsulate all of the form variables, send over via json to a backend ajax script.
			this backend script will perform additional validation.
			it'll either return some json that the frontend will interpret to act on error, or..
			it'll return an A-OKAY and deliver a thank-you page with next steps (probably a phase 2 on the homepage)
		*/
	});
});
