var museo = {src:'/sites/1/static/images/museo.swf'};

var animation_check = function() {
	if($.browser.mozilla) {
		return $.browser.version.substr(0,3) == '1.9'; // Only animate in firefox 3
	} else {
		return true;
	}
};

var on = function(i) {
	if(!animation_check()) return;
	var alternate = $(i.getAlternate());
	var li = $(alternate).parents('.item:first');
	li.animate({marginLeft: 35}, 200);
};

var off = function(i) {
	if(!animation_check()) return;
	var alternate = $(i.getAlternate());
	var li = $(alternate).parents('.item:first');
	li.animate({marginLeft: 30}, 200);
};

sIFR.activate(museo);

sIFR.replace(museo, {
	selector: '#nav .item',
	offsetTop: -1,
	tuneHeight: -4,
	css: {
		'a' : { 'color': '#C9D38D', 'text-decoration': 'none' },
		'a:hover' : { 'color': '#3b0c3d', 'text-decoration': 'none' },
		'.selected' : { 'color': '#3b0c3d', 'text-decoration': 'none', 'margin-left':5 }
	},
	onRollOut: function(i) {
		off(i);
	},
	onRollOver: function(i) {
		on(i);
	}
});

sIFR.replace(museo, {
	selector: 'h2',
	fitExactly: true,
	tuneHeight: -6,
	offsetTop: -6,
	css: {
		'.sIFR-root': {
			'color': '#9ab82d'
		}
	}
});

(function ($) {

        /**
         * Initialise input hints on all matched inputs.
         *
         * options keys:
         *   hintClass - CSS class to apply to inputs for which the hint is currently
         *               visible.
         */
        $.fn.inputHint = function(options) {
                options = $.extend({hintClass: 'hint'}, options || {});

                function showHint() {
                        if ($(this).val() == '' || $(this).val() == $(this).attr('hint')) {
                                $(this).addClass(options.hintClass).val($(this).attr('hint'));
                        }
                }

                function removeHint() {
                        if ($(this).hasClass(options.hintClass)) $(this).removeClass(options.hintClass).val('');
                }

                this.each(showHint);
                this.focus(removeHint).blur(showHint);

                var form = this.parents('form');
                if (!form.attr('clear-input-hints-attached')) {
                        form.submit(function() { $('input, textarea', this).each(removeHint); });
                        form.attr('clear-input-hints-attached', 'true');
                }
        };

		$.fn.resetHints = function() {
			this.each(function() {
				$(this).attr('value', '');
				$(this).blur();
			});
			return this;
		};

})(jQuery);

$(function() {

	$('input[hint]').inputHint();

});