var setWebTrekk = function(){
	
	        var webtrekk = new Array();
			
			$(document.body).getElements('li.akt a').each(function(obj,nr){
			
			       if($(obj.parentNode).get('class') == 'akt')
			       if(obj.getElement('span'))
			       webtrekk.push(obj.getElement('span').get('html').replace(/&amp;/,'und'));
				   else
				   webtrekk.push(obj.get('html').replace(/&amp;/,'und'));
			
			});
			
            return webtrekk.join('.');
	
	}



var initHovers = function(el){


     $(document.body).getElements('a').each(function(obj,nr){
	 
	    obj.stopEvents = false;
	 	obj.addEvent('focus',function(){this.blur();});
	 });
     $(el).getElements('li.pass').each(function(obj,nr){
	 
	 	
		obj.addEvent('mouseenter',function(){
		
			if(!this.stopEvents)this.className = 'akt';
				
		});
		
		obj.addEvent('mouseleave',function(){
		
			if(!this.stopEvents)this.className = 'pass';
				
		});
	 
	 });

}



var showMenue = function(t,obj){


			var tags = '#'+t+',#'+t+'r';
			
			
			$(t+'r').getElements('a')[0].href = obj.getElements('a')[0].href;
			
			
			
			
			obj.addEvent('mouseenter',function(){
			
				$(document.body).getElements(tags).setStyle('display','block');
			
			});
			obj.addEvent('mouseleave',function(){

				$(document.body).getElements(tags).setStyle('display','none');
			});
			if(obj.className == 'akt') active = true;
			
			$(document.body).getElements(tags).addEvents({
			
			
						'mouseenter': function(){$(document.body).getElements(tags).setStyle('display','block');},
						'mouseleave': function(){$(document.body).getElements(tags).setStyle('display','none');}
			
			
			});

           
}



var initPulldown = function(){

	
   
		$('subnavigation').getElements('li').each(function(obj,nr){
	
	    if(nr == 0 || nr == 1 || nr == 2)
		obj.stopEvents = true;
	
		switch(nr){
		
			case 0:     try{showMenue('tabpp',obj);}catch(e){}; break;
			case 1:     try{showMenue('tabbl',obj);}catch(e){}; break;
			case 2:     try{showMenue('tabkb',obj);}catch(e){}; break;
		}
	
	
	});
	
	try{
	$(document.body).getElements('.reiter-oben li').each(function(obj,nr){
	
	
			switch(nr){
			
				case 1: 
				ref = obj.getElements('a')[0].href;
				$('tabgk').getElements('a')[0].href = ref;
				obj.addEvent('mouseenter',function(){$('tabgk').style.display = 'block';});
				obj.addEvent('mouseleave', function(){$('tabgk').style.display = 'none';});
				$('tabgk').addEvent('mouseenter',function(){this.style.display = 'block';});
				$('tabgk').addEvent('mouseleave',function(){this.style.display = 'none';});
				break;

			
			}
			
	});
	}catch(e){}

}





$extend(Browser, {
	fixPNG: function(el) {
		if (Browser.Engine.trident){
			el = document.id(el);
			var w = el.getStyle('width');
			var h = el.getStyle('height');
			var imgURL = el.getStyle('background');
			if (imgURL.test(/\((.+)\)/)){
				el.setStyle('background', '');
 
				var subEl = new Element('div', {
					'style': 'width: ' + w + ';' +
					'height: ' + h + ';' +
					"filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='crop', src='" + imgURL.match(/\((.+)\)/)[1] + "');"							
				});	
				el.grab(subEl);							
			};
		}
	}
});




