/**
 * Koffie & Kado Shop
 */

(function($){

	var Shop = {
		initialize:function(){

			// tell css js is there
			$("body").addClass("JS-active");

			// init hints
			$('input:text[title]').hintValues();

			// hoverable elements
			$('li.button, .personal li.login, div.ww div.middle, div.ww div.important').hoverable({
				className: 'hover'
			});

		}
	};

	/**
	 * Hints
	 */
	$.fn.hintValues = function(settings) {
		this.each(function(){
			$(this).blur(function(){
				if(!this.value || this.value == this.title) {
					this.value = this.title;
					$(this).addClass('blurred');
				}
			});
			$(this).focus(function(){
				if(this.value == this.title) {
					this.value = '';
					$(this).removeClass('blurred');
				}
			});
			$(this).triggerHandler('blur');
		});
	};


	/**
	 * Hoverable
	 */
	$.fn.hoverable = function(settings) {
		this.hover(function(){
			$(this).addClass(settings.className);
		}, function(){
			$(this).removeClass(settings.className);
		});
	}


	/**
	 * Init
	 */
	$(function(){
		Shop.initialize();
	});

})(jQuery)