function showHideLayer(div, to){
	var _div = $(div);
	if(!_div.overlay){
		_div.overlay = new Element('div', {
			id: 'overlay',
			'styles':{
				'z-index': 888
			}
		}).inject(document.body);			
		_div.overlay.fx = new Fx.Tween(_div.overlay, {property: "opacity"});
	}
	if(to == 1){	
		if(Browser.Engine.trident4)
			_div.overlay.setStyles({	
				'position': 'absolute',
				'height': window.getScrollHeight(),
				'width': window.getScrollWidth()					
			});
		_div.overlay.fx.set(0).start(0.4);
		_div.setStyles({
			'position': Browser.Engine.trident4 ? 'absolute' : 'fixed',
			'top': (Browser.Engine.trident4 ? window.getScrollTop() : 0) + (window.getHeight() - _div.getCoordinates().height)/2,
			'left': window.getWidth()/2 - _div.getCoordinates().width/2			
		});
		_div.overlay.addEvent('click', function(){
			_div.overlay.fx.start(0);
			_div.setStyles({
				'top': -1000,
				'left': -1000
			});
			window.removeEvents('scroll');
			window.removeEvents('resize');
		});
		window.addEvent('scroll', function(){
			_div.setStyles({
				'top':  (Browser.Engine.trident4 ? window.getScrollTop() : 0) + (window.getHeight() - _div.getCoordinates().height)/2,
				'left': window.getWidth()/2 - _div.getCoordinates().width/2			
			});
		});
		window.addEvent('resize', function(){
			_div.setStyles({
				'top':  window.getScrollTop() + (window.getHeight() - _div.getCoordinates().height)/2,
				'left': window.getWidth()/2 - _div.getCoordinates().width/2			
			});
		});
	}
	else{
		_div.overlay.fx.start(0);
		_div.setStyles({
			'top': -1000,
			'left': -1000
		});
		window.removeEvents('scroll');
		window.removeEvents('resize');
		
	}
}

///////////////////////////
function initFadeListImages(){
	var listImg = $('slideImg');		
	if(!listImg) return;
	var imgs = listImg.getElements('img');
	var imgCur = 0;
	imgs[0].setStyle('opacity', 1);
	imgs[0].fx = new Fx.Tween(imgs[0], {
		duration: 3000
	});
	if(imgs.length > 2){
		for(var i = 1; i < imgs.length; i++){
			imgs[i].setStyle('opacity', 0).removeClass('hidden');
			imgs[i].fx = new Fx.Tween(imgs[i], {
				duration: 3000
			});
		}
		var lsTimer = setInterval(function(){			
			imgs[imgCur].fx.cancel().start('opacity',[1,0]);
			imgCur = (imgCur < imgs.length - 1)?(imgCur + 1):0;
			imgs[imgCur].fx.cancel().start('opacity',[0,1]);
		}, 4500);	
	}	
}

////////////////////////////
window.addEvent('domready', function(){	
 	//initFadeListImages();
	if($('layerContent')) showHideLayer('layerContent', 1);

 });