window.addEvent('domready', function() {
	
	if(false)
	$('certs').getElements('img').each(function(img) {
		var offimg = img.src;
		var onimg = offimg.replace(/_off/, '');
		var myImage = Asset.image(onimg);
		img.addEvent('mouseenter', function() {
			img.src = onimg;
		});
		img.addEvent('mouseleave', function() {
			img.src = offimg;
		});
	});
	
	var pos = '';
	var checkHeight = function() {
		var height = window.getSize().y;
		if(height < 680) {
			if(pos != 'static') {
				$('left').setStyle('position', 'static');
				pos = 'static';
			}
		}
		else if(pos == 'static') {
			$('left').setStyle('position', null);
			pos = null;
		}
	}
	
	window.addEvent('resize', checkHeight);
	checkHeight();
		
// SlideDDShow
	$$('img').each(function(img) {
		var a = null;
		if(a = img.getParent('a')) {
			if(!a.href) return;
			if(!a.href.match(/(jpg|png|gif)$/)) return;
			var div = a.getParent();
			if(!div.isSlideDD) {
				//console.log(div);
				div.isSlideDD = true;
				new SlideDDShow(div, {
					glow: false,
					margin: 60,
					bgColor: '#eee',
					arrowOpacity: 0.1,
					showOnePic: true,
					speed: 1500,
					
					createTitleDisplay: function(slideDDShow) {
						var titletable = new Element('table');
						var titletablebody = new Element('tbody').inject(titletable);
						var tr = new Element('tr').inject(titletablebody);
						var td = new Element('td', { 
							'class': slideDDShow.options.cssPrefix + "_title_bg_a"
						}).inject(tr);
						td.setHTML(slideDDShow.currentTitle);
						new Element('td', { 
							'class': slideDDShow.options.cssPrefix + "_title_bg_b"
						}).inject(tr);
						titletable.inject(slideDDShow.titlediv);
					},
					
					createTitleBar: function(slideDDShow) {
						var b = new Element('a', {
							'class': 'sdd_close'	
						});
						b.addEvent('click', slideDDShow.close.bind(slideDDShow));
						b.inject(slideDDShow.titlebar);
					}
				});
			}
		}
	});
});
