$(function() {
	
	$.fn.swap = function(b) {
		b = jQuery(b)[0];
		var a = this[0],
		    a2 = a.cloneNode(true),
		    b2 = b.cloneNode(true),
		    stack = this;
		
		a.parentNode.replaceChild(b2, a);
		b.parentNode.replaceChild(a2, b);
		
		stack[0] = a2;
		return this.pushStack( stack );
	};
	
	
	
	$(".buttonright").each(function() {
		$(this).parent('div').addClass('buttonright');
		$(this).removeClass('buttonright');
	});
	$(".longertext").each(function() {
		$(this).parent('div').addClass('longertext');
		$(this).removeClass('longertext');
	});
	$(".longertextcheck").each(function() {
		$(this).parent('div').addClass('longertextcheck');
		$(this).removeClass('longertextcheck');
	});
	$(".buttonright input").swap($(".buttonright label"));
	$(".longertext input").swap($(".longertext label"));
});
