$(function() {
	$('#collapse h3').click(function() {
		$(this).next().slideToggle(100);
		return false;
	}).next().hide();
	
	$('#collapse h3').click(function() {
		if ($(this).hasClass('open')) {
			$(this).removeClass('h3_over');
			$(this).removeClass('open');
		}
		else {
			$(this).addClass('h3_over');
			$(this).addClass('open');
		}
	});

	$('#collapse h3').mouseover(function() {
		if ($(this).hasClass('h3_over')) {
		}
		else {
			$(this).addClass('h3_over');
		}
	}).mouseout(function() {
		if ($(this).hasClass('open')) {
		}
		else {
			$(this).removeClass('h3_over');
		}
	});
	
	//Hide labels for input elements with placeholder set.
	$(':input[placeholder]').each(function() {
	     $(this).prev().hide();
	});
	function checkPlaceholder()
	{
	     return 'placeholder' in document.createElement('input');
	}
	if (checkPlaceholder()) {
	     //If browser supports placeholder attribute, remove 'placeholder' class.
	     $(':input[placeholder]').removeClass('placeholder');
	}
	else {
	     //For each input element that needs placeholder text, add faux placeholder text from label.
	     $(':input[placeholder]').each(function() {
	     	if ($(this).val().length>0) {
		     	$(this).removeClass('placeholder');
		     }
		     else {
		     	var val = $(this).prev().text();
		     	$(this).val(val);
		     }
	     });
	     $(':input[placeholder]').focusin(function() {
	     	//Set val equal to label text.
	     	var val = $(this).prev().text();
	     	//If the value of input is equal to the label text, remove the 'placeholder' class and empty the input value.
	     	if ($(this).val()==val) {
	     		$(this).removeClass('placeholder');
	     		$(this).val("");
	     	}
	     });
	     $(':input[placeholder]').focusout(function() {
	     	//Set val equal to label text.
	     	var val = $(this).prev().text();
	     	//If the value of input is empty, add the 'placeholder' class and set value to label text.
	     	if ($(this).val().length==0) {
	     		$(this).addClass('placeholder');
	     		$(this).val(val);
	     	}
	     });
	}
});
