var umData = {
	contactPos: 0,
	previews: {
		stvr: [
			['images/portfolio/stvr1.jpg', 'First Post'],
		],
		ts: [
			['images/portfolio/ts1.jpg', 'TempServers home page<br />Features a slide show of supported games (jQuery Slides plugin) and a news feed from the TempServers Twitter account.'],
			['images/portfolio/ts2.jpg', 'Server Booking page<br />Users can select a date from a graphical calendar (jQuery UI) and set various options for the server. The system automatically converts times from the user\'s time zone to the server\'s timezone.'],
			['images/portfolio/ts3.jpg', 'Server Control Panel page<br />This is where users can control and configure their server. Users can restart the server or change games quickly with the AJAX enabled controls (jQuery). The Server Config section allows users to switch between different input modes via the tabbed interface (jQuery UI).'],
			['images/portfolio/ts4.jpg', 'Server Control Panel Mapcycle Editor<br />Allows users to edit the maps running on their server by moving names between panes (jQuery UI Multiselect plugin).'],
			['images/portfolio/ts5.jpg', 'FAQ Page<br />The FAQ features an accordion interface (jQuery UI).']
		],
		lms: [
			['images/portfolio/lms1.jpg', 'Text Encryption<br />Allows users to encrypt or decrypt text, with the option to store the data on the server for retrieval later. Users can enter or generate an encryption key, which is needed for decryption later. Various options are available for stored data.'],
			['images/portfolio/lms2.jpg', 'Encrypted Data Retrieval<br />This is where users can decrypt and view stored data. Users can either click on a custom link or enter the access key, and then supply the encryption key.'],
			['images/portfolio/lms3.jpg', 'Decrypted Data Display<br />If the user supplies the correct key, the original text will be displayed. An access log and expiration info are also displayed.'],
			['images/portfolio/lms4.jpg', 'File Encryption<br />Users can also encrypt files from their computer. Once the file is uploaded, it is encrypted and sent back to the browser.'],
			['images/portfolio/lms5.jpg', 'File Upload<br />This AJAX enabled progress bar shows the upload status.']
		]
	}
};
Cufon.replace('h1, h2, h3');
$(document).ready(function() {
	$("#nav li").blend();
	$("#contact-link").css('display', 'none');
	$("#contact").css('display', 'block');
	$("#contact-button").click(function() {
		$("#contact").stop().animate({ right: umData.contactPos }, 800, 'linear', function() {
			if(umData.contactPos == 0) { umData.contactPos = -382; }
			else { umData.contactPos = 0; }
		});
		return false;
	});
	$("#contactform").submit(function() {
		var submitButton = $("#cfsubmit");
		var spinner = $("#cfprogress");
		var fields = $("#contact input:not(#cfsubmit), #contact textarea");
		spinner.show();
		submitButton.attr('disabled', 'disabled').val('Sending...');
		$.post('contact.php', fields, function(data) {
			if(data == 'success') {
				fields.val('');
				$("#contactform").replaceWith('<div class="success"><h3>Success</h3><p>Thank you for your interest. You will receive an email reply shortly.</p></div>');
				setTimeout(closeForm, 4000);
			}
			else if(data == 'invalid_email') {
				spinner.hide();
				submitButton.removeAttr('disabled').val('Try Again');
				$("#cfemail").addClass('error');
			}
			else {
				spinner.hide();
				$("#contactform").replaceWith('<div class="error"><h3>Error</h3><p>There was an unexpected error. You may contact me directly <a href="mailto:contact@ultramegatech.com">via email</a>.</p><textarea rows="4" cols="30" readonly="readonly">' + $("#cfcomments").val() + '</textarea><div class="clear"></div></div>');
			}
		});
		return false;
	});
	$("#inline-contact").click(function () {
		$("#contact-button").click();
		return false;
	});
	$("#badges img").css('opacity', 0.7).hover(function() {
		$(this).fadeTo(250, 1.0);
	},function() {
		$(this).fadeTo(250, 0.7);
	});
	$("#twitter div").load('twitter.php', function() {
		$(".tweet", this).slideDown();
	});
	$("div.preview").css('cursor', 'pointer');
	$("#preview_ts").click(function() {
		$.slimbox(umData.previews.ts, 0);
	});
	$("#preview_lms").click(function() {
		$.slimbox(umData.previews.lms, 0);
	});
	$("#preview_stvr").click(function() {
		$.slimbox(umData.previews.stvr, 0);
	});
});
function closeForm() {
	$("#contact").animate({ right: -382 }, 800).fadeOut();
}