 $(document).ready(function() {
  
		$("#accordion").accordion({
			collapsible: 'true',
			active: 'none',
			clearStyle: true
		});
		
		$('.wipe').focus(function() {
			if (this.value == this.defaultValue) {
				this.value = '';
				}
			});
		$('.wipe').blur(function() {
			if (this.value == '') {
				this.value = this.defaultValue;
				}
			});
			
			
		$('#newsletterSignup form').submit(function() {
			var emailAddress = $('#signupEmail').val();
			$.post('newsletter-signup.php', 'emailAddress=' + emailAddress);
			
			$('#newsletterSignup form').fadeOut(500, function() {
				$(this).html('<div class="emailSuccess">Thanks, you will receive our newsletter from now on.</div>').fadeIn();
			})

			return false;
		});
		
		
		/* ----------- CONTACT FORM -----------------*/
		$('#frmmail input, #frmmail textarea').val('');
			
		$('.formfield').focus(function() {
				inputWidth = $(this).width();
				labelWidth = $(this).prev('label').width();
				var inputType = $(this).attr('type');
				$(this).removeClass('inputAcceptedBg');
				
				if(inputType == 'text') {
					var toMove = inputWidth - labelWidth + 65;
				} else {
					var toMove = inputWidth - labelWidth;
				}
				
				$(this).prev('label').animate({
					marginLeft: toMove,
					opacity: '0.5'
				});
			});
			
			$('.formfield').blur(function() {
				inputWidth = $(this).width();
				labelWidth = $(this).prev('label').width();
				var inputType = $(this).attr('type');
				$(this).removeClass('inputAcceptedBg');
				
				if(inputType == 'text') {
					var toMove = inputWidth - labelWidth + 65;
				} else {
					var toMove = inputWidth - labelWidth;
				}
				
				if($(this).val() == '') { 
					$(this).prev('label').animate({
						marginLeft: 0,
						opacity: '1'
					} );
				} else {
					var toMoveAccepted = toMove - 30;
					$(this).prev('label').animate({
						marginLeft: toMoveAccepted
					});
					$(this).addClass('inputAcceptedBg');
				}
			});
			/*----------------- END CONTACT FORM ------------------*/
			
			
			/*----------------- PORTFOLIO ANIMATIONS ------------------*/
			
			$('.portfolio-item').stop().hover(function() {
				$(this).children('.portfolio-info').stop().animate({
					marginTop: 5
				}, 250, 'swing').animate({
					marginTop: 15
				}, 100, 'swing');

			}, function() {
			$(this).children('.portfolio-info').stop().animate({
					marginTop: 170
				}, 250, 'swing').animate({
					marginTop: 162
				}, 200, 'swing');
		
			});
			/*----------------- END PORTFOLIO ANIMATIONS ------------------*/
			
			
		
	  });