$(function()
{
	$('a.lightbox').lightBox();

	/* */
	$('.photo').hover(function() { $(this).children('.photoControls').toggle(); });

	/* Capture changes */
	$('.numberAdd,.numberSubtract').click(function() { $(this).parents('form.change').addClass("changed"); !$('#changed').is(":visible") && $('#changed').show('fast', function() { $(this).show('highlight', { color: '#FFC8B6' }); }); });
	$('form.change input').change(function() { $(this).parents('form.change').addClass("changed"); !$('#changed').is(":visible") && $('#changed').show('fast', function() { $(this).show('highlight', { color: '#FFC8B6' }); }); });
	$('form.change input').keypress(function(e) { if(e.keyCode == 0) { $(this).parents('form.change').addClass("changed"); !$('#changed').is(":visible") && $('#changed').show('fast', function() { $(this).show('highlight', { color: '#FFC8B6' }); }); } });
	
	/* Capture change save */
	$('#changed a').click(function() { $('form.change').submit(); $(this).parent().hide('drop', { direction: 'down' }, 'fast'); $("#indicator").show(); });
	
	/* Capture confirms */
	$('.confirm').click(function(){ if (!confirm("Are you sure?")) { return false; } });
	
	/* Capture menu change confirms */
	$('#menu a').click(function() { $("#indicator").show(); if ($('form.changed').size() && confirm("Changes were made on this page. Save changes first?")) { $('form.changed').submit(); return false; } });
	
	/* Catch form submits */
	$('form').submit(function() { $("#indicator").show(); });
	
	/* Init date selector */
	$('.date').live('mouseover', function() { $(this).datepicker({ dateFormat: 'dd-mm-yy', showAnim: 'blind', constrainInput: true }); });

	/* Capture numberAdd and numberSubtract */
	$('.numberAdd,.numberSubtract').live('click',function() { if ($(this).hasClass("numberAdd")) { !$(this).prev().val() && $(this).prev().val("0"); $(this).prev().val( parseInt($(this).prev().val())+1); } else { !$(this).prev().prev().val() && $(this).prev().prev().val("0"); $(this).prev().prev().val( parseInt( $(this).prev().prev().val() ) > 0 ? parseInt($(this).prev().prev().val())-1 : 0); } });

});

function browserWarning()
{
	$("#ie6").show('drop', { direction: 'up' }, 1000);
}