window.addEvent('domready', function(){

  /**
   * The easy way:
   * > ReMooz.initialize(); // searches for "a.remooz" and adds remooz class
   * 
   * Change query this way
   * > ReMooz.options.query = 'a[rel^=remooz], img[rel^=remooz]';
   * Now images and links with rel attrbute beginning with remooz are fetched
   * 
   * You can also define options, json encoded in the rel attribute
   * <a href="more.jpg" class="remooz" rel="{resize:false}"></a>
   * 
   * 
   * This example creates classes manual
   */

	$$('.remooz img').each(function(img, i) {
		new ReMooz(img, {
			url: img.getParent().rel,
			resizeLimit: {x: 640, y: 640},
			resizeOpacity: 0.4,
			positionToCenter: true,
			hideSource: false,
			resizeOptions: {
				transition: Fx.Transitions.Back.easeOut
			}
		});
	});
	
	if ($('countdown')) {
		var start = new Date(2010, 0, 30, 20);
		var countdown = function countdown() {
			now = new Date;

			if (now > start) {
				$('countdown').innerHTML = over;
				clear(this);
				return;
			}

			left = (start.getTime() - now.getTime())/1000;
			
			days = Math.floor(left / 86400);
			left = left - days * 86400;
			
			hours = Math.floor(left / 3600);
			left = left - hours * 3600;
			
			minutes = Math.floor(left / 60);
			seconds = Math.floor(left - minutes * 60);
		
			$('count_days').innerHTML = days;
			$('count_hours').innerHTML = hours;
			$('count_minutes').innerHTML = minutes;
			$('count_seconds').innerHTML = seconds;
		}

		countdown.periodical(1000);
	}
});