function showForm() {
	$('#contact .content #show-contact-form').find('a').html('hide contact form');
	$('.logo-wrapper').slideUp();
	$('#contact .content .extra').fadeIn();
}
function hideForm() {
	$('#contact .content #show-contact-form').find('a').html('show contact form');
	$('#contact .content .extra').fadeOut();
}

$(document).ready(function() {
	$('#splash-wrapper').fadeIn();
	// $('#main-wrapper').fadeIn();
	
	$('#enter').click(function() {
		$('#splash-wrapper').fadeOut('fast', function() {$('#logo').fadeIn('fast');$('#main-wrapper').fadeIn('fast');});
		return false;
	});
	$(window).resize(function() {
		$('#main-wrapper').height($(window).height());
	}).trigger('resize');
	
	$('#soft .title').click(function() {
		var logos = $('#soft .logo-wrapper');
		if(logos.is(':visible')) {
			logos.slideUp(1000);
		}
		else {
			hideForm();
			logos.slideDown(1000);
		}
		return false;
	});
	$('#hard .title').click(function() {
		var logos = $('#hard .logo-wrapper');
		if(logos.is(':visible')) {
			logos.slideUp(1000);
		}
		else {
			hideForm();
			logos.slideDown(1000);
		}
		return false;
	});
	$('#contact .title').click(function() {
		var content = $('#contact .content');
		if(content.is(':visible')) {
			hideForm();
			content.slideUp(1000);
		}
		else {
			content.slideDown(1000);
		}
		return false;
	});
	$('#contact .content #show-contact-form').click(function() {
		if($('#contact .content .extra').is(':visible')) {
			hideForm();
		}
		else {
			showForm();
		}
		return false;
	});
	$('a.logo').hover(
		function() {
			var img = $(this).find('img');
			// img.fadeOut('fast');
			var image_name = img.attr('src').split('/').pop();
			img.attr('src', 'img/logos/color/' + image_name);
		},
		function() {
			var img = $(this).find('img');
			var image_name = img.attr('src').split('/').pop();
			img.attr('src', 'img/logos/' + image_name);
			// img.fadeIn('fast');
		}
	);
});

// contact form
$(document).ready(function() { 
var options = { 
target:        '#alert',
}; 
$('#contact-form').ajaxForm(options); 
}); 

$.fn.clearForm = function() {
  return this.each(function() {
	var type = this.type, tag = this.tagName.toLowerCase();
	if (tag == 'form')
	  return $(':input',this).clearForm();
	if (type == 'text' || type == 'password' || tag == 'textarea')
	  this.value = '';
	else if (type == 'checkbox' || type == 'radio')
	  this.checked = false;
	else if (tag == 'select')
	  this.selectedIndex = -1;
  });
};