var initForms = function(){

    var display = function(obj){
	
			obj.addEvent('click',function(){
			
			
			    
				obj.href= 'javascript:void(0)';
				$('dynforms').getElements('span').each(function(obj,nr){obj.style.display = 'none';});
				$('dynforms').getElements('form').each(function(obj,nr){obj.style.display = 'none';});
				$('dynforms').getElements('form.'+obj.className)[0].style.display = 'block';
				$('dynforms').getElements('span.'+obj.className)[0].style.display = 'block';});
				
				
	
	}

	$('service-icons').getElements('a').each(function(obj,nr){
		switch(nr){
			case 1: display(obj);break;
			case 2: display(obj);break;
			case 3: 
			if(obj.get('class') == 'newsletter') display(obj);
			if(obj.get('class') == 'webmail') display(obj);
			break;
			case 4: 
			if(obj.get('class') == 'newsletter') display(obj);
			if(obj.get('class') == 'webmail') display(obj);
			break;
			}

	});
	$('dynforms').getElements('form').each(function(obj,nr){
	
		obj.getElements('img.closeform')[0].addEvent('click',function(){
		
		        obj.parentNode.getElements('span.'+obj.className)[0].style.display = 'none';
				obj.style.display = 'none';
		});
		
	});

}



var hardware = new Class({


		initialize: function(el,el2){
			
			produkte = $(el).getElements(el2);

		},
		
		
		displayProducts: function(obj,selector){
				
				
				var tabs = obj.getElements(selector);
				var cont = obj.getElements('div.dyncontent div.dynamic');
				
				tabs.each(function(obj,nr){
				
					obj.addEvent('click',function(){ 
					
					    tabs.each(function(obj,nr){obj.className = 'tab-'+(nr+1)});
						tabs[nr].className = tabs[nr].className+'a';
					    cont.each(function(obj,nr){obj.style.display = 'none';});
						cont[nr].style.display = 'block';
					});
				
				});
				
			},
		
		
		
		start: function(selector){
		
				produkte.each(function(obj,nr){
					this.displayProducts(obj,selector);
				}.bind(this));
				
		}
		
		
		



});

	function initAccordeon(selector)
	{
	
	$(document.body).getElements(selector).each(function(obj,nr){
	
	new Accordion(obj, 'h3.toggler', 'div.element', 
	{
	
	    alwaysHide:true,
		opacity: false,
		onActive: function(toggler, element)
		{
			toggler.removeClass('passiv');
			toggler.addClass('aktiv');
			
		},
		onBackground: function(toggler, element)
		{
			toggler.removeClass('aktiv');
			toggler.addClass('passiv');
		}
	});
	});
	}
	
	
	var initBaskets = function(RssFeed){


	var req = new Request({

		url: RssFeed,

		onSuccess: function(txt){
		
			try{
			$('result').set('html', txt);
			}
			catch(e){}
		},

		onFailure: function(){
		
			try{
			// alert(RssFeed);
			$('result').set('text', 'Die RSS Inhalte werden nur Live ausgegeben.');
			}
			catch(e){}
		}

	});

	window.addEvent('domready', function(){
		req.send();
	});

}



// ################ Bundesliga #################

var initBundesliga = function(urlTabelle,inWelchenDivSchreiben){


	var req = new Request({


		url: urlTabelle,

		onSuccess: function(txt){
		
			try{
			$(inWelchenDivSchreiben).set('html', txt);
			}
			catch(e){}
		},

		onFailure: function(){
		
			try{
			$(inWelchenDivSchreiben).set('text', 'Die Tabelle wird nur Live ausgegeben.');
			}
			catch(e){}
		}

	});

	window.addEvent('domready', function(){
		req.send();
	});
}
	
// ################ /Bundesliga #################

	
	
	var SortIt = new Class({
	
	    /*
		Numerische und alphabetische Sortierung von DOM-Objekten
		Autor: Carsten Meyer, HMMH AG
		*/
	
		initialize: function(id,sortelement,sortbyeelemnt){
		
			myID = id;
			callback1 = function(a,b){return parseFloat(a.getElements(sortbyeelemnt)[0].get('html')) - parseFloat(b.getElements(sortbyeelemnt)[0].get('html'));}
			callback2 = function(a,b){return parseFloat(b.getElements(sortbyeelemnt)[0].get('html')) - parseFloat(a.getElements(sortbyeelemnt)[0].get('html'));}
			callback3 = function(a,b){return (a.getElements(sortbyeelemnt)[0].get('html') > b.getElements(sortbyeelemnt)[0].get('html') ) ? -1 : 1 ;}
			callback4 = function(a,b){return (a.getElements(sortbyeelemnt)[0].get('html') < b.getElements(sortbyeelemnt)[0].get('html') ) ? -1 : 1 ;}
			arr = $(id).getElements(sortelement);
	
		},
		
		descendNumeric: function() {arr.sort(callback2);arr.each(function(obj,nr){obj.inject(myID);});},
		ascendNumeric:  function() {arr.sort(callback1);arr.each(function(obj,nr){obj.inject(myID);});},
		descendAscii:   function() {arr.sort(callback3);arr.each(function(obj,nr){obj.inject(myID);});},
		ascendAscii:    function() {arr.sort(callback4);arr.each(function(obj,nr){obj.inject(myID);});}
	
	});
	
	
	var DOMFilter = new Class({

		
		initialize: function(id,felement,critel){
		
		     myID = id;
			 myFilter = critel;
			 arr = $(id).getElements(felement);
			 
			 
		},
		
		filter: function(filter){
		
		
		    arr.each(function(obj,nr){obj.setStyle('display','none');});
			arr.each(function(obj,nr){
			
			    filter.each(function(element,nr){
			    if (obj.getElements(myFilter)[0].get('html') == element)
				obj.setStyle('display','block');
				});
			});
		
		
		},
		
		showAll: function(){
		
			arr.each(function(obj,nr){obj.setStyle('display','block');});
		
		}
});



var showManufacturer = function(el){

			var d = new DOMFilter('produkte-handys','div.handy','span.hersteller');
			    
				if(el.selectedIndex == 0) d.showAll();
				else{
				
					d.filter(new Array(el[el.selectedIndex].value));
				}

}




var CheckBoxFilter = new Class({
	
	initialize: function(f){
	    
		
		form = f;
		attributes = new Array();
		selection = $(f).getElements('select[name=hersteller]')[0];
		checkboxes =  $(f).getElements('input[type=checkbox]');
		checkboxes.each(function(obj,nr){
	
			if(obj.checked)
			attributes.push(obj.name);
		});
	
		test = function(arr){
			
			var check = true;
			attributes.each(function(obj,nr){
				
				if(!arr.contains(obj)) check = false;
					
			});
			return check;
		},
		test2 = function(obj){
		
			if(selection.selectedIndex == 0) return true;
			manufacturerSelected = selection[selection.selectedIndex].value;
		    manufacturer = obj.getElements('span.hersteller')[0].get('html');
			if(manufacturerSelected == manufacturer) return true;
			return false;
		}
		
	},
	
	checkFeatures: function(id,selector,element){
				
			
		$(id).getElements(selector).each(function(obj,nr){
	
			obj.setStyle('display','none');
			var str = obj.getElements(element)[0].get('html');
			    
			    arr = str.split(','); 
			    if(test(arr) && test2(obj)){
			    	
			    	obj.setStyle('display','block');
			    }
		});
	}
	

	
	
});


