
function layout() {
  $el = $('input[type=checkbox]');
  $el.prev().remove();
  $lb = $el.parent().prev().children('label');
  $el.unwrap().detach();
  $lb.unwrap().detach();

  $d = $('dl');
  for (i=0; i<$lb.length; i++) {
      content = $('<p class="column"><strong></strong><br /></p>');
      $d.before(content);
      $('strong',content).append($lb[i]).parent().append($el[i]);
  }

  $('.column').wrapAll('<div class="columns" />');
}

$(function() {

	$('img[src$=mini.jpg]').each(function(key, value) {
		var target = this.src.replace(/mini\.jpg$/, 'thumb.jpg'); 
		$(this).wrap('<a rel="fancybox" title="' + this.title + '" href="' + target + '">');
	});
	
	$("a[rel=fancybox]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over'
	});
	
	//mark error on required fields
	$error = $("form .errors");
	if ($error.length) {
		$error.hide().prev().css("border-color","red");
	}

/*	$checkboxes = $("input[type=checkbox]");
	if ($checkboxes.length) {
		$dt = $checkboxes.parent().addClass("checkbox").prev().addClass("checkbox");
		$ck = $(".checkbox").width("45%").filter("dt:odd,dd:odd").css({"float":"right","clear":"right"});
	}*/
	layout();
});

