$(function(){
	
	// LABEL: Grabbing, removing, inserting in input field:
	var labelText;
  
  
	$('.sokord').each(function(){
	  var labelTextFocus = $(this).prev().first().text();
	  $(this).addClass('placeholder').val(labelTextFocus).first().focus(function(){
      labelTextFocus = $(this).prev().text();
  		if (this.value == labelTextFocus) {
  			var borderWhenPlaceholder = $(this).css("border");
  			$(this).removeClass('placeholder').val('').css("border",borderWhenPlaceholder);
  		};

  	}).blur(function(){
  		if ($(this).val() == '') {
  		  labelText = $(this).prev().text();
  			var borderWhenEmpty = $(this).css("border");
  			$(this).addClass('placeholder').val(labelText).css("border",borderWhenEmpty);
  		};

  	});
	});
	
	// VALIDATION: making sure the input is longer than 1 character
	$('form.sfield').submit(function(){
		if ( $(".sokord").val().length <= 1 ) {
			alert("Vänligen, använd fler än ett tecken i din sökning.");
			return false;
		};
		
	});
	
});

