//<![CDATA[
	window.addEvents({
		'domready' : function() {
			// print button function
			function pCode(e) {
				//alert(e.keyCode);
				var e = e || window.event;
				var key = (e.keyCode) ? e.keyCode : e.which;
				//	alert(key);
				
				var url = String(window.location);
				var hash = url.indexOf('#');
				var newUrl = hash > 20 ? url.slice(0,hash) :  url;
				if(e.altKey && key==48 ) { window.location="./home.html"; return false;}
				if(e.altKey && key==49 ) { window.location=newUrl+"#main_navi";return false;}
				if(e.altKey && key==50 ) { window.location=newUrl+"#main";return false;}
				if(e.altKey && key==52 ) { window.location="./sitemap.html";return false;}
				if(e.ctrlKey && key==96  ) { return false;}
				if((e.altKey || (e.altKey && e.ctrlKey )) && (key===80 || key === 112 )) {  window.print();}
			}
			//document.onkeydown = pCode;

			

			//Slider function
			if($$('div.slide .slide')) { // run this only if some element has class slide.
			$$('div.slide .slide').each(function(ele, index){
					if(index != 0) { // don't remove padding from 1st element
						ele.setStyle('paddingTop', 0);
					}
					
					//alert(ele.get('html'));
					var classes = ele.get('class').split(" "); // class="slide vs_12";
					var id = classes[1];
					
					var temp = ele.get('html'); 
					ele.set('html','<a href="#">'+temp+'</a>');
					
					$(id).setStyle('padding', '5px 0 16px 0'); // give this style to contiainer Div with id as 'id'
					
					var myVerticalSlide = new Fx.Slide(id);
					myVerticalSlide.hide();
					// attach the event to the link not to the ele.
					var link = ele.getElement('a');
					link.addEvent('click', function(e){
							e.stop();
							myVerticalSlide.toggle();
					});
			}); // end each
			}

			// Links in new window
			var links = $$('a.external_link, a.external_tipz').each(function(link) {
					/*
					link.addEvent(
						'click', function(e) {	
							e.preventDefault();
					    	var newWindow = window.open(link.get('href'));
						    newWindow.focus();									
						});
					*/
					link.setProperty('target','_blank');					
			});

			// Links in Validator
			var ref_links = $$('a.check_referer').each(function(link) {
					var uri = link.getProperty('href');
					link.setProperty('href',uri+'/check/referer');					
			});
						
		
			//store titles and text
			var highlight_ele = $$('accr.tipz, abbr.tipz, a.external_tipz');
			highlight_ele.each( function(element,index) {
						var content = element.get('title');
						element.store('tip:text', content);
						element.store('tip:title', '');
			});
	
			//create the tooltips
			var tipz = new Tips(highlight_ele, {
							className: 'tipz',
							fixed: false,
							hideDelay: 20,
							showDelay: 20
			});
	
			tipz.addEvents({
					'show': function(tip) {
									tip.fade('in');
								},
					'hide': function(tip) {
									tip.fade('out');
								}
			});

			// To highlight the search box, when Alt + 5 Suche link is clicked
			var sucheLinks = $$('a[accesskey=5]').addEvents({
			    'click': function(e){
			    	e.stop();
			       $('keywords').focus();
			    }
			});

			// Navigation subtle Effects 			
			$$('div#main_navi ul.level_1 li a').each(function(e) {						
						e.addEvents({
								'mouseenter': function(){
									this.setStyle('background-color','#fff');
									this.set('morph', {duration: '1000', transition: 'sine:out'});
									this.morph({
											'background-color': '#eee'
									});
								}
						});
				});

			$$('div#main_navi ul.level_1 li a.trail').removeEvents();		

			// change Images funtion
			var img_src;			
			$$('img.flip_image, img.dosomethingwithimage').each(function(img){
						img.addEvents({
								'mouseenter': function() {
									var src = img_src = this.get('src');
									src_parts = src.split('.');
									src = src_parts[0]+'_over.'+src_parts[1];
									this.set('src', src);
								},
								'mouseleave': function(){
									this.set('src', img_src);
								}
						});			
			});
			
			//google search
			function updateLink (){
				this.href = this.href+'rer';
			}
			$$('div.googleSearch').setStyle('display' , 'block');

			$$('div.submitBtn fieldset input').each(function(ele) {
						ele.addEvents({
								'click': function(e){
									e.stopPropagation();
								}
						});
			});
			
			$$('div.submitBtn fieldset').each(function(div) {						
						var val= div.getFirst('input').getProperty('value');
						div.setStyle('cursor' , 'pointer');
						div.addEvents({
								"click" : function(e){
											e.stopPropagation();
											var href="http://www.google.com/search?q="+div.getFirst('input').getProperty('value');
											var googleWin = window.open(href,'google');
									    	googleWin.focus();
										}
						});
						
						div.adopt(
							new Element('button',{type:'button',html:'google suche',value:val,'class':'invisible'}).addEvents({
								"click" : function(e){
											e.stopPropagation();
											var href="http://www.google.com/search?q="+div.getFirst('input').getProperty('value');
											var googleWin = window.open(href,'google');
									    	googleWin.focus();
										}
								})
						);	
			});


			
			//zoom
			if($('zoom')) {
			var zoom = $('zoom');
			var initialFont = Cookie.read('fontsize') || '100';
			//alert('ini' +initialFont);
			var location = window.location;
			var zoomHTML = '<h2>Zoom </h2><ul><li><a href="'+location+'#top" id="plus" title="Grösser">grösser</a></li><li><a href="'+location+'#top" id="one2one" title="Grösse 100%"><span class="invisible">original Grösse</span> 1:1 </a></li><li><a href="'+location+'#top" id="minus" title="Kleiner">kleiner</a></li></ul><span id="percent"> '+initialFont+'%</span>';
			//var fontsize = Cookie.write('fontsize', '100%');
			zoom.set('html', zoomHTML);
			
			//alert(initialFont);
			$(document.body).setStyle('font-size',initialFont+'.1%');
			zoom.getElements('a').each(function(e){
						e.addEvents({
								'click': function(){
										var clicked = this.get('id');
										if(clicked == 'plus') {
											var step = 10;
										} else if(clicked == 'minus' && initialFont > 100) {
											var step = -10;
										} else {
											var step = 0;
										}					
										 
										 if(clicked == 'one2one') {
											var newFontsize =  100;
										}	else {								
											var newFontsize = initialFont.toInt(10) + step.toInt(10);
										}
										//alert(newFontsize);

										$(document.body).setStyle('font-size',newFontsize+'.1%');
										$('percent').set('text','('+newFontsize+'%)');
										initialFont = newFontsize;
										Cookie.dispose('fontsize');
										Cookie.write('fontsize', newFontsize);
									}
									
								})
											
			});
			}
			
			//alert(zoom.getElement('a#plus').get('id'));
			
			
		//	var smartBox = new SmartHoverBox({ //initiate your new class here
		//	xOffset: 2, //set your options in here
		//	lockX: 'left' //set your options in here
		//  });

			
		}//,
	});
//]]>


