function populateElement(selector, defvalue)
{
  if($.trim($(selector).val()) == "") {
	$(selector).val(defvalue);
  }

  $(selector).focus(function() {
	if($(selector).val() == defvalue) {
		$(selector).val("");
	}
  });

  $(selector).blur(function() {
	if($.trim($(selector).val()) == "") {
		$(selector).val(defvalue);
	}
  });
}


function limitInputChars(input_name, limit)
{

  var text = $("input[name='" + input_name + "']").val(); 
  var textlength = text.length;
								
  if(textlength > limit) {
	//console.log("You cannot write more then " + limit + " characters!")
	$("input[name='" + input_name + "']").val(text.substr(0,limit));
	return false;
  }
  else {
	//console.log("You have "+ (limit - textlength) +" characters left.");
	return true;
  }
}
