window.addEvent('domready', function() {

	// Globale Info
	if($('globalinfo') !== null) {
		$('globalinfo').show(); // auskommentieren um abzuschalten
		$('closelink').addEvent('click',function(e){
			e.stop();
			$('globalinfo').hide();
		});
	}


    // hand auf logo
	$('logo').setStyle('cursor', 'pointer');
	
	// basis-URL setzen
	$('logo').addEvent('click',function(){
		location.href = jsBaseURL;
	});
	


	// bildvergroesserung: imagezoom.js und imagezoom.css
	if ($('lightbox')) {
		initImageZoom({
			rel: 'lightbox',
			loadImage: jsBaseURL+'public/css/imagezoom_images/loading.gif',
			overlay: false,
			showCaptionBar: false
		});
	};


	// Tooltips Rechtsformen-Matrix
	
	$$('.tooltip').addEvents({
		mouseenter: function() {
			this.setStyle('backgroundColor','#ccc');
		},
		mouseleave: function() {
			this.setStyle('backgroundColor','#ececec');
		}
	});
	
	var myTips = new Tips('.tooltip', {
		className: 'thetip',
		fixed: true,
		offset: {'x': 32, 'y': 32}
	});
	



	// bildwechsel
	$$('.imgtop').set('opacity', 1).addEvents({
		mouseenter: function(){
			// This morphes the opacity and backgroundColor
			this.morph({
				'opacity': 0.1
			});
		},
		mouseleave: function(){
			// Morphes back to the original style
			this.morph({
				opacity: 1
			});
		}
	});
	
	// REGISTERAUSKUNFT TEASER
	if($('registercheck') !== null) {
		
		$('registercheck-form').addEvent('submit', function(e) {
			e.stop();
		});
		
			var value = startvalue = $('regcheck-tf').value;
			
			$('regcheck-tf').addEvent('focus',function(e){
				value = this.value;
				this.value = '';
			});
			
			$('regcheck-tf').addEvent('blur',function(e){
				if(this.value === '') {
					this.value = value;
				}
			});
			
			// Cookie mit Name der Gesellschaft setzen
			$('checkreg-button').addEvent('click', function(e) {
				//e.stop();
				if($('regcheck-tf').value !== startvalue){
					Cookie.write('gesname', $('regcheck-tf').value, {path:'/Extras/'});
				}
			});
	}
	
	// Footer Forislinks
	
	$('forisgruppe').addEvent('mouseenter',function(){
		$$('.forislinks').show();
	});
	
	$$('.forislinks').addEvent('mouseleave',function(){
		this.hide();
	});
	
});