var Tarife = new Class({


	initialize: function(obj){
	
		counter = 0;
	    myObj = obj;
		repeat = this.setTarife;
	
		
		getTarifinfo = function(nr){
		
		    return '<h5 style="margin:5px;">'+$('dt'+nr).get('html')+'</h5>'+$('dd'+nr).get('html');
		}
	
	},
	
	


	
setTarife: function(){
	

	
	var req = new Request({
		method: 'get',
		url: myObj[counter].file,
		onComplete: function(responseText, responseXML){

		
	try{
	var displayTarif = $(myObj[counter].select.parentNode).getElements('div.tarifinfo')[0];
	displayTarif.addEvent('click',function(){$(this).setStyle('display','none');});
	var content = displayTarif.getElement('div.content');
	}
	catch(e){displayTarif = null;content = null;}
	
	//myObj[counter].select.set('html','<option>Tarif w&auml;hlen</option>');
	
	
	myObj[counter].select.addEvent('change', function(){

		
		
		if(displayTarif){
			if(this.selectedIndex == 0)
			displayTarif.setStyle('display','none');
			else{
			displayTarif.setStyle('display','block');
			metaData = getTarifinfo(this[this.selectedIndex].value);
			content.set('html','<!--a href="javascript:void(0);" style="float:right;" onclick="this.parentNode.style.display=\'none\'">[x]</a-->'+metaData);
			}
		}
		
		
	});
		
		
			counter++;
			if(counter < myObj.length) repeat();
		}
			
		}
		
		).send();
	
	
}


});



	var Carousel = new Class({



	initialize: function(id,el){
	
	
	    	if(Browser.Engine.trident){
	
				if(Browser.Engine.version < 5) this.browserie6 = true;
				else this.browserie6= false;
			}
			else
			this.browserie6 = false;
		
		this.oldbrowserie = false;
		
	    this.timeout = 5000;
		this.timer = null;
		
		this.elements = $(id).getElements(el);
		
		this.elements.each(function(obj,nr){
		if(!this.oldbrowserie)
		obj.setStyles({'opacity':0 , 'display':'block'});
		else
		obj.setStyles({'display':'none'});
		obj.set('tween', {duration: 1500});
		});
		
		linkselector = 'div.navi a';

		this.links = $(id).getElements(linkselector);
		this.links.each(function(obj,nr){
		         
				obj.set('html',this.elements[nr].getElements('h1')[0].get('html'));
			    obj.set('href','javascript:void(0)');
				obj.addEvent('click',function(){this.gototab(nr);}.bind(this));
		
		}.bind(this));
		
		
		this.maxcount = this.links.length;

		this.current = 0;
		this.next = this.current + 1;
		
		reapeat = function(){this.getNext();}.bind(this)
	    
	},
	
	getNext: function(){
		
		    clearTimeout(this.timer);
			this.current++;
			this.next++;

			
			if(this.next == this.maxcount)    {this.next = 0;}
			if(this.current == this.maxcount) {this.current = 0;}
			
			
			if(this.browserie6){
			this.links.each(function(obj,nr){obj.removeClass('aktie6');});
			this.links[this.next].addClass('aktie6');
			}
			else
			{
			this.links.each(function(obj,nr){obj.removeClass('akt');});
			this.links[this.next].addClass('akt');
			}
			
			
			if(!this.oldbrowserie)
			{
				this.elements[this.next].fade('in');
				this.elements[this.current].fade('out');
			}
			else
			{
				this.elements[this.next].setStyle('display','block');
				this.elements[this.current].setStyle('display','none');
			}

			this.timer = setTimeout(reapeat,this.timeout);
		},
	
	scramble:  function(){
		
			this.current++;
			this.next++;
			
			if(this.next == this.maxcount) {this.next = 0;}
			if(this.current == this.maxcount) {this.current = 0;}
		
		},
	
	start: function(r){
	
	if(r)
	{   
	    rand = Math.round(Math.random()*this.maxcount); 
		for(var i= 0; i < rand; i++)
	    this.scramble();
		this.getNext();
	}
	else
	this.getNext();
	
	
	},
	gototab: function(nr){clearTimeout(this.timer);while(this.next != nr)this.getNext();},
	setDelay: function(t){ this.timeout = t;},
	repeat: function(){this.getNext();}

});



var startCarousel = function(zufall){
	
			   var caroussel = new Carousel('caroussel','.entry');
		       caroussel.setDelay(6000);
		       caroussel.gototab(0);

}





var setContentNav = function(nr){


        
        var nav = $(document.body).getElement('div.content-nav');
            nav.getElements('li').each(function(obj,i){
       
                if(nr == i) obj.set('class','akt');
                else
                obj.set('class','pass');

         });

}



var setEffectShadow = function(el,pos,color,opacity){

/*
Erzeugt einen schwarzen Schlagschatten
*/

		$(document.body).getElements(el).each(function(obj,nr){
		
			var text = obj.get('html');
			           obj.set('html','');
			           obj.setStyle('position','relative');
			var elcolor = obj.getStyle('color');
			var fsize = obj.getStyle('font-size');

			
					   
			var bg = new Element('span',{
			
			html: text,
			styles:
			{
			color:color,
			position:'absolute',
			left:pos[0]+'px',
			top:pos[1]+'px',
			fontSize:fsize,
			opacity:opacity
			}
			
			});
			   
			var fg = new Element('span',{
			html: text,			
			styles:
			{
			fontSize:fsize,
			color:elcolor,
			position:'absolute'
			}
			});
			
			bg.inject(obj);fg.inject(obj);
			
		});

}		


var initBrowser = function(){

    
      if(Browser.Engine.trident && Browser.Engine.version < 5)
      $(document.body).getElements('div.oldbrowser').setStyle('display','block');
	  else
	  $(document.body).getElements('div.newbrowser').setStyle('display','block');

}	



          
          var showDisclaimer = function(numbers){
                
                    var entries = $('hinweise').getElements('div.fn');
                    $('hinweise').getElements('div.fn span.nr').each(function(obj,nr){
                    
                            
                            if(numbers.contains(obj.get('html').toInt()))
                            entries[nr].setStyle('display','block');
                            else
                            entries[nr].setStyle('display','none');
                    
                    });
                    
                    $('hinweise').setStyle('display','block');
          
          }

	     var getDisclaimer = function(ref,numbers){
	
			 if($('hinweise').getStyle('display') == 'block')
			 {
			 			$('hinweise').setStyle('display','none');
			            return false;
			 }	
			 else
			 if($('hinweise').getStyle('display') == 'none')
			 $('hinweise').setStyle('display','block');
		     
			 try{var loaded = $('hinweise').isLoaded;}catch(e){loaded = false;}
		     
			 if(!loaded)
		  		new Request({
				
						url: ref,
						onSuccess: function(responseText,responseXML){
						
						
						        $('hinweise').set('html','');
								$('hinweise').isLoaded = true;
								var div = new Element('div');
						            div.set('html',responseText);
									
									
									var entries = div.getElements('div.fn'); 
                                    div.getElements('div.fn span.nr').each(function(obj,nr){
                    
                                       
									    zahl = obj.get('html').toInt();
                            			if(numbers.contains(zahl))
                                        entries[nr].inject($('hinweise'));
										
                                        if(zahl == 9999 && numbers.length > 0)
                                        entries[nr].inject($('hinweise'));
                    
                    				});
									
									
									
						}
				
				}).send();
			
		//  $('hinweise').setStyle('display','block');
		//  $('disc-ausblenden').setStyle('display','block');
		//  $('disc-einblenden').setStyle('display','none');
		  
		  }
		  
		  
		 var hideDisclaimer = function(numbers){
         $('hinweise').setStyle('display','none');
		 $('disc-ausblenden').setStyle('display','none');
		 $('disc-einblenden').setStyle('display','block');
		  }

		  
		  

		var setBreadcrumb = function(){
	
	        var breadcrumb = new Array();
			

			var elements = $(document.body).getElements('li.akt a');
			elements.each(function(obj,nr){
			
			       if($(obj.parentNode).get('class') == 'akt')
				   {
			       if(obj.getElement('span'))
			       var a = new Element('a',{'html':obj.getElement('span').get('html'),'href':obj.get('href')});
     			   else
				   var a = new Element('a',{'html':obj.get('html'),'href':obj.get('href')});	
				   breadcrumb.push(a); 
 				   breadcrumb.push(new Element('span',{'html':'&nbsp;&gt;&nbsp;'}));	 
				   }   
			
			});
			breadcrumb.pop();
			breadcrumb.each(function(el,nr){el.inject($('breadcrumb'))});
            
	
	}		
	
	
	

	
	
	
