
window.addEvent('domready', function()
{
	Watchdog.initialize(document);
	
});

var Watchdog = {

	
	initialize: function() {
		this.update(document);
	},

	update: function(el) {
		
		
		if($('box')) {
				var hs2 = new noobSlide({
				box: $('box'),
				items: [1,2,3],
				interval: 6000,
				fxOptions: {
					duration: 1000,
					/* transition: Fx.Transitions.Bounce.easeOut, */
					wait: false
				},
				autoPlay: true,
				size: 620
			});
		}	

		//Slimbox.init({container: el});

		$ES('.myReflect', el).addReflection({opacity:.3});
		$ES('.myReflect_head', el).addReflection({height:.5, opacity:.5});
		$ES('.myReflect_head2', el).addReflection({height:.5, opacity:.5});
		$ES('.myReflect_gross', el).addReflection({height:.2, opacity:.25});

		$ES('a[rel*="ajax-content"]').each(function(el){

			if (el.getProperty('onclick') ) el.setProperty('onclick', '');

			el.addEvent('click', function(evt){
				evt.stop();
				if (this.ajax) return;
				var content = $('ajax-content');
				content.addClass('ajax-loading').setStyle('height', content.scrollHeight + 'px').setHTML('');
				this.ajax = new Ajax (this.href, {
					method: 'get',
					onComplete: function(resp) {
						this.ajax = null;
						content.removeClass('ajax-loading').setStyles({'visibility': 'hidden', 'height': ''});
						content.setHTML(resp);
						Watchdog.update(content);
						content.effect('opacity', {duration: 1000}).start(0, 1).chain(function() { content.setStyles({filter: '', opacity: 1}); });
					}.bind(el)
				}).request();

			}.bindWithEvent(el));
		});
	}
};