var Placeholders = {
	init : function() {
		$("form.enhanced .placeholder").addClass("inactive").focus(this.clearValue).blur(this.restoreValue);
		
		$("form.enhanced").submit(function() {
			if ($("form.enhanced .required.inactive").length == 0) {
				$("form.enhanced .inactive").each(Placeholders.clearValue);
				return true;
			}
			$("form.enhanced .required.inactive").addClass("error");
			return false;
			});
		},
	clearValue : function(event) {
		if ($(this).hasClass("inactive")) {
			$(this).attr("placeholder", $(this).val()).val("").toggleClass("inactive").removeClass("error");
			}
		},
	restoreValue : function(event) {
		if ($(this).val() == "") {
			$(this).val($(this).attr("placeholder")).toggleClass("inactive");
			}
		}
	};


$(function() {
	Placeholders.init();

	$("#toggleGrid").click(function () {
		$("body").append('<div id="grid"></div>');
		event.preventDefault();
		});
		
	$("#toggleVGrid").click(function () {
		$("body").append('<div id="vgrid"></div>');
		event.preventDefault();
		});

	$("span.pullquote").each(function() {
		text = $(this).text();
		text=text.replace( /\((.*)\)/gi, " " );
		if ($(this).is(".right")) 
			$(this).parent().before('<blockquote class="pullquote right"><p>&quot;'+ text +'&quot;</p></blockquote>');
		else
			$(this).parent().before('<blockquote class="pullquote col col2 pull1"><p>&#8220;'+ text +'&#8221;</p></blockquote>');
		});
	});