$(function() {
			$("#lava").lavaLamp({
				fx: "backout",
				speed: 500,
				click: function(event, menuItem) {
					//return false;
				}
			});
		});

$(function() {
	$('.header').before('<div id="nav" class="nav">').cycle({
		fx:     'fade',
		speed:  600,
		timeout: 4500,
		cleartypeNoBg: 'true',
		pager:  '#nav'
	});
});

$(function() {
	$('.projects').after('<div id="navproject" class="nav">').cycle({
		fx:     'fade',
		speed:  600,
		timeout: 4500,
		cleartypeNoBg: 'true',
		pager:  '#navproject'
	});
});

function createTableSortable(table, action) {
	$(table).sortable({
		forceHelperSize: true,
		helper: function(e, tr) {
			var $originals = tr.children();
			var $helper = tr.clone();
			$helper.children().each(function(index) {
				$(this).width($originals.eq(index).width())
			});
			return $helper;
		},
		placeholder: 'ui-sortable-placeholder',
		axis: 'y', 
		cursor: 'n-resize',
		handle: '.move',
		items: 'tr:not(.head)',
		update: function(e, ui){
			$.ajax({
				type: "POST",
				url: webroot+action,
				data: "itemId=&newOrder="+$(table).sortable('toArray'),
				error: function(msg){
					$("#flashMessage").html(msg);
				},
				success: function(msg){
					$("#flashMessage").html(msg);
				}
			});
		}
	});
}

/*$(document).ready(function () {
  $('#nav > li > a').click(function(){
	  $('#nav li ul').slideUp();
	   if ($(this).next().is(":visible")){
		   $(this).next().slideUp();
	   } else {
		$(this).next().slideToggle();
	   }
	$('#nav li a').removeClass('active');
	$(this).addClass('active');
  });
});*/
