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


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

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

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