﻿/// <reference path="jquery-1.3.2-vsdoc2.js" />

var dhs = function() {
	/// <summary>
	/// Refimp utilities.
	/// </summary>
	//--------------------------------------------------------------------------
	function initSearch(id, v) {
		/// <summary>
		/// Makes the input elements of the login area show/hide their respective default
		/// values when the elements are focused.
		/// </summary>

		var $textfield = $(id);

		$textfield.val(v);

		$textfield.focus(function() {
			if ($(this).val == 'Sök på danshogskolan.se...') {
				$(this).val('');
			}
		}).blur(function() {
			if ($(this).val == '') {
				$(this).val(v);
			}
		});

	}
	//--------------------------------------------------------------------------	
	function init() {
		/// <summary>
		/// Initialises the lps class.
		/// </summary>
		//initSearch();
	};
	//--------------------------------------------------------------------------
	return {
		/// <summary>
		/// Public properties and methods.
		/// </summary>	
		init: init,
		initSearch: initSearch
	};
	//--------------------------------------------------------------------------	
} ();

(function($) {
	$.fn.autofill = function(options) {
		var defaults = {
			value: 'First Name',
			defaultTextColor: "#b2adad",
			activeTextColor: "#333"
		};
		var options = $.extend(defaults, options);
		return this.each(function() {
			var obj = $(this);
			obj.css({
				color: options.defaultTextColor
			}).val(options.value).focus(function() {
				if (obj.val() == options.value) {
					obj.val("").css({
						color: options.activeTextColor
					});
				}
			}).blur(function() {
				if (obj.val() == "") {
					obj.css({
						color: options.defaultTextColor
					}).val(options.value);
				}
			});
		});
	};
})(jQuery);