/* JavaScrpt Document */

$(document).ready(function(){

	$(window).scroll(function(){
		$('.feedback').animate({marginRight:0},'slow');
	});
	
	$('#close').click(function(){
		$('.feedback').hide();
	});

$("#navigation li").hover(function(){
		$(this).stop().animate({backgroundPositionY: '40px'} , 250);
	},function(){
		$(this).stop().animate({backgroundPositionY: "0px"} , 250);
});

$(".button a").hover(function(){
		$(this).stop().animate({backgroundPositionY: '40px'} , 250);
	},function(){
		$(this).stop().animate({backgroundPositionY: "0px"} , 250);
});


/* Modal Preferences */

$('.form').fancybox({
		maxWidth	: 800,
		maxHeight	: 600,
		fitToView	: false,
		width		: '50%',
		height		: '90%',
		autoSize	: false,
		closeClick	: false,
		openEffect	: 'elastic',
		closeEffect	: 'elastic'

});
	
$('.curbsideModal').fancybox({
		maxWidth	: 525,
		maxHeight	: 650,
		
		openEffect:'elastic',
		closeEffect:'elastic'
});

$('.acceptableWaste,.pickupRequest').fancybox({
		maxWidth: 500,
		padding: 2,
		fixed: true,
		scrolling: false
})


$('#getDirections').click(function(e){
	e.preventDefault();
})


$('#submit').click(function(){
	$.post('/resources/php/contact.php',{
		name: $('#name').val(),
		email: $('#email').val(),
		phone: $('#phone').val(),
		message: $('#message').val(),
		submit: "submit"	
	},
	function(html){
		if(html=='success'){
			$('#submit').fadeOut();
			alert('Your message as been sent!');
		}
		
		if(html=='fail'){
			alert('Your message did not send');
		}
	})

})

/*$('a[href*="#"]').click(function(e){
		e.preventDefault();
		alert('Opps! This page has not been made yet. Sorry for the inconvenience, please check back soon');
})
*/


});