var IframeModal = new Class({



	initialize: function(url,w,h,title){
	
	
			this.url = url;
			this.width = w;
			this.height = h;
			this.title = title;
			
			
			this.close = new Element('a',{
                    
                        html: 'Fenster schlie&szlig;en',
                        href: 'javascript:void(0)',
                        styles:{
                        
                              'position': 'absolute',
                              'right': '10px',
                              'top': '10px',
							  'z-index':1020
                        }
                    
            });
            this.close.set('class','modalclose'); 
			
			this.center = new Element('div',{
                    
                            id: 'modalForeground',
                            styles:{
                            
                                 'position':'absolute',
                                 'z-index':1010,
                                 'width': '100%',
								 'height': $(document.body).getSize().y+'px',
                                 'top': $(document.body).getScroll().y + 20 + 'px',
								 'left': '0px'
								 
                            }
                    
            });
			
			this.div = new Element('div',{
                        
                        styles: {
                          'background-color':'#ffffff',
                          'margin': '0px auto',
                          'opacity':0,
						  'position':'relative',
						  'text-align':'left',
						  'width':  this.width + 40 + 'px',
						  'height': this.height + 80 + 'px'
                        }
            });
			
			
			this.iframe = new Element('iframe',{
			
					src: this.url,
					name:'iframe',
					height: this.height,
					width: this.width,
					border: 0,
					frameborder:0,
					styles:{
					    'position':'absolute',
						'left': '20px',
						'top': '60px',
						'margin' : '0px',
						'padding' : '0px',
						'border' : '0px',
						'width':  this.width +  'px',
						'height': this.height  + 'px',
						'border': 'solid 1px #eeeeee'
					}
					
			
			});
			
			this.headline = new Element('h3',{
                    
                        html: this.title,
                        styles:{
                        
                          'position': 'absolute',
                          'left': '20px',
                          'top': '20px',
						  'text-align':'left',
						  'width': this.width + 'px'
                        
                        }
                    });
			
			this.headline.set('class','modal');
	
	},
	
	setStyles: function(styles){
	
	       this.iframe.setStyles(styles);
	
	},
	
	setBorder: function(color){
	
			this.iframe.setStyle('border','solid 1px '+color);
	},
	start: function(){
	
			 
			      
			            
			            this.iframe.inject(this.div);
						this.headline.inject(this.div);
			       		this.close.inject(this.div,'top');
						this.div.inject(this.center);
                        this.center.inject($(document.body));
						this.div.fade('in');
						
						this.close.addEvent('click',function(){
                          
                                 $('modalOverlay').fade('out');
                                 this.div.get('tween', {property: 'opacity', duration: 'long',onComplete:function(){
                                 
                                 this.center.dispose();                 
                                 $('modalOverlay').fireEvent('click');
                                 
                        }.bind(this)}).start(1,0);
                                 
                          
                       }.bind(this));	
						
			 
              		this.modalShow({
                    
                              modalStyle:{
                                'background-color':'#000000',
                                'opacity':0.3,
                                'position':'absolute',
                                'z-index':1000
                              }
                   });

	
	}




}).implement(new Modalizer);
	
	
	
	
	
	
var setNewsletter = function(obj){

      
        var regemail = /^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$/;
		
		
		if(!regemail.test($(obj).getElement('input[name=email]').get('value')))
        $(obj).getElement('input[name=email]').set('value','');

        $(obj).set('target','iframe'); 
        var i = new IframeModal('#',730,570,'NEWSLETTER ANMELDUNG');
		i.setStyles({'border':'solid 1px #ffffff'});
		i.start();
        obj.submit();
}
	
	
	
      var  isInitRealPersonScript = 0;
      var  optiRealPersonLoad = function(deptid) {
	  
       try{

			var optiRealPersonScript = new Element('script',{
		
			'type': 'text/javascript',
			'src' : 'https://realperson20.net/system/scripts/rp_status.php?systemurl=https://realperson20.net/system&project=ewetel&aspid=1&deptid='+deptid
		
		
		});
		
		optiRealPersonScript.inject($('optiRealPersonContent'));
		
		$('onlineberater').setStyle('visibility','visible');
        $('onlineberater').addEvent('click',function(){$('optiRealPersonContent').getElement('a').onclick();});
		
		try{
		$('dsl-onlineberater').setStyle('display','inline');
        $('dsl-onlineberater').addEvent('click',function(){$('optiRealPersonContent').getElement('a').onclick();});
		}catch(e){}
		
        
       }catch(e){

        
        $('onlineberater').setStyle('visibility','hidden');
		
		try{$('dsl-onlineberater').setStyle('display','none');}catch(e){}
		
		
        //$('onlineberater').addEvent('click',function(){alert('Service zur Zeit nicht verfügbar!');});

      }
      }
	
	
			 var iesuperfix = function(){
			 
			 
			            if(Browser.Engine.trident)
			 			$(document.body).getElements('sup').each(function(obj,nr){
												        
								
								h = $(obj.parentNode).getSize().y;
								var span = new Element('span',{'styles':{'position':'relative','height':h+'px'}});
								obj.setStyles({
										
									'position':'absolute',
									'top': '0px'
								});
								span.inject(obj,'after');
								obj.inject(span);
						
						});
			 
			 }
	
	
