/* <![CDATA[ */
window.addEvent('domready',function(){
	
	var stopped = 0;
	var waiting = 60000;
	var waitingp = 20000;
	var path = "/files/";
	
	popup = setTimeout(cpopup, waiting);
	
	$$("body").addEvent('mousemove', function() {
		if (stopped == 0) {
			stopCount();
			startCount();
		}
	});
	
	function stopCount() {
		clearTimeout(popup);
	}
	
	function startCount() {
		popup = setTimeout(cpopup, waiting);
	}					
			
	function cpopup(){
		
		stopCount();
		stopped = 1;
		
		if($('grow') != null){
			$('grow').remove();
		}
	
		var content = path+"callsuport.gif";
		maxw = 350;
		maxh = 297;
		
		
		w = window.getSize().size.x.toInt();
		h = window.getSize().size.y.toInt();
		s = window.getScrollTop();
		var middleH = (w) / 2;
		var middleV = (h) / 2;
		var endleft = (w-maxw) / 2;
		var endtop = ((h - maxh) / 2) + s;
	
		var el = new Element('div', {
			 'styles':{
				 width: '1px',
				 height: '1px',
				 position:'absolute',
				 //border:'2px solid #303132',
				 padding:'4px',
				 background:'#666 url('+path+'ajax-loader.gif) no-repeat center center',
				 left:middleH +"px",
				 top:middleV + "px",
				 cursor:'pointer',
				 display:'block',
				 'z-index':100000
			},
			'id': 'grow'
		})
	
		/*$(el).setStyles({
				'-moz-border-radius':'10px',
				'-webkit-border-radius':'10px',
				'border-radius':'10px'
				 });*/
				 
		ww = window.getWidth();
		wh = window.getHeight();
	
		bg = new Element('div',{
		'styles':{
			background:'#000',
			width:ww + 'px',
			height:wh + 'px',
			opacity:'0.4',
			position:'absolute',
			top: window.getScrollTop(),
			left: 0
		},
		'id':'bg'
		})
		
		bg.inject(document.body);
		el.injectInside(document.body);
		
		window.addEvent('scroll',function(){
			$(bg).setStyle('top',window.getScrollTop());
		})
	
		
		
		$("grow").effects({ transition: Fx.Transitions.Bounce.easeOut, duration: 1200, wait:'link', onComplete:function(){
			$(el).setStyle('background','none');
									  
			if(content.indexOf(".jpg") != -1 || content.indexOf(".gif") != -1 || content.indexOf(".png") != -1){
				var img = new Element('img',{				
					'styles': {
						width: maxw,
						height: maxh
					},
					'src': content
				})
			
				img.inject(el);
				
				$(img).setStyles({
					'-moz-border-radius':'10px',
					'-webkit-border-radius':'10px',
					'border-radius':'10px'
				 });
				 
				 img.addEvent('click',function(e){
				 		window.location.href = "http://www.displayhersteller.de/kontakt/";	
				});
				
				
				var cl = new Element('img',{
					'styles':{
						width:'41px',
						height:'38px',
						position:'absolute',
						top:'13px',
						right:'-6px',
						'z-index':'100000'
					},
					'src':path+'closed.gif',
					'id':'closer'
				})	
				
				cl.injectInside(el);
				var eff3 = $("grow").effects({ transition: Fx.Transitions.linear, duration: 1200, wait:'link',onComplete:function(){
					el.remove();
			  	}});
				
				var eff2 = $("grow").effects({ transition: Fx.Transitions.Bounce.easeOut, duration: 1200, wait:'link', onComplete:function(){
					el.remove();
				}});
				
				cl.addEvent('click',function(e){
						e = new Event(e).stop();
						clearTimeout(clpopup);
						stopped = 1;
						bg.remove();
						$(el).getChildren().each(function(el){el.remove()});
						$(el).setStyle('background','#666');
						eff2.start({
						  'width':[maxw,1],
						  'height':[maxh,1],
						  'left': [endleft,middleH],
						  'top':  [endtop, middleV+s]
						 })
				});
				
				clpopup = setTimeout(function(){
						startCount();
						stopped = 0;
						bg.remove();
						$(el).getChildren().each(function(el){el.remove()});
						$(el).setStyle('background','#666');
						eff2.start({
						  'width':[maxw,1],
						  'height':[maxh,1],
						  'left': [endleft,middleH],
						  'top':  [endtop, middleV+s]
						})
						 }, waitingp);
			
			}
		}}).start({
			  'width':[1,maxw],
			  'height':[1,maxh],
			  'left': [middleH,endleft],
			  'top':  [middleV+s, endtop]
			  
			 });
	 	}
 	
 	
})
/* ]]> */