jQuery(document).ready(function($) {
	
	// apple conditionals
	var isiPad = navigator.userAgent.match(/iPad/i) != null;
	var isiPhone = (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i));
	
	if(isiPad){
		$("html").addClass("ipad");
	}
	if(isiPhone){
		$("html").addClass("iphone");
	}
	// end apple conditionals
	
	

				if($("body").hasClass("page-id-4")){
	            $('.anythingSlider').anythingSlider({
	                easing: "easeOutQuad",        // Anything other than "linear" or "swing" requires the easing plugin
	                autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
	                delay: 5800,                    // How long between slide transitions in AutoPlay mode
	                startStopped: false,            // If autoPlay is on, this can force it to start stopped
	                animationTime: 950,             // How long the slide transition takes
	                hashTags: true,                 // Should links change the hashtag in the URL?
	                buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
	        		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
	        		startText: "Go",             // Start text
			        stopText: "Stop"               // Stop text
	            });
				}
	// end header slider
	
	
	// contact form =================================================
	$("form").submit(function() {
		
		var action = $(this).attr("action");
		
		$.post(action, $(this).serialize(), function(data){
			$("#valid").html(data);
		});
		
		return false;
	});
	
	// window size =================================================
	window.size = function(){
		var w = 0;
		var h = 0;

		//IE
		if(!window.innerWidth)
		{
			//strict mode
			if(!(document.documentElement.clientWidth == 0))
			{
				w = document.documentElement.clientWidth;
				h = document.documentElement.clientHeight;
			}
			//quirks mode
			else
			{
				w = document.body.clientWidth;
				h = document.body.clientHeight;
			}
		}
		//w3c
		else
		{
			w = window.innerWidth;
			h = window.innerHeight;
		}
		return {width:w,height:h};
	}
	
	function resizeMe(){
		
		if(isiPad){}else{
			
			//if($("body").hasClass("page-template-page-contact-php") || $("body").hasClass("page-template-page-home-php")){}else{
				
				if(window.size().height <= 795){
			
					if($("#footer").offset().top >= 736){
			
						$("#footer").animate({

							'bottom': '0'

						}, { queue: false, duration: 500 });
				
					} else {
			
						$("#footer").animate({

							'bottom': '-200px'

						}, { queue: false, duration: 500 });
				
					}
			
			
			
				} else {
			
					$("#footer").animate({
				
						'bottom': '0'
				
					}, { queue: false, duration: 500 });
			
				}
			
			//}
			
		}
		
	}
	
	$(window).load(function() {
		resizeMe();
	});
	
	$(window).resize(function() {
		resizeMe();
	});
	
	$(window).scroll(function() {
		resizeMe();
	});
	
});

