(function ($) {
	$(document).ready(function(){



		//scroll to top
		$('#call-us a').click(function(e) {
			e.preventDefault();
			$('html,body').animate({
				scrollTop : 0
			},350);
		});


		//text input labels to inline value
		$.fn.setCursorPosition = function(pos) {
			if ($(this).get(0).setSelectionRange) {
				$(this).get(0).setSelectionRange(pos, pos);
			} else if ($(this).get(0).createTextRange) {
				var range = $(this).get(0).createTextRange();
				range.collapse(true);
				range.moveEnd('character', pos);
				range.moveStart('character', pos);
				range.select();
	        }
	    }

		$('label').each(function(i) {
			$(this).next('input[type=text], input[type=password], input[type=file], textarea').val($(this).html()).prev().hide();
		});

		$('input[type=text], input[type=password], input[type=file], textarea').focus(function() {
			if($(this).prev('label').html() == $(this).val()){
				$(this).val('').setCursorPosition(0);
			}
		});

		$('input[type=text], input[type=password], input[type=file], textarea').keypress(function() {
			if($(this).prev('label').html() == $(this).val()) {
				$(this).val('');
			}
		});

		$('input[type=text], input[type=password], input[type=file], textarea').blur(function() {
			if($(this).val() == '') {
				$(this).val($(this).prev('label').html());
			}
		});


	});
}) (jQuery);