var testreal = function(){

    try{
	r = $('optiRealPersonContent').getElement('a').get('href');
	}catch(e){
	$('onlineberater').setStyle('visibility','hidden');
	try{$('dsl-onlineberater').setStyle('display','none');}catch(e){}
	}

}

var startHelpDesk = function()
{
    try{
	startHelpDeskRealPerson(1);
	}
	catch(e){
	
		alert('Der Live-Chat ist derzeit offline. Bitte versuchen Sie es zu einem anderen Zeitpunkt noch einmal.');
	}

}

	
						
window.addEvent('domready', function(event){

   
    var fpipes = $('footer').getElements('li.abst');
    fpipes[fpipes.length-1].dispose();

    try{ $('fnewsletter').addEvent('submit',function(){setNewsletter(this);});}catch(e){/* kein Newsletterformular */}
    setBreadcrumb();
	wt_be = setWebTrekk(); 
    // if(typeof(wt_sendinfo) != "undefined")wt_sendinfo(); 
	/* auskommentiert am 20.08.2010, da Aufruf bereits in Seite */
    initBrowser();
	$(document.body).getElements('input[type=text]').each(function(obj,nr){
	
			obj.defaultvalue = obj.get('value');
	
	});
	
	
	$(document.body).getElements('input[type=text]').addEvent('focus',function(){if(this.defaultvalue == this.value) $(this).set('value',''); });
	
	
	
	
    try {document.execCommand('BackgroundImageCache',false,true); } catch(e){}
	initPulldown();
	try
	{
	initHovers(document.body);
    initForms();
    }
	catch(e){alert(e);}
	
	
	
	try	{hw =   new hardware('produkte-hardware','div.produkt');hw.start('div.hardware-tabs a');}catch(e){}
	try	{tabs = new hardware('produkte-handys','div.handy'); tabs.start('div.hardware-tabs a');}catch(e){}
	try{initAccordeon('div.accordion');}catch(e){}

	try {
		new Lightbox({
		anchors: $$('a.lightbox'), 
		autoScanLinks: false
		});
	} catch(e) {}
	
	setTimeout(testreal,2000);
	//try{iesuperfix();}catch(e){}

});






	var JSONValidator = new Class({
	
	
	
		initialize: function(f)
		{
		
			this.form = $(f);
		    this.send();
		},
		
		setSuccesstext: function(txt){
		
			this.successText = txt;
		
		},
		
		send: function(){
		
		
		    this.form.getElements('label').setStyle('color','');
			this.form.set('send',{
				
				onSuccess: function(txt, xml){
				    
					
					var data = JSON.decode(txt);
					
					
					if(data.error)
					{
						data.errordata.each(function(name,nr){
						    
							this.form.getElement('label[for='+name+']').setStyle('color','red');
						
						}.bind(this));
					
					}
					else
					this.form.set('html',data.successtext);
					
				}.bind(this)

				
				
				}).send();
		
		
		
		
		}

	
	
	}); 



