var modal = null;	
var show_full = false;
var flash_next_handler = function(id) {}
var flash_click_handler = function(id) {}
var video_id = null;
var last_click = 0;
window.addEvent('domready', function() {

	flash_next_handler = function (id) {
		if (flash_rotation == 0) {
			if ($('flash_img_' + id) != null) {
			/*	$('next_div').innerHTML = ('Next call: ' + id);*/
				$$('.flash_imgs').setStyle('display', 'none');
				$('flash_img_' + id).setStyle('display', 'block');
			}
		}

	}
	$$('a').addEvent('click', function (e) {
	
		if (this.get('onclick') == null && this.get('href') != '#' && this.get('href') != 'javascript://') {
			if (this.get('target') == null) {
				e = new Event(e).stop();				
				$('marquee').set('html', '');
				$('flash_div').set('html', '');
				location.href = this.get('href');
			} else {
				return true;
			}				
		}	
	});
	flash_click_handler = function (id) {
		var time_now = new Date().getTime(); 
		if (time_now - last_click <= 100) {
			return;
		}			
		last_click = time_now;

		if (flash_rotation == 1) {
		
			video_id = id;
			if (modal != null) {
				modal.load('/Empty.html');
				modal.close();
			}
			if	(header_videos_types[video_id] == 1) {			
				modal = new LightFace.IFrame({ 
				height: header_videos_heights[video_id], 
				width: header_videos_widths[video_id], 
				url: header_videos_urls[video_id], 
				title: header_videos_titles[video_id] 
				}).addButton('Schließen', function() {
					this.load('/Empty.html');
				  this.close(); 
				},true).open();	
			}	
			if	(header_videos_types[video_id] == 2) {			
				modal = new LightFace({ 
				content: header_videos_contents[video_id], 
				title: header_videos_titles[video_id] 
				}).addButton('Schließen', function() {
					this.load('');
				  this.close(); 
				},true).open();	
			}					
		
		} else {	
			if (show_full == false) {
				$('preview_img').setStyle('position', 'absolute');
				$('preview_img').setStyle('display', 'block');
				$('preview_img').setStyle('top', (parseInt($('flash_div').getPosition().y) + 210)); // + 153 -65
				$('preview_img').setStyle('left', (parseInt($('flash_div').getPosition().x) ));
				
			} else {
				$('preview_img').setStyle('display', 'none');
			}
			show_full = !show_full;
			/*$('click_div').innerHTML = ('Click call: ' + id);*/
		}
		/*return true;*/
	}	
	
	if (flash_rotation == 0) {
		$('preview_img').addEvent('click', function() {
			$(this).setStyle('display', 'none');
		});		
	}
	
	
	$$('ul#main_nav li a').each(function(ele) {
		ele.setStyle('opacity', 0.0001);
		ele.setStyle('background-image', 'url({/literal}{$www}{#www_images#}/user/layout_relaunch/header_links_aktiv.jpg{literal})');
		ele.addEvent('mouseenter', function() {
			this.tween('opacity', 1.0);				
		});
		ele.addEvent('mouseleave', function() {
			this.tween('opacity', 0.0001);				
		});			
	});	
});




var flash_m = function() {
	
		var flash = '<object id="obj" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="592" height="153" id="sharkyou_header" align="middle" wmode="transparent">' +
					'<param name="allowScriptAccess" value="always" />' +				
					'<param name="allowFullScreen" value="false" />' +
					'<param name="wmode" value="transparent" />' +
					'<param name="movie" value="' + flash_header + '" /><param name="quality" value="high" /><param name="bgcolor" value="#FFFFFF" />	<embed src="' + flash_header + '" quality="high" bgcolor="#FFFFFF" width="592" height="153" name="sharkyou_header" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_de"  wmode="transparent" />{literal}' +
					'</object>';				
		$('flash_div').set('html', flash);	

	}
window.addEvent('load', function() {
	$('marquee').setStyle('display', 'block');
	if (show_stempel) {
		var flash_f = function()  {
			var mpos = $('top_header').getPosition();
			var style='position: absolute; top: ' + (mpos.y - 1) +'px; left: ' + mpos.x +'px; z-index: 1000';
			var flash='<object style="' + style + '" id="flash_intro" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="246" height="184" id="header_links_3" align="middle" wmode="transparent">' +
				'<param name="allowScriptAccess" value="always" />' +
				'<param name="allowFullScreen" value="false" />' +					
				'<param name="movie" value="/header_links_3.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	<embed src="/header_links_3.swf" quality="high" bgcolor="#ffffff" width="246" height="184" name="header_links_3" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_de" wmode="transparent" /></object>';
			$('marquee').set('html', flash);	
		};
		flash_f.delay(1000);
	}
	
});

window.addEvent('load', function() {
	flash_m.attempt();		
});	
