window.addEvent('domready', function(){

	var gradient = $$('#abbeys_gradient');
	var border = $$('#abbeys_border');
	var box = $$('#abbeys_anim');
	var abbeys_img = $$('#abbeys_img');
	var close = $$('#abbeys_close');
	
	
	if(gradient[0]&&border[0]&&box[0]){
		$$('body').setStyle('overflow','hidden');
	
		var Width = window.getWidth();
		var Height = window.getHeight();
		var ScrollTop = window.getScrollTop();
		if(window.ie){
			Width = document.documentElement.clientWidth;
			Height = document.documentElement.clientHeight;
			ScrollTop = document.documentElement.scrollTop;
		}

		if((Height - 384)>50){
		border.setStyle('margin-top', Math.round((Height - 421)/2) + ScrollTop);
		}else{
		border.setStyle('margin-top', 50);
		}
		
		abbeys_img.setStyle('opacity', 0);
		
		box.setStyles({
			width: Width, 
			height: Height + 300
		});		
		gradient.setStyles({
			width: Width, 
			height: Height + 300,
			opacity: 0.5
		});		
		var coordinates = {}
		coordinates[0] = {
			'width': '659px',
			'height':'380px'
		} 	
		var efekt = new Fx.Elements(border, {duration: 800,
			onComplete: function(){
			abbeys_img.setStyle('opacity',1);
			close.setStyle('display','block');
			border.addClass('shadow_on');
			}
		});		
		border.setStyle('display','block');	
		efekt.start(coordinates);
		
		box.addEvent('click', function(){
			box.setStyle('display','none');
			$$('body').setStyle('overflow','visible');
		});		
	}
});

