function prepmailer() {
	if($('#mailerform').length > 0) {
		data = $(":input[@name^='data']").map(function(){ return $(this).attr("name").replace(/data\[/, '').replace(/\]/, ''); }).get();
		h = document.createElement("input");
		h.name = 'ordered_input_names';
		h.type = 'hidden';
		h.value = data;
		$('#mailerform').append(h);

		$('#mailerform').submit(function() {
			$('#submit').val('submitting...');
			$('#submit').attr("disabled","disabled");
		})
	}
}

$(document).ready(function() {
	$('ul.nav_tsc a').click(function() {
		$('.home_beta_content div').hide();
		$('#' + $(this).attr('rel')).fadeIn('slow');
		return false;
	});
	
	$('#think').mouseover(function() {$('#tsc').addClass('think')}).mouseout(function(){$('#tsc').removeClass('think')});
	$('#solve').mouseover(function() {$('#tsc').addClass('solve')}).mouseout(function(){$('#tsc').removeClass('solve')});
	$('#create').mouseover(function() {$('#tsc').addClass('create')}).mouseout(function(){$('#tsc').removeClass('create')});
	
	// Portfolio
	$('ul.portfolio a').mouseover(function(){
		img = $($(this).attr('rel'));
		t = $(this).position().top - 30;
		l = $(this).position().left - 20;
		img.css('top',t).css('left',l);
		img.attr('href', $(this).attr('href'));
		img.fadeIn('slow');
	});
	$('a.preview').mouseout(function(){$('a.preview').hide();});
	
	// Portfolio Thumbnails
	if($('#port_thumbs ul li').length == 0) $('#port_thumbs').css('display','none');
	$('#port_thumbs a').click(function() {
		newimg = $($(this).attr('href')).attr('src');
		$('#port_img_primary').attr('src',newimg);
		return false;
	});
	
	$('#toggle').click(function() {
		$("#port_wrapper").toggle("normal");
		$(this).toggleClass("hidden");
		return false;
	});
	
	//prepmailer();
});