$(document).ready(function(){
				//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
				//Vertical Sliding
				$('#portfolio-list li').hover(function(){
					$(".cover", this).stop().animate({top:'25px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'120px'},{queue:false,duration:600});
				});
				
				$('#requestform').ajaxForm({ 
					// target identifies the element(s) to update with the server response 
					beforeSubmit: validate,
					target: '#results', 
			 
					// success identifies the function to invoke when the server response 
					// has been received; here we apply a fade-in effect to the new content 
					success: function() { 
						$('#results').fadeIn('slow'); 
						clearForm('#requestform');
					} 
				}); 
				
			});


			
			$(function(){
			
			$('#midground').css({backgroundPosition: '0px 0px'});
		    $('#foreground').css({backgroundPosition: '0px 0px'});
		    $('#background').css({backgroundPosition: '0px 0px'});
		
			$('#midground').animate({
				backgroundPosition:"(-10000px -2000px)"
			}, 240000, 'linear');
			
			$('#foreground').animate({
				backgroundPosition:"(-10000px -2000px)"
			}, 120000, 'linear');
			
			$('#background').animate({
				backgroundPosition:"(-10000px -2000px)"
			}, 480000, 'linear');

			$('a[href*=#]').click(function() {
			
			if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
				&& location.hostname == this.hostname) {
				
					var $target = $(this.hash);
					
					$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
					
					if ($target.length) {
					
						var targetOffset = $target.offset().top;
						
						$('html,body').animate({scrollTop: targetOffset}, 2000);
							
						return false;
						
					}
					
				}
				
				  
    		

				
			});
			
			});
			
			function validate(formData, jqForm, options) { 
			 
				for (var i=0; i < formData.length; i++) { 
					if (!formData[i].value) { 
						alert('Please enter a value for all required fields.'); 
						return false; 
					} 
				} 
			}
			
			function clearForm(form) {
				// iterate over all of the inputs for the form
				// element that was passed in
				$(':input', form).each(function() {
				var type = this.type;
				var tag = this.tagName.toLowerCase(); // normalize case
				// it's ok to reset the value attr of text inputs,
				// password inputs, and textareas
				if (type == 'text' || type == 'password' || tag == 'textarea')
				this.value = "";
				// checkboxes and radios need to have their checked state cleared
				// but should *not* have their 'value' changed
				else if (type == 'checkbox' || type == 'radio')
				this.checked = false;
				// select elements need to have their 'selectedIndex' property set to -1
				// (this works for both single and multiple select elements)
				else if (tag == 'select')
				this.selectedIndex = -1;
				});
			};
