function _$$(o,s){var r=null;$$(s).each(function(i){if(o==i.getParent())r=i;});return r;}
var cwimg = 400, chimg = 300;
var twimg = 320, thimg = 80;
var mwimg = 1280, mhimg = 960;
var clkd = null;
function clean(s){
	if (s!='gallery') { $('gallery').morph({opacity: 0}); $('dgallery').morph({opacity: 0}); $('sgallery').morph({opacity: 0}); }
	else { $('gallery').morph({opacity: .9}); $('dgallery').morph({opacity: .9}); $('sgallery').morph({opacity: .9}); }
	if (s!='rules') $('rules').morph({opacity: 0});
	else $('rules').morph({opacity: .9});
	if (s!='contact') $('contact').morph({opacity: 0});
	else $('contact').morph({opacity: .9});
	if (s!='clients') $('clients').morph({opacity: 0});
	else $('clients').morph({opacity: .9});
	}
var ldd = true;
window.addEvent('domready',function(){
	var crwl = new Fx.Scroll('crawler');
	$('rules').set('morph');
	$('contact').set('morph');
	$('clients').set('morph');
	$('gallery').set('morph');
	$('sgallery').set('morph');
	$('dgallery').set('morph');
	
	$$('#menu li').each(function(l){
		if (l.get('rel')) {
			l.addEvent('click',function(e){
				var crds = this.get('rel').split(',');
				clean(crds.length>2?crds[2]:'');
				crwl.start(Math.floor(crds[0]),Math.floor(crds[1]));
				});
			}
		});
	$('rules').setStyles({opacity: 0});
	$('rules').morph({opacity: .8});
	$('contact').setStyles({opacity: 0});
	$('gallery').setStyles({opacity: 0});
	$('sgallery').setStyles({opacity: 0});
	$('dgallery').setStyles({opacity: 0});
	$('clients').setStyles({opacity: 0});
	
	var rq = new Request.HTML({url:'/gallery.php',method:'get',update:'dgallery'}).send();
	rq.addEvent('success',function(){
		$('prev').addEvent('click',function(e){
			if (this.get('rel')) {
				rq.send('e='+this.get('rel'));
				$('dgallery').morph({opacity: 0});
				}
			});
		$('next').addEvent('click',function(e){
			if (this.get('rel')) {
				rq.send('e='+this.get('rel'));
				$('dgallery').morph({opacity: 0});
				}
			});
		Slimbox.scanPage();
		if (ldd) ldd = false;
		else $('dgallery').morph({opacity: .9});
		});
	});





