﻿Event.observe(window, 'load', function(event) {
	mn.init();
});

var mn = {
	init : function () {
		var inputs = $$('.clear_on_focus');
		inputs.each (function (obj) {
		  if ($(obj).tagName == 'TEXTAREA' ||
		  		($(obj).tagName == 'INPUT' && $(obj).getAttribute('type') && $(obj).getAttribute('type') == 'text')) {
		  	ph = $(obj).getAttribute('placeholder');
				if (ph && ph.length > 0 && $(obj).value.length < 1 ) {
					$(obj).addClassName ('light_field');
					$(obj).value = ph;
			    $(obj).onclick = function() {
			    	if (this.value == this.getAttribute('placeholder')) {
							this.value = '';
							this.removeClassName('light_field');
						}
						return false;
					}
					$(obj).onblur = function() {
						if (this.value.length < 1) {
							this.addClassName('light_field');
							this.value = this.getAttribute('placeholder');
						}
					}
				}
			}
		});
	},
	shopNavShow : function (idx) {
		new Effect.Appear ('shop'+idx+'_info', {duration:0.5, queue: { position: 'end', scope: 'shop_menu'+idx }});
	},
	shopNavHide : function (idx) {
		new Effect.Fade ('shop'+idx+'_info', {duration:0.1, queue: { position: 'end', scope: 'shop_menu'+idx }});
	}
}