var RequestModal = new Class({



	initialize: function(url,w,h,title){
	
	
			this.url = url;
			this.width = w;
			this.height = h;
			this.title = title;
			
			
			this.close = new Element('a',{
                    
                        html: 'Fenster schlie&szlig;en',
                        href: 'javascript:void(0)',
                        styles:{
                        
                              'position': 'absolute',
                              'right': '10px',
                              'top': '10px',
							  'z-index':1020
                        }
                    
            });
            this.close.set('class','modalclose'); 
			
			this.center = new Element('div',{
                    
                            id: 'modalForeground',
                            styles:{
                            
                                 'position':'absolute',
                                 'z-index':1010,
                                 'width': '100%',
								 'height': $(document.body).getSize().y+'px',
                                 'top': $(document.body).getScroll().y + 20 + 'px',
								 'left': '0px'
								 
                            }
                    
            });
			
			this.div = new Element('div',{
                        
                        styles: {
                          'background-color':'#ffffff',
                          'margin': '0px auto',
                          'opacity':0,
						  'position':'relative',
						  'text-align':'left',
						  'width':  this.width + 40 + 'px',
						  'height': this.height + 80 + 'px'
                        }
            });
			
			
			this.iframe = new Element('iframe',{
			
					src: this.url,
					name:'iframe',
					height: this.height,
					width: this.width,
					border: 0,
					frameborder:0,
					styles:{
					    'position':'absolute',
						'left': '20px',
						'top': '60px',
						'margin' : '0px',
						'padding' : '0px',
						'border' : '0px',
						'width':  this.width +  'px',
						'height': this.height  + 'px',
						'border': 'solid 1px #eeeeee'
					}
					
			
			});
			
			this.headline = new Element('h3',{
                    
                        html: this.title,
                        styles:{
                        
                          'position': 'absolute',
                          'left': '20px',
                          'top': '20px',
						  'text-align':'left',
						  'width': this.width + 'px'
                        
                        }
                    });
			
			this.headline.set('class','modal');
	
	},
	
	setStyles: function(styles){
	
	       this.iframe.setStyles(styles);
	
	},
	
	setBorder: function(color){
	
			this.iframe.setStyle('border','solid 1px '+color);
	},
	start: function(){
	
			 
			            new Request({
						
						url: this.url,
						onSuccess: function(txt){
						    
                            new Element('div',{'html':txt,'styles':{'position':'absolute','left':'20px','top':'80px','padding-right':'20px'}}).inject(this.div);						
						
						
						}.bind(this)
						
						}).send();
			            
                        if(this.title != '')
						this.headline.inject(this.div);
			       		this.close.inject(this.div,'top');
						this.div.inject(this.center);
                        this.center.inject($(document.body));
						this.div.fade('in');
						
						this.close.addEvent('click',function(){
                          
                                 $('modalOverlay').fade('out');
                                 this.div.get('tween', {property: 'opacity', duration: 'long',onComplete:function(){
                                 
                                 this.center.dispose();                 
                                 $('modalOverlay').fireEvent('click');
                                 
                        }.bind(this)}).start(1,0);
                                 
                          
                       }.bind(this));	
						
			 
              		this.modalShow({
                    
                              modalStyle:{
                                'background-color':'#000000',
                                'opacity':0.3,
                                'position':'absolute',
                                'z-index':1000
                              }
                   });

	
	}




}).implement(new Modalizer);
