
$(function(){
	$('input[title], select[title]').bt({
		trigger: ['focus', 'blur'],
		positions: ['right', 'left'],
		fill: '#F4F4F4',
		strokeStyle: '#666666', 
		spikeLength: 20,
		spikeGirth: 10,
		width: 350,
		overlap: 0,
		centerPointY: 1,
		cornerRadius: 0, 
		cssStyles: {
		  fontFamily: '"Lucida Grande",Helvetica,Arial,Verdana,sans-serif', 
		  fontSize: '12px',
		  padding: '10px 14px'
		},
		killTitle: true,
		shadow: true,
		shadowColor: 'rgba(0,0,0,.5)',
		shadowBlur: 8,
		shadowOffsetX: 4,
		shadowOffsetY: 4
	  });
})

function getFocus(){
	$('p.error:first').parent().children(0).focus();
}

$(function(){
	var inputs = $('input:text, select')

		$(inputs).eq(0).focus();

	$('form').submit(function(e){
		$('p.error').remove();
		$(inputs).each(function(){
			if(!($(this).val())){	
				$(this).parent('label').append('<p class="error">This field is required<br />Please enter a number over zero</p>').show('fast');
				
				location.hash = "#topOfForm";
				getFocus();	
				e.preventDefault();	
			}
				else if(($(this).val()) && isNaN($(this).val()) || ($(this).val() < '0.00001' )){
				$(this).parent('label').append('<p class="error">Please enter a number over zero (leading 0 required)</p>').show('fast');
				location.hash = "#topOfForm";
				getFocus();	
				e.preventDefault();
			}
		})
	})
});




	
	
	
	
	
	
	
	
	
