/***
This is code that would otherwise go the misc section of the page
**/

$(document).ready(function() {
	// header navigation fade-in/fade-out
	$('.fadeThis').append('<span class="hover"></span>').each(function () {
		var $span = $('> span.hover', this).css('opacity', 0);
		$(this).hover(function () {
			$span.stop().fadeTo(250, 1);
		}, function () {
			$span.stop().fadeTo(250, 0);
		});
	});
	//fancybox
	$("li#go_download a, li#go_learn a, li#go_talk a, p#description a").fancybox({
		'zoomSpeedIn':	500, 
		'zoomSpeedOut':	500,
		'hideOnContentClick': true,
		'frameWidth': 500,
		'frameHeight': 200
	});
	//contact form
	var options = {
		target:        '#alert',
		beforeSubmit:  showRequest,
		success:       showResponse
	};
	$('#contactForm').ajaxForm(options);
});

function showRequest(formData, jqForm, options) {
var queryString = $.param(formData);
return true;
}

function showResponse(responseText, statusText)  {
}
$.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;
  });
};

