$(document).ready(function() {
	if ($('#hero').length > 0) {
		$('#hero').append('<div id="hero_overlay"></div>');
	}
	Cufon.replace('h4', { fontFamily: 'Avenir', hover: true });

	ik = 0;
	$('ul.columns').each(function() {
		ik++;
		items = new Array();
		$(this).children('li').each(function() {items.push($(this).html());});
		ipc = Math.ceil(items.length / 3);
		code = '<ul class="column">';
		for (i=0;i<items.length;i++) {
			if (i > 0 && i % ipc == 0) {
				code += '</ul><ul class="column">';
			}
			code += '<li>'+items[i]+'</li>';
		}
		code += '</ul>';
		$(this).replaceWith('<div class="column_list_container" id="cl_'+ik+'"></div>');
		$('#cl_'+ik).html(code);
		ik++;
	});
	$('a.lightbox').lightBox();
	$('#events_filter').change(function() {
		v = $(this).val();
		window.location.href = '?c='+v;
	});
	$('#event_rsvp_link').click(function(event){
		event.preventDefault();
		$('.rsvp_form').slideDown('slow');
	});
	$('a.blank').click(function(event){
		event.preventDefault();
		window.open($(this).attr('href'));
	});
	$('div.center a').filter(function() {
		return this.hostname && this.hostname !== location.hostname;
	}).attr('target','_blank');
	$('#guests').change(function() {
		val = $(this).val();
		el = "";
		for (i=0;i<val;i++) {
			el += '<label for="guest_'+(i+1)+'">Guest #'+(i+1)+'</label><input type="text" class="longtext" id="guest_'+(i+1)+'" name="guest_'+(i+1)+'" value="" />';
		}
		$('#guest_names').html(el);
		$('#guest_names').slideDown('slow');
	});
});
