if (!window.console || !console.firebug)
{
	var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml","group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];

	window.console = {};
	for (var i = 0; i < names.length; ++i)
	window.console[names[i]] = function() {}
};



function Werteliste(querystring) {
  if(querystring == '') return;
  var wertestring = unescape(querystring);
  wertestring = wertestring.slice(1);
  var paare = wertestring.split("&");
  for (var i=0; i < paare.length; i++) {
    var name = paare[i].substring(0, paare[i].indexOf("="));
    var wert = paare[i].substring(paare[i].indexOf("=")+1, paare[i].length);
    this[name] = wert;
  }
}

	//var shadow = window.setInterval('check_shadow()', 500);

window.addEvent('domready', function() {
	// HERE IS WHAT YOU READ IN JS CODE
	build_tip_a_friend();
	if ($('wmvvideo')) {
		$('wmvvideo').innerHTML = getPlayer('DrawEventVideo', 320, 240);
	}
	build_scrolling_areas();
	check_for_table_cells_to_display();
	
	if ($('countdown')) {
		
		make_countdown($('countdown'));
		
	};
	
	if ($('slide-news-latest-big')) {
	
		blend_news_one = new NewsBlender('new_blender');
	
	};
	
	//video_player = new flash_video_player();
	
	make_flash_video = new build_new_flash_video_player();
	
	infopanel = new prozess_pdf();
	
	//make_shadow();
	
	build_menu_hover();
	
	exec_fx = new find_fx_content();
	
});

var prozess_pdf = new Class	(
								{
									initialize: function()
									{
										
										this.highlite_storage = new Object;
										this.marginFX_storage = new Object;
										this.infoPanelFX_storage = new Object;
										
										this.find_elements();
										
									},
									
									find_elements: function()
									{
										
										var infopanels = document.getElements('div[class=infopanel]');
										
										infopanels.each(
											function(panel_item,panel_index)
											{
												var temp_ehf_gameID = panel_item.getProperty('gamenr');
												panel_item.setProperty('id', temp_ehf_gameID)
												
												this.build_elements(panel_item,temp_ehf_gameID);
												
												get_it_X('http://www.sportresult.com/sports/hb/HBEM08W/checkPDF.asp?Page=check&fedmatchID='+temp_ehf_gameID+'&target=left_'+temp_ehf_gameID);
												
												console.log(temp_ehf_gameID);
												
												
											}.bind(this)
										);
										
										
									},
									
									show_info_symbol:function(fed_match_id)
									{
										var elem = $(fed_match_id).getParent().setStyle('background-image','url(/fileadmin/templates/EChW2008/img/info.gif)');
										
									},
									
									build_elements:function(element,fed_match_id)
									{
										temp_parent = element.getParent();
										
										this.highlite_storage[fed_match_id] = new Fx.Style(temp_parent, 'background-color', {duration:300});
										this.infoPanelFX_storage[fed_match_id] = new Fx.Style($(fed_match_id), 'height', {duration:300});
										new_elem = new Element	(
																	'div',
																	{
																		'class'	: 'slide',
																		'id'	: 'slide_'+fed_match_id
																	}
																).injectInside(element);
																
										this.marginFX_storage[fed_match_id] = new Fx.Style(new_elem, 'margin-top', {duration:500});
										
										new_left_element = new Element	(
																			'div',
																			{	
																				'id'	:	'left_'+fed_match_id,
																				'class'	:	'left-side'
																			}
																		).injectInside(new_elem);

										new_right_element = new Element	(
																			'div',
																			{ 
																				'id'	:	'right_'+fed_match_id,
																				'class'	:	'right-side'
																			}
																		).injectInside(new_elem);
										
										new_clear_element = new Element	(
																			'div',
																			{ 
																				'class':	'clear'
																			}
																		).injectInside(new_elem);
										
										if (temp_parent.getFirst().getFirst()) {
										
											if (temp_parent.getFirst().getFirst().getFirst()) {
											
												temp_link = temp_parent.getFirst().getFirst().getFirst().getProperty('href');
												
												temp_parent.getFirst().getFirst().innerHTML = temp_parent.getFirst().getFirst().getFirst().innerHTML;
												
												new_link_toreport = new Element('a', {
													'class': 'link-to-match-report',
													'href': temp_link
												}).injectInside(new_right_element);
												
											}
											
										}
										
										this.add_events(temp_parent,fed_match_id)
									
										
									},
									
									add_events:function(elem,fed_match_id)
									{
										elem.addEvent	(
															'mouseenter',
															function()
															{
																this.highlite_up(elem,fed_match_id);
															}.bind(this)
														);
														
										elem.addEvent	(
															'click',
															function()
															{
																this.OpenCloseInfoPanel(elem,fed_match_id);
															}.bind(this)
														);
														
										elem.addEvent	(
															'mouseout',
															function()
															{
																this.highlite_down(elem,fed_match_id);
															}.bind(this)
														);
									},
									
									highlite_up:function(elem,fed_match_id)
									{
										this.highlite_storage[fed_match_id].stop();
										this.highlite_storage[fed_match_id].start('#FEEFC4', '#FFFFFF');
										
										if	(
												($('left_' + fed_match_id).innerHTML != '') 
												||
												($('right_' + fed_match_id).innerHTML != '')
											) 
										{
											elem.setStyle('background-position','0px 5px');
											elem.setStyle('background-repeat','no-repeat');
											elem.setStyle('background-image','url(/fileadmin/templates/EChW2008/img/info.png)');
										}
										
									},
									
									highlite_down:function(elem,fed_match_id)
									{
										this.highlite_storage[fed_match_id].stop();
										this.highlite_storage[fed_match_id].start('#FFFFFF', '#FEEFC4');
									},
									
									OpenCloseInfoPanel:function(elem,fed_match_id)
									{
										if ($('slide_'+fed_match_id).getStyle('margin-top').toInt() == -80)
										{
											
											if (
													($('left_'+fed_match_id).innerHTML != '')
													||
													($('right_'+fed_match_id).innerHTML != '')
												)
											{
												this.marginFX_storage[fed_match_id].stop();
												this.infoPanelFX_storage[fed_match_id].stop();
												this.marginFX_storage[fed_match_id].start(-80, 0);
												this.infoPanelFX_storage[fed_match_id].start(0, 80);
											}
											
										}
										if ($('slide_'+fed_match_id).getStyle('margin-top').toInt() == 0)
										{
											this.marginFX_storage[fed_match_id].stop();
											this.infoPanelFX_storage[fed_match_id].stop();
											this.marginFX_storage[fed_match_id].start(0, -80);
											this.infoPanelFX_storage[fed_match_id].start(80, 0);
										}
									}	
									
								}
							)

/*
function check_pdf(mainurl) {
	
	var temp_Alert = '';
	var tempFileList = '';
	var temp_length = document.getElementsByClassName('PDF-LINK').length;

	for (var i= 0; i < temp_length; i++) {
		
		if (i > 0) {
		
			tempFileList = tempFileList + '|' + document.getElementsByClassName('PDF-LINK')[i].id;
			
		} else {
			
			tempFileList = tempFileList + document.getElementsByClassName('PDF-LINK')[i].id;
			
		}
		
		temp_Alert = tempFileList;
		
	}

	get_it_X(mainurl+'checkPDF.asp?Page=check&FileList='+tempFileList+'&target=dummy_target&mainURL='+mainurl);

}
*/


var find_fx_content = new Class	(
									{
										
										initialize: function(){
											
											this.fx_exec_obj = new Object();
											this.find_fx_content();
											
									
										},
										
										find_fx_content: function(){
											
											var array_fx_content_elems = document.getElements('div.fx-content');
											array_fx_content_elems.each(
																			function(fx_elem_item,fx_elem_index)
																			{
																				this.fx_exec_obj[fx_elem_index] = new run_fx_content(fx_elem_item);
																			}.bind(this)
																		)
											
										}
		
									}
								);


var run_fx_content = new Class (
								 	{
										
										initialize: function(element)
										{
											
											this.mother_elem = element;
											
											this.fx_type 		= this.mother_elem.getProperty('fxtype');
											this.fx_width 		= this.mother_elem.getProperty('width');
											this.fx_height 		= this.mother_elem.getProperty('height');
											this.fx_delay 		= this.mother_elem.getProperty('delay').toInt();
											this.fx_duration 	= this.mother_elem.getProperty('duration').toInt();
											
											this.periodical = '';
											
											this.prepare_elements();
											
										},
										
										prepare_elements: function()
										{
											this.mother_elem.setStyles	(
																		 	{
																				width: this.fx_width,
																				height: this.fx_height,
																				'overflow': 'hidden'
																			}
																		);
											
											var fx_items = this.mother_elem.getElements('div.fx-item');
											
											fx_items.each(
														  	function (elem_item,elem_index)
															{
																
																elem_item.setStyles	(
																						{
																							width: this.fx_width,
																							height: this.fx_height,
																							'overflow': 'hidden'
																						}
																					);
																
																if (this.fx_type == 'blend')
																{
																	elem_item.setOpacity(1);
																	elem_item.setStyle('position', 'absolute');
																}
																else
																{
																	elem_item.setStyle('margin-top', 0);
																}
																
															}.bind(this)
														  );
											
											this.mother_elem.setStyle('display', 'block');
											
											this.start();
											
										},
										
										start: function()
										{
											this.periodical = this.blend_item.bind(this).periodical(this.fx_delay);
										},
										
										blend_item: function()
										{
											
											var current_item = this.get_next_item();
											
											current_item.setOpacity(1);
											
											var myEffects = new Fx.Styles	(
																			 	current_item, 
																				{
																					duration: this.fx_duration,
																					transition: Fx.Transitions.Quad.easeInOut,
																					onComplete: function(){
																							this.move_elem(current_item);
																					}.bind(this)
																				}
																			);
											
											if (this.fx_type == 'blend')
											{
												myEffects.start	(
																	{
																		'opacity': 0
																	}
																);
											}
											else
											{
												myEffects.start	(
																	{
																		'margin-top': (-1*this.fx_height)
																	}
																);
											}
											
											
										},
										
										get_next_item: function()
										{
											var return_item = '';
											
											if (this.fx_type == 'blend')
											{
												return_item = this.mother_elem.getLast();
											}
											else
											{
												return_item = this.mother_elem.getFirst();
											}
											
											return return_item; 
											
										},
										
										move_elem: function(cur_item)
										{
											if (this.fx_type == 'blend')
											{
												new_pos = cur_item.injectTop(this.mother_elem);
												new_pos.setOpacity(1);
											}
											else
											{
												new_pos = cur_item.injectAfter(this.mother_elem.getLast());
												new_pos.setStyle('margin-top', 0);
											}
										}
										
										
									}
								);





function build_menu_hover () {
	
	var temp_menu_items = $$('div.level-1');
	
	temp_menu_items.each (function (menu_item, menu_index) {
		
		if (!menu_item.hasClass('act')) {
		
			menu_item.addEvent('mouseenter', function(){
													  
				menu_item.setStyle('background-image', 'url(http://www.ehf-euro.com/fileadmin/templates/EChW2008/img/30_percent_black.png)');
				
			});
	
			menu_item.addEvent('mouseleave', function(){
				
				menu_item.setStyle('background', 'none');
				
			});
			
		};

	});
	
}


function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

var flash_video_player = new Class({

	setOptions: function(options) {
		this.options = Object.extend({						 
			onComplete: Class.empty,
			onStart: Class.empty
		}, options || {});
	},
	
	initialize: function(el, options){
		
		this.setOptions(options);
		this.el = el;
		this.build_player();
		

	},
	
	build_player: function() {

		var height = 0;
		var width = 0;
		var file = '';
		var s1 = ''

		this.FlashVideoContainer = myGetElementsByClassName('flash_video_player');
		this.FlashVideoContainer.each (function (this_el, i) {
			
			this.tempProperties = eval('({' + this_el.innerHTML + '})');
			
			height = this.tempProperties['height'];
			width = this.tempProperties['width'];
			file = this.tempProperties['file'];
			//tempFlashVars = 'skin=/fileadmin/templates/EChW2008/videoPlayer/ehf-skin.swf&file='+file;
			tempFlashVars = 'file='+file;
			if (this.tempProperties['start']) {
				tempFlashVars = tempFlashVars + '&start='+this.tempProperties['start'];
			}
			if (this.tempProperties['autostart']) {
				tempFlashVars = tempFlashVars + '&autostart='+this.tempProperties['autostart'];
			}
			
			s1 = new SWFObject('/fileadmin/templates/EChW2008/videoPlayer/player.swf','ply'+i,width,height,'9','#FFFFFF');
			s1.addParam('allowfullscreen','true');
			s1.addParam('allowscriptaccess','always');
			s1.addParam('flashvars',tempFlashVars);
			s1.write(this_el);
			this_el.style.display = 'block';
			
		}.bind(this));
		
	}
	
});

function make_countdown(Elem) {
	
	//alert(Elem.innerHTML);
	arrayTargetDate = Elem.innerHTML.split(":");
	
	//console.info(arrayTargetDate);
	
	var ZielDatum = new Date(arrayTargetDate[0], arrayTargetDate[1]-1, arrayTargetDate[2]);

	var ZielDatum = { target_date: ZielDatum };
	
	// display bauen
	
	var CountDownDisplay = '<table width="100%" cellpadding="0" cellspacing="0" border="0">';
	CountDownDisplay = CountDownDisplay + '<tr><td><div id="countdown_days" class="countdown_number"></div></td><td><div class="countdown_bez countdown_days"></div></td></tr>';
	CountDownDisplay = CountDownDisplay + '<tr><td><div id="countdown_hours" class="countdown_number"></div></td><td><div class="countdown_bez countdown_hours"></div></td></tr>';
	CountDownDisplay = CountDownDisplay + '<tr><td><div id="countdown_minutes" class="countdown_number"></div></td><td><div class="countdown_bez countdown_minutes"></div></td></tr>';
	CountDownDisplay = CountDownDisplay + '<tr><td><div id="countdown_seconds" class="countdown_number"></div></td><td><div class="countdown_bez countdown_seconds"></div></td></tr>';
	CountDownDisplay = CountDownDisplay + '</table>';
	
	Elem.innerHTML = CountDownDisplay;
	
	Elem.style.display = 'block';

	counter.periodical(1000, ZielDatum);
		
}

var counter = function() {
	
	var day = 86400;
	var hour = 3600;
	var minute = 60;

	var remaining = (this.target_date/1000) - Math.round(now() / 1000);
	//var remaining = remaining * (-1);
	var days    = Math.floor(remaining/day);
	var hours   = Math.floor((remaining - (days*day))/hour);
	var minutes = Math.floor((remaining - (days*day) - (hours*hour))/minute);
	var seconds = remaining - (days*day) - (hours*hour) - (minutes*minute);

	//console.info('tage:'+days+' stunden:'+hours+' minuten:'+minutes+' sekunden:'+seconds);
	
	update_counter('countdown_days',days);
	update_counter('countdown_hours',hours);
	update_counter('countdown_minutes',minutes);
	update_counter('countdown_seconds',seconds);
	
}

function update_counter(type,string) {
	
	$(type).innerHTML = make_digits(string);
	
}

function make_digits(NumberString) {
			
	tempString = NumberString+'';
	tempNewString = ''
	//console.info(tempString.length);
	
	if (tempString.length == 3) {

		tempNewString = '<div class="digit digit_'+Left(tempString,1)+'"></div>';
		tempNewString = tempNewString + '<div class="digit digit_'+Right(Left(tempString,2),1)+'"></div>';
		tempNewString = tempNewString + ' <div class="digit digit_'+Right(tempString,1)+'"></div>';

	} else if (tempString.length == 2) {
		
		tempNewString = '<div class="digit digit_blind"></div><div class="digit digit_'+Left(tempString,1)+'"></div>';
		tempNewString = tempNewString + ' <div class="digit digit_'+Right(tempString,1)+'"></div>';
		
	} else {
		
		tempNewString = '<div class="digit digit_blind"></div><div class="digit digit_blind"></div><div class="digit digit_'+tempString+'"></div>';
		
	}
	
	return tempNewString;
			
}


function now() {
	var jetzt = new Date();
	return jetzt;
}


function init() {
	
	//alert('test');
	/*
	build_tip_a_friend();
	build_scrolling_areas();
	check_for_table_cells_to_display();
	make_shadow();
	*/
}

function make_shadow() {
	
	var i = 0;

	removeAllShadows();
	
	ContentContainer = myGetElementsByClassName('make-shadow');
	
	for(i=0;i<ContentContainer.length;i++){
		
		//alert(ContentContainer[i].id);
		tempContainer = ContentContainer[i];
		//E_posX
		E_posX		= findPosX(tempContainer);
		//E_posY
		E_posY		= findPosY(tempContainer);
		// dimensions

		//var dimensions = $(ContentContainer[i]).getDimensions();
		//E_height
		//E_height	= $(ContentContainer[i]).getSize().size.y;
		//getSize().size.y
		//getSize().size.x


		E_height	= $(ContentContainer[i]).getSize().size.y;
		//E_width
		E_width		= $(ContentContainer[i]).getSize().size.x;
		
		//eventhandler (resize)
		//$(ContentContainer[i]).onresize = ReDrawShadow;
		
		
		//alert('posX:' + E_posX + 'px  posY:' + E_posY + 'px  height:' + E_height + 'px  width:' + E_width + 'px Browser:' + BrowserDetect.browser + ' Version:' + BrowserDetect.version);
		

		//top left Schadow
		tempElement							= document.createElement('div');
		tempElement.id						= i+'_top_left_shadow';
		tempElement.className				= 'shadow shadow-top-left';
		tempElement.style.top				= (E_posY-10)+'px';
		tempElement.style.left				= (E_posX-10)+'px';
		tempElement.style.width				= '10px';
		tempElement.style.height			= '10px';
		if (BrowserDetect.browser == 'Explorer')
		{
			if (BrowserDetect.version == '6')
			{
				tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/blind.gif" width="10" height="10"/>';
			}
			else
			{
				tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/shadow/top_left.png" width="10" height="10"/>';
			}
		}
		else
		{
			tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/shadow/top_left.png" width="10" height="10"/>';
		}
		$('shadows').appendChild(tempElement);

		//top Schadow
		tempElement							= document.createElement('div');
		tempElement.id						= i+'_top_shadow';
		tempElement.className				= 'shadow shadow-top';
		tempElement.style.top				= (E_posY-10)+'px';
		tempElement.style.left				= (E_posX)+'px';
		tempElement.style.width				= (E_width)+'px';
		tempElement.style.height			= '10px';
		if (BrowserDetect.browser == 'Explorer')
		{
			if (BrowserDetect.version == '6')
			{
				tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/blind.gif" width="10" height="10"/>';
			}
			else
			{
				tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/shadow/top.png" width="100%" height="100%"/>';
			}
		}
		else
		{
			tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/shadow/top.png" width="100%" height="100%"/>';
		}
		$('shadows').appendChild(tempElement);

		//top right Schadow
		tempElement							= document.createElement('div');
		tempElement.id						= i+'_top_right_shadow';
		tempElement.className				= 'shadow shadow-top-right';
		tempElement.style.top				= (E_posY-10)+'px';
		tempElement.style.left				= (E_posX+E_width)+'px';
		tempElement.style.width				= '10px';
		tempElement.style.height			= '10px';
		if (BrowserDetect.browser == 'Explorer')
		{
			if (BrowserDetect.version == '6')
			{
				tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/blind.gif" width="10" height="10"/>';
			}
			else
			{
				tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/shadow/top_right.png" width="10" height="10"/>';
			}
		}
		else
		{
			tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/shadow/top_right.png" width="10" height="10"/>';
		}
		$('shadows').appendChild(tempElement);

		//bottom left Schadow
		tempElement							= document.createElement('div');
		tempElement.id						= i+'_bottom_left_shadow';
		tempElement.className				= 'shadow shadow-bottom-left';
		tempElement.style.top				= (E_posY+E_height)+'px';
		tempElement.style.left				= (E_posX-10)+'px';
		tempElement.style.width				= '10px';
		tempElement.style.height			= '10px';
		if (BrowserDetect.browser == 'Explorer')
		{
			if (BrowserDetect.version == '6')
			{
				tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/blind.gif" width="10" height="10"/>';
			}
			else
			{
				tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/shadow/bottom_left.png" width="10" height="10"/>';
			}
		}
		else
		{
			tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/shadow/bottom_left.png" width="10" height="10"/>';
		}
		$('shadows').appendChild(tempElement);

		//bottom Schadow
		tempElement							= document.createElement('div');
		tempElement.id						= i+'_bottom_shadow';
		tempElement.className				= 'shadow shadow-bottom';
		tempElement.style.top				= (E_posY+E_height)+'px';
		tempElement.style.left				= (E_posX)+'px';
		tempElement.style.width				= (E_width)+'px';
		tempElement.style.height			= '10px';
		if (BrowserDetect.browser == 'Explorer')
		{
			if (BrowserDetect.version == '6')
			{
				tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/blind.gif" width="10" height="10"/>';
			}
			else
			{
				tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/shadow/bottom.png" width="100%" height="100%"/>';
			}
		}
		else
		{
			tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/shadow/bottom.png" width="100%" height="100%"/>';
		}
		$('shadows').appendChild(tempElement);

		//bottom right Schadow
		tempElement							= document.createElement('div');
		tempElement.id						= i+'_bottom_right_shadow';
		tempElement.className				= 'shadow shadow-bottom-right';
		tempElement.style.top				= (E_posY+E_height)+'px';
		tempElement.style.left				= (E_posX+E_width)+'px';
		tempElement.style.width				= '10px';
		tempElement.style.height			= '10px';
		if (BrowserDetect.browser == 'Explorer')
		{
			if (BrowserDetect.version == '6')
			{
				tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/blind.gif" width="10" height="10"/>';
			}
			else
			{
				tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/shadow/bottom_right.png" width="10" height="10"/>';
			}
		}
		else
		{
			tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/shadow/bottom_right.png" width="10" height="10"/>';
		}
		$('shadows').appendChild(tempElement);

		//left Schadow
		tempElement							= document.createElement('div');
		tempElement.id						= i+'_left_shadow';
		tempElement.className				= 'shadow shadow-left';
		tempElement.style.top				= E_posY+'px';
		tempElement.style.left				= (E_posX-10)+'px';
		tempElement.style.width				= '10px';
		tempElement.style.height			= E_height+'px';
		if (BrowserDetect.browser == 'Explorer')
		{
			if (BrowserDetect.version == '6')
			{
				tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/blind.gif" width="10" height="10"/>';
			}
			else
			{
				tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/shadow/left.png" width="100%" height="100%"/>';
			}
		}
		else
		{
			tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/shadow/left.png" width="100%" height="100%"/>';
		}
		$('shadows').appendChild(tempElement);

		//right Schadow
		tempElement							= document.createElement('div');
		tempElement.id						= i+'_right_shadow';
		tempElement.className				= 'shadow shadow-right';
		tempElement.style.top				= E_posY+'px';
		tempElement.style.left				= (E_posX+E_width)+'px';
		tempElement.style.width				= '10px';
		tempElement.style.height			= E_height+'px';
		if (BrowserDetect.browser == 'Explorer')
		{
			if (BrowserDetect.version == '6')
			{
				tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/blind.gif" width="10" height="10"/>';
			}
			else
			{
				tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/shadow/right.png" width="100%" height="100%"/>';
			}
		}
		else
		{
			tempElement.innerHTML = '<img src="/fileadmin/templates/EChM2010/img/shadow/right.png" width="100%" height="100%"/>';
		}
		$('shadows').appendChild(tempElement);

	}
	
}

function removeAllShadows() {
	if ($('shadows')) {
		$('shadows').innerHTML = '';
	};
}

function check_shadow() {
	var i=0;
	
	ContentContainer = myGetElementsByClassName('make-shadow');
	
	var redraw = 0;
	
	for(i=0;i<ContentContainer.length;i++)
	{
		tempContainer = ContentContainer[i];
		
		E_posX_1		= findPosX(tempContainer);//E_posX
		E_posY_1		= findPosY(tempContainer);//E_posY
		// dimensions 1
		//var dimensions 	= $(ContentContainer[i]).getDimensions();
		E_height_1		= $(ContentContainer[i]).getSize().size.y;//E_height
		E_width_1		= $(ContentContainer[i]).getSize().size.x;//E_width
		//Summe 1
		CheckSum_1 = E_posX_1 + E_posY_1 + E_height_1 + E_width_1;

		E_posX_2		= findPosX($(i+'_left_shadow'))+10;//E_posX
		E_posY_2		= findPosY($(i+'_left_shadow'));//E_posY
		// dimensions 2
		//var dimensions 	= $(i+'_left_shadow').getDimensions();
		E_height_2		= $(i+'_left_shadow').getSize().size.y;//E_height
		E_width_2		= findPosX($(i+'_right_shadow'))-E_posX_2;//E_width
		//Summe 2
		CheckSum_2 = E_posX_2 + E_posY_2 + E_height_2 + E_width_2;
		
		if (CheckSum_1 != CheckSum_2)
		{
			redraw = 1;
		}

	}

	if (redraw == 1)
	{
		make_shadow();
	}

}

function myGetElementsByClassName(class_name) {
	var all_obj,ret_obj=new Array(),j=0,teststr,i=0;
	
	//if(document.all)all_obj=document.all;
	//else if(document.getElementsByTagName && !document.all)
	all_obj=document.getElementsByTagName('*');
	
	for(i=0;i<all_obj.length;i++)
	{
		if(all_obj[i].className.indexOf(class_name)!=-1)
		{
			teststr=','+all_obj[i].className.split(' ').join(',')+',';
			if(teststr.indexOf(','+class_name+',')!=-1)
			{
				ret_obj[j]=all_obj[i];
				j++;
			}
		}
	}
	return ret_obj;
}

function findPosX(obj)
{
	var curleft = 0;
	if(obj.offsetParent)
		while(1) 
		{
			curleft += obj.offsetLeft;
			if(!obj.offsetParent)
			break;
			obj = obj.offsetParent;
		}
	else if(obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if(obj.offsetParent)
		while(1)
		{
			curtop += obj.offsetTop;
			if(!obj.offsetParent)
			break;
			obj = obj.offsetParent;
		}
	else if(obj.y)
		curtop += obj.y;
	return curtop;
}

function emty_search_box() {
	
	if ($('header-search-input').value == 'search') {

		$('header-search-input').value = '';

	}
	
}

function search_to_box() {

	if ($('header-search-input').value == '') {

		$('header-search-input').value = 'search';

	}

}

function getElementsToScroll() {
	var all_obj,ret_obj=new Array(),j=0,i=0,teststr;
	
	//if(document.all)all_obj=document.all;
	//else if(document.getElementsByTagName && !document.all)
	all_obj=document.getElementsByTagName('div');
	
	for(i=0;i<all_obj.length;i++)
	{
		if(all_obj[i].className.indexOf('make-scroll')!=-1)
		{
			ret_obj[j]=all_obj[i];
			j++;
		}
	}
	return ret_obj; 
}

function get_all_typo_headlines(element) {
	var ret_obj=new Array(),j=0,i=0;
	
	DivArray =  element.getElementsByTagName("div");

	for(i=0;i<DivArray.length;i++)
	{
		if(DivArray[i].className.indexOf('csc-header')!=-1)
		{
			if (i == 0) {
				ret_obj[j]=DivArray[i];
			}
		}
	}
	
	return ret_obj;
}

function build_scrolling_areas() {
	var i = 0, DivWidth = 0, tempsubtrakt = 0;
	
	arrayElementsToScroll = getElementsToScroll();
	//$('Sky').innerHTML =  arrayElementsToScroll.length;

	for(i=0;i<arrayElementsToScroll.length;i++)
	{

		ElementToScroll 	= arrayElementsToScroll[i];

		if (get_scroll_style_dimension(ElementToScroll,'y'))
		{
			
			if (instr(ElementToScroll.innerHTML,'<!-- no-scroll -->') == -1)
			{
			
				if (get_scroll_style_dimension(ElementToScroll,'x'))
				{
					
					//$('Sky').innerHTML = $('Sky').innerHTML + get_scroll_style_dimension(ElementToScroll,'x') + '<hr>'
					
					tempsubtrakt = 0;
					if (BrowserDetect.browser == 'Explorer') {
						//tempsubtrakt = 20;
						tempsubtrakt = 0;
					}
					else
					{
						tempsubtrakt = -30;
						//tempsubtrakt = 0;
					}
					
					DivWidth = get_scroll_style_dimension(ElementToScroll,'x')+parseInt(tempsubtrakt);
					$(ElementToScroll).style.width = DivWidth+'px';
				}
				else
				{
					
					tempsubtrakt = 0;
					if (BrowserDetect.browser == 'Explorer') {
	//					tempsubtrakt = 0;
						tempsubtrakt = 0;
					}
					else
					{
	//					tempsubtrakt = -40;
						tempsubtrakt = 0;
					}
					
					DivWidth = parseInt($(ElementToScroll).getSize().size.x)+tempsubtrakt;
					$(ElementToScroll).style.width = DivWidth+'px';
				}
			
				//get Headline
				tempHeadline 		= get_all_typo_headlines(ElementToScroll)[0];
				ElementToScroll.removeChild(get_all_typo_headlines(ElementToScroll)[0]);
				
				//get Content
				tempContent			= ElementToScroll.innerHTML;
				while ( ElementToScroll.childNodes.length >= 1 )
				{
					ElementToScroll.removeChild( ElementToScroll.firstChild );       
				}
				//newHeadline 			= document.createElement("div");
				//tempText				= document.createTextNode(tempHeadline);
				//newHeadline.appendChild(tempText);
				ElementToScroll.appendChild(tempHeadline);
				
				DivHeight 	= get_scroll_style_dimension(ElementToScroll,'y');
				
				//ElementToScroll.style.width = DivWidth+'px';
	
				if (BrowserDetect.browser != 'Explorer')
				{
					ElementToScroll.style.height = (parseInt(DivHeight)-20)+'px';
				}
				
	//			var dimensions 	= $(get_all_typo_headlines(ElementToScroll)[0]).getDimensions();
	//			DivHeaderHeight = dimensions.height;
				DivHeaderHeight = $(get_all_typo_headlines(ElementToScroll)[0]).getSize().size.y;
	
				//$('Sky').innerHTML = $('Sky').innerHTML + DivHeaderHeight + '<hr>';
		
				//Scrolling Area
				NewScrollArea = document.createElement('div');
				NewAtribut = document.createAttribute('id');
				NewAtribut.nodeValue = 'ScrollArea_'+[i];
				NewScrollArea.setAttributeNode(NewAtribut);
				NewAtribut = document.createAttribute('class');
				NewAtribut.nodeValue = 'ScrollArea';
				NewScrollArea.setAttributeNode(NewAtribut);
				ElementToScroll.appendChild(NewScrollArea);
				$('ScrollArea_'+[i]).style.height = (DivHeight - DivHeaderHeight - 20)+'px';
				
				//Scrolling Stage
				NewScrollStage = document.createElement('div');
				NewAtribut = document.createAttribute('id');
				NewAtribut.nodeValue = 'ScrollStage_'+[i];
				NewScrollStage.setAttributeNode(NewAtribut);
				NewAtribut = document.createAttribute('class');
				NewAtribut.nodeValue = 'ScrollStage';
				NewScrollStage.setAttributeNode(NewAtribut);
				$('ScrollArea_'+[i]).appendChild(NewScrollStage);
				$('ScrollStage_'+[i]).innerHTML = tempContent;
				
				if ($('ScrollArea_'+[i]).getSize().size.y < $('ScrollStage_'+[i]).getSize().size.y)
				{
					$(ElementToScroll).style.width = $(ElementToScroll).getSize().size.x + 'px';
					$('ScrollArea_'+[i]).style.width = ($('ScrollArea_'+[i]).getSize().size.x - 20)+'px';
					
					//build scrollbars
					tempScrollbars = $('scrollbar').innerHTML;
		
					NewScrollBar = document.createElement('div');
					NewAtribut = document.createAttribute('id');
					NewAtribut.nodeValue = 'ScrollBar_'+[i];
					NewScrollBar.setAttributeNode(NewAtribut);
					NewAtribut = document.createAttribute('class');
					NewAtribut.nodeValue = 'ScrollBar';
					NewScrollBar.setAttributeNode(NewAtribut);
					ElementToScroll.appendChild(NewScrollBar);
		
					var vormals = tempScrollbars;
					var tempScrollbars = vormals.replace(/OOOidOOO/g, i);
					
					$('ScrollBar_'+[i]).innerHTML = tempScrollbars;
					$('scrollbar_table_'+i).style.height = $('ScrollArea_'+[i]).style.height;
					$('ScrollBar_'+[i]).style.top = findPosY($('ScrollArea_'+[i]))+'px';
					$('ScrollBar_'+[i]).style.left = findPosX($('ScrollArea_'+[i]))+($('ScrollArea_'+[i]).getSize().size.x)+10+'px';
					$('ScrollStage_'+[i]).style.width = ($('ScrollArea_'+[i]).getSize().size.x)+'px';
					
		//			$('ScrollArea_'+[i]).style.position = 'relative';
					$('ScrollStage_'+[i]).style.position = 'absolute';
					$('ScrollStage_'+[i]).style.top = '0px';
					
					$('scrollbar_bar_'+[i]).style.height = (remove_px($('scrollbar_table_'+i).style.height)-20)+'px';
					
					$('scrollbar_griff_'+[i]).style.top = 0 + 'px';
					
		//			$(ElementToScroll).style.height = (DivHeight-DivHeaderHeight-20)+'px';
		//			$('ScrollStage_'+[i]).style.position = 'absolute';
					//NewAtribut = document.createAttribute('style');
					//NewAtribut.nodeValue = 'clip: rect(0px, 50px, 50px, 0px);';
					//$('ScrollArea_'+[i]).setAttributeNode(NewAtribut);
				}
			
			}
			else
			{
				var tempSubtraktX = 0;
				var tempSubtraktY = 0;
				
				if (BrowserDetect.browser != 'Explorer') {

					tempSubtraktX = -20;
					tempSubtraktY = -20;
					
				}
				else
				{
					tempSubtraktY = -4;
				};
				
				ElementToScroll.style.width = (get_scroll_style_dimension(ElementToScroll,'x')+tempSubtraktX)+'px';
				ElementToScroll.style.height = (get_scroll_style_dimension(ElementToScroll,'y')+tempSubtraktY)+'px';
				
			}
	
		}
	//		$('Sky').innerHTML = $('Sky').innerHTML + '<hr>' + tempHeadline.innerHTML;
	//		$('Sky').innerHTML = $('Sky').innerHTML + '<hr>' + 'height:' + DivHeight + '<hr> width:' + DivWidth + '<hr>HeaderHeight:' + DivHeaderHeight + '<hr>' + $('Sky').innerHTML + ' <hr> ' + tempContent
		
	}
}

function remove_px(wert) {
	
	var vormals = wert;
	var tempWert = vormals.replace(/px/g, '');
	tempWert = parseInt(tempWert);
	
	return tempWert;
}

function get_scroll_style_dimension(element,typ) {
	// values fpr type: x, y

	var whith = element.getAttribute('width');
	var height = element.getAttribute('height');
	var wert = 0;

	if (typ == 'x')
	{
		wert = whith;
	}
	else
	{
		wert = height;
	}
	if (wert != '')
	{
		return parseInt(wert);
	}
	else
	{
		return false;
	}
}

var move_Scroll_up = 0;
var move_Scroll_down = 0;
function StartStopScroll (elemid,type,StartStop) {
	
	if (type == 'up')
	{
		if (StartStop == 'start')
		{
			move_Scroll_up = 1;
		}
		else
		{
			move_Scroll_up = 0;
			move_Scroll_down = 0;
		}
	}
	else
	{
		if (StartStop == 'start')
		{
			move_Scroll_down = 1;
		}
		else
		{
			move_Scroll_up = 0;
			move_Scroll_down = 0;
		}
	}
	
	if (move_Scroll_up == 1 || move_Scroll_down == 1)
	{
		move_ScrollStage(elemid);
	}

}
function move_ScrollStage(elemid) {
	var stepPX = 3;
	
//	$('Sky').innerHTML = get_scrolling_top_pos(elemid)+'<hr>';
//	$('Sky').innerHTML = $('Sky').innerHTML + '1: -- ' + (get_scrolling_top_pos(elemid)+$('ScrollArea_'+elemid).getSize().size.y)+'<hr>';
//	$('Sky').innerHTML = $('Sky').innerHTML + '2: -- ' + $('ScrollStage_'+elemid).getSize().size.y
	
	
	
	
	// move up
	if (move_Scroll_up == 1 && get_scrolling_top_pos(elemid) >  (  $('ScrollStage_'+elemid).getSize().size.y  -  $('ScrollArea_'+elemid).getSize().size.y ) * -1  )
	{
		(get_scrolling_top_pos(elemid) - stepPX)
		newPosY = get_scrolling_top_pos(elemid) - stepPX;
		$('ScrollStage_'+elemid).style.top = newPosY + 'px';
		move_griff(elemid);
	}
	else
	{
		move_Scroll_up = 0;
	}
	
	//move down
	if (move_Scroll_down == 1 & get_scrolling_top_pos(elemid) < 0)
	{
		newPosY = get_scrolling_top_pos(elemid) + stepPX;
		$('ScrollStage_'+elemid).style.top = newPosY + 'px';
		move_griff(elemid);
	}
	else
	{
		move_Scroll_down = 0;
	}
	

	if (move_Scroll_up == 1 || move_Scroll_down == 1)
	{
		setTimeout('move_ScrollStage('+elemid+')', 50);
	}
	
}

function get_scrolling_top_pos(elemid) {
	
	tempPos = $('ScrollStage_'+elemid).style.top;

	var vormals = tempPos;
	var tempPos = vormals.replace(/px/g, '');

	tempPos = parseInt(tempPos)

	return tempPos;
	
}
function move_griff(elemid) {
	var StageYmax 		= ($('ScrollStage_'+elemid).getSize().size.y)-($('ScrollArea_'+elemid).getSize().size.y);
	var StageYact 		= -1 * remove_px($('ScrollStage_'+elemid).style.top);
	var StagePercent 	= parseInt(100 * StageYact / StageYmax);
	
	var bar_max = ($('scrollbar_bar_'+elemid).getSize().size.y)-($('scrollbar_griff_'+elemid).getSize().size.y);
	var bar_y_pos = parseInt((StagePercent)*(bar_max)/(100));
	$('scrollbar_griff_'+elemid).style.top = bar_y_pos+'px';

	//$('Sky').innerHTML = 'max' + StageYmax + '<br>act:'+ StageYact + '<br>%:'+StagePercent+'<br>bar max:'+bar_max+'<br>bar y:'+bar_y_pos;
	
}

// Drag & Drop


var ie=document.all;
var nn6=document.getElementById&&!document.all;

var isdrag=false;
var x,y;
var dobj;
var act_elemid;

function set_act_elemid(elemid) {
	act_elemid = elemid;
}

function movemouse(e)
{
	var newPosY;
	var maxY;
	if (isdrag)
	{
   // dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x;

		newPosY = nn6 ? ty + e.clientY - y : ty + event.clientY - y;
		maxY = ($('scrollbar_bar_'+act_elemid).getSize().size.y) - 10;

		if (newPosY >= 0 && newPosY <= maxY)
		{	
			dobj.style.top  = newPosY;
			set_Y_pos_ScrollStage(act_elemid,newPosY,maxY);
			
			//$('Sky').innerHTML = newPosY +'<br>'+ act_elemid;
			return false;
		}
	}
}

function selectmouse(e) 
{
	var fobj       = nn6 ? e.target : event.srcElement;
	var topelement = nn6 ? 'HTML' : 'BODY';
	
	while (fobj.tagName != topelement && fobj.className != 'scrollbar_griff')
	{
		fobj = nn6 ? fobj.parentNode : fobj.parentElement;
	}
	
	if (fobj.className=='scrollbar_griff')
	{
		isdrag = true;
		dobj = fobj;
		tx = parseInt(dobj.style.left+0);
		ty = parseInt(dobj.style.top+0);
		x = nn6 ? e.clientX : event.clientX;
		y = nn6 ? e.clientY : event.clientY;
		document.onmousemove=movemouse;
		return false;
	}
}

document.onmousedown=selectmouse;
document.onmouseup=new Function('isdrag=false');

function set_Y_pos_ScrollStage(elemid,posY,maxY)
{
	var maxScrollStage = ($('ScrollStage_'+elemid).getSize().size.y)-($('ScrollArea_'+elemid).getSize().size.y);

	var posYScrollStage = -1*(parseInt(posY * maxScrollStage / maxY));
	
	$('ScrollStage_'+elemid).style.top = posYScrollStage;

}

function build_tip_a_friend() {
	if($('tip-a-friend')) {
		$('tip-a-friend').innerHTML = '<table width="100%"><tr><td><div style="position:absolute; z-index:1000"><a onclick="this.blur();" id="toggle-tip-form" href="#">Tell a friend</a><div id="tip-form">wait...</div><div id="tip-temp">temp</div></div></td><td align="right" class="printlink"><a href="javascript:showPrintIframe();">print this page<a><div class="printiFrameContainer" id="printiFrameContainer" style="display:none;"><iframe width="400" height="500" src="about:blank" id="printFrame" name="printFrame">...</iframe></div></td></tr></table>';

		mySlide = new Fx.Slide('tip-form',{
							   duration: 1000,
							   transition: Fx.Transitions.Expo.easeOut
							   }).hide();

		$('toggle-tip-form').addEvent('click', function(e){
			e = new Event(e);
			mySlide.toggle();
			e.stop();
		});

		load_tip_form();

		//fade_element($('tip-form'));

	}
}

function load_tip_form() {

	var url = '/tipp/?id=951&type=10&tipUrl='+window.location.href;
 
	/**
	 * The simple way for an Ajax request, use onRequest/onComplete/onFailure
	 * to do add your own Ajax depended code.
	 */
	new Ajax(url, {
		method: 'get',
		update: $('tip-temp'),
		evalScripts: true,
		onComplete: function() {
			$('tip-form').innerHTML = $('tip-temp').innerHTML;
			$('tip-temp').innerHTML = '';
			make_ajax_form ();
			mySlide.hide();
		}
	}).request();

}

function make_ajax_form () {

	if($('tipFormNow')) {

		$('tipFormNow').addEvent('submit', function(e) {
			new Event(e).stop();
			var log = $('tip-temp').empty().addClass('ajax-loading');
			this.send({
				update: log,
				evalScripts: true,
				onComplete: function() {
					log.removeClass('ajax-loading');
					$('tip-form').innerHTML = $('tip-temp').innerHTML;
					$('tip-temp').innerHTML = '';
					make_ajax_form ();
				}
			});
		});
	
	}
}

function fade_element(element) {

	var myEffects = new Fx.Styles('tip-form', {duration: 500, transition: Fx.Transitions.Expo.easeOut});
	myEffects.start({'opacity': 0.8});
	element.addEvent('mouseenter', function(){ myEffects.start({'opacity': 1}); });
	element.addEvent('mouseleave', function(){ myEffects.start({'opacity': 0.8}); });

	
	//var myEffects = new Fx.Morph('tip-form', {duration: 1000, transition: Fx.Transitions.Sine.easeOut});
	//myEffects.start({
	//	'opacity': 0
	//});
}

function instr(stra,strb) {
		var Astr, Bstr;
		
		Astr = stra;
		Bstr = strb;
		
		return Astr.indexOf(Bstr);
		
}

function check_for_table_cells_to_display() {
		var content_tables = $$('.contenttable');
		var i = 0;
		for(i=0;i<content_tables.length;i++) {
			var content_cells = content_tables[i].getElementsByTagName('td');
			var j = 0;
			for(j=0;j<content_cells.length;j++) {
				if (content_cells[j].innerHTML == 'dontdisplay') {
					content_cells[j].innerHTML = '';
					content_cells[j].style.background = 'none';
				}
			}
		}
}

function getPlayer(playerName, PlayerWidth, PlayerHeight)
{

    var VIDEO_TAG = '<OBJECT ID="' + playerName + '" width=' + PlayerWidth + ' height=' + PlayerHeight + ' ';

	if ( - 1 != navigator.userAgent.indexOf("MSIE"))
    {
        VIDEO_TAG = VIDEO_TAG + 'classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6">';
    }
    else if ( - 1 != navigator.userAgent.indexOf("Firefox"))
    {
        VIDEO_TAG = VIDEO_TAG + 'type="application/x-ms-wmp">';
    }



    VIDEO_TAG = VIDEO_TAG + 
	'<PARAM NAME="autoStart" VALUE="True">'+
//	'<PARAM NAME="URL" VALUE="mms://stream.wmv.n-tv.de/ntvlive">'+
//	'<PARAM NAME="src"value="mms://stream.wmv.n-tv.de/ntvlive">'+
 	'<PARAM NAME="URL" VALUE="/fileadmin/ehfeuro/EChW2008/live-video/draw.asx">'+
	'<PARAM NAME="src"value="/fileadmin/ehfeuro/EChW2008/live-video/draw.asx">'+
	'<param value="true" name="AutoStart"/>'+
	'<param value="0" name="CurrentPosition"/>'+
	'<param value="4" name="DisplaySize"/>'+
	'<param value="true" name="AutoSize"/>'+
	'<param value="true" name="AllowChangeDisplaySize"/>'+
	'<param value="true" name="stretchToFit"/>'+
	'<param value="true" name="maintainAspectRatio"/>'+
	'<param value="none" name="uiMode"/>'+
	'<param value="0" name="ShowControls"/>'+
	'<param value="0" name="ShowPositionControls"/>'+
	'<param value="false" name="ShowStatusBar"/>'+
	'<PARAM NAME="windowlessVideo" VALUE="True">'+
'</object>';								

    return VIDEO_TAG;
}

function showPrintIframe() {
	if ($('printiFrameContainer').style.display == 'none') {
		//$('printiFrameContainer').style.display = 'block';
		$('printFrame').contentWindow.document.body.innerHTML = '<div id="printContent"></div>';
		$('printFrame').contentWindow.document.getElementById('printContent').innerHTML = 'test';

		//document.frames["printFrame"].document.getelementsbytagname('body')[0].innerHTML = 'test';
//		$('printFrame').contentWindow.document.getelementsbytagname('body')[0].innerHTML = 'test';
	}else{
		$('printiFrameContainer').style.display = 'none';
	};
}

var NewsBlender = new Class({
						   
	setOptions: function(options) {
		this.options = Object.extend({						 
			onComplete: Class.empty,
			onStart: Class.empty,
			delay:1000,
			EffectDuration:500,
			ChangeDelay:5000
		}, options || {});
	},
	
	initialize: function(el, options){
		
		this.setOptions(options);
		this.el = el;
		this.act_news_item = 0;
		this.build_small_list();

	},
	
	build_small_list: function () {
		
		var big_itembox = $('slide-news-latest-big');
			big_itembox.setStyles(
									{
										'float':'left',
										'cursor':'pointer'
									}
								);
			
		var blende = new Element('div',	{'id':'slide-news-latest-blende'});
			blende.setStyles({
				height:203,
				width:338,
				position:'absolute',
				'background-color':'#ffffff',
				'z-index':2,
				'opacity': 0.3,
				display:'none'
			});
		blende.inject(big_itembox);
		
		var small_itemsbox = new Element('div',	{'id':'slide-news-latest-small'});
			small_itemsbox.setStyles({
				height:204,
				width:223,
				'float':'right'
			});
		
		small_itemsbox.inject(big_itembox, 'after');
		
		var div_clear = new Element('div');
			div_clear.setStyles({
				clear: 'both'
			});
		div_clear.inject(small_itemsbox, 'after');
		
		big_itembox.getElements('div.slide-news-latest-item').each(function (el, i) {
			
			el.setStyles({
				'z-index':0
			});
			
			el.addEvent('click', function(event){
				window.location.href = el.getElements('div.slide-news-latest-title')[0].getElements('a').getProperty('href');
			}.bind(this));
			
			var clone = el.clone().inject(small_itemsbox);

			clone.addEvent('click', function(event){
				window.location.href = clone.getElements('div.slide-news-latest-title')[0].getElements('a').getProperty('href');
			}.bind(this));

			clone.setStyles({
				height:61,
				width:223,
//				'background-color':'#e9e9ea',
				'background-image':'url(/fileadmin/templates/EChW2008/img/75_percent_white.png)',
				padding:1,
				'margin-bottom':7,
				cursor:'pointer'
			});
			
			if (i==0) {
				clone.setStyles({
					//'background-color':'#cccccc'
					'background-image':'url(/fileadmin/templates/EChW2008/img/15_percent_black.png)'
				});
			};

			clone.addEvent("mouseenter" , function(event) {
				this.change_item(i);
			}.bind(this));
			
			clone.getElements('div.slide-news-latest-image')[0].setStyles({
				height:60,
				width:61,
				overflow:'hidden',
				'float':'left'
			});
			
			clone.getElements('div.slide-news-latest-image')[0].getElements('img')[0].setProperties({
				width: 100,
				height: 61
			});

			clone.getElements('div.slide-news-latest-transparent-bg')[0].setStyles({
				height:60,
				width:150,
				overflow:'hidden',
				'float':'right'
			});
			
			clone.getElements('div.slide-news-latest-transparent-bg')[0].getElements('div.slide-news-latest-title')[0].setStyles({
				margin:5
			});
			
			clone.getElements('div.slide-news-latest-transparent-bg')[0].getElements('div.slide-news-latest-title')[0].getElements('a')[0].setStyles({
				'font-size':11,
				'text-decoration':'none',
				color:'#737373',
				'font-weight':'bold'
			});
			
			clone.getElements('div.slide-news-latest-transparent-bg')[0].getElements('div.slide-news-latest-subheader')[0].getElements('p')[0].setStyles({
				margin:5,
				'font-size':11,
				clear:'both'
			});
			
		}.bind(this));
		
		big_itembox.getElements('div.slide-news-latest-item')[0].setStyles({
			'z-index':1,
			display:'block'
		});
		
		document.getElements('div.slide-news-latest-container')[0].addEvent("mouseenter" , function(event) {
			
			this.stopAutoChange();
		
		}.bind(this));

		document.getElements('div.slide-news-latest-container')[0].addEvent("mouseleave" , function(event) {
		
			this.startAutoChange();
		
		}.bind(this));

		this.startAutoChange();
		
	},
	
	startAutoChange: function() {

		this.periodicalTimer = this.goto_next.periodical(this.options.ChangeDelay, this);
	
	},
	
	stopAutoChange: function() {
		
		$clear(this.periodicalTimer);
		
	},
	
	goto_next: function () {
		
		var temp_new_item_nr;
		
		if (this.act_news_item == 2) {
			
			temp_new_item_nr = 0;
			
			
		} else {

			temp_new_item_nr = this.act_news_item + 1;

		};
		
		this.change_item(temp_new_item_nr);
		
	},
	
	change_item: function (item_nr) {
		
		var big_itembox = $('slide-news-latest-big');
		var small_itemsbox = $('slide-news-latest-small');

		var blende = $('slide-news-latest-blende');

		big_itembox.getElements('div.slide-news-latest-item').each(function (elz,iz) {
																			 
			elz.setStyles({
				'z-index':0,
				display:'none'
			});	
																			 
		});
		
		big_itembox.getElements('div.slide-news-latest-item')[item_nr].setStyles({
			'z-index':1,
			display:'block'
		});
		
		
		
		small_itemsbox.getElements('div.slide-news-latest-item').each(function (elz,iz) {
																			 
			elz.setStyles({
				//'background-color':'#e9e9ea'
				'background-image':'url(/fileadmin/templates/EChW2008/img/75_percent_white.png)'
			});	
																			 
		});
		
		small_itemsbox.getElements('div.slide-news-latest-item')[item_nr].setStyles({
				//'background-color':'#cccccc'
				'background-image':'url(/fileadmin/templates/EChW2008/img/15_percent_black.png)'
		});
		
		/*
		
		if (this.act_news_item != item_nr) {
		
			blende.setStyles({
					display:'block',
					'opacity': 0.5
			});	
		
			var fx = new Fx.Styles(blende, {duration:1000, wait:false});
			
			fx.start({
				'opacity': 0
			});
		
		};
		*/
		
		this.act_news_item = item_nr;
		
	}
	
});

/*flash video*/

build_new_flash_video_player = new Class({
										 
	setOptions: function(options) {
		this.options = Object.extend({						 
			onComplete: Class.empty,
			onStart: Class.empty
		}, options || {});
	},
	
	initialize: function(el, options){
		
		this.setOptions(options);
		this.el = el;
		
		this.array_video_player = $$('div.portal-video');
		
		this.build_video_player();
		
	},
	
	build_video_player: function (){
		
		this.array_video_player.each(function (play_item,player_index)
		{
			
			temp_width = play_item.getSize().size.x;
			temp_height = play_item.getSize().size.y;
			temp_video_url	= play_item.getFirst().getFirst().href;
			temp_prev_img = $$('div.video-img')[player_index].getFirst().getFirst().src;
			
			
			if (window.ie)
			{
			
				temp_code = '';
				temp_code =temp_code+ '<object id="player" height="'+temp_height+'" width="'+temp_width+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"> ';
				temp_code =temp_code+ 	'<param value="/fileadmin/video_player/player.swf" name="movie"> ';
				temp_code =temp_code+ 	'<param value="#ffffff" name="bgcolor"> ';
				temp_code =temp_code+ 	'<param value="height" name="quality"> ';
				temp_code =temp_code+ 	'<param value="true" name="allowfullscreen"> ';
				temp_code =temp_code+ 	'<param value="opaque" name="wmode"> ';
				temp_code =temp_code+ 	'<param value="file='+temp_video_url+'&controlbar=over&image='+temp_prev_img+'" name="flashvars"> ';
				temp_code =temp_code+ '</object> ';
			} else {
			
				temp_code = '';
				temp_code =temp_code+ '<embed ';
				temp_code =temp_code+ ' id="player" ';
				temp_code =temp_code+ '	height="'+temp_height+'" ';
				temp_code =temp_code+ '	width="'+temp_width+'" ';
				temp_code =temp_code+ '	flashvars="file='+temp_video_url+'&controlbar=over&image='+temp_prev_img+'" ';
				temp_code =temp_code+ '	wmode="opaque" ';
				temp_code =temp_code+ '	allowscriptaccess="always" ';
				temp_code =temp_code+ '	allowfullscreen="true" ';
				temp_code =temp_code+ '	quality="high" ';
				temp_code =temp_code+ '	bgcolor="#ffffff" ';
				temp_code =temp_code+ '	name="player" ';
				temp_code =temp_code+ '	style="" ';
				temp_code =temp_code+ '	src="/fileadmin/video_player/player.swf" ';
				temp_code =temp_code+ '	type="application/x-shockwave-flash"';
				temp_code =temp_code+ ' />';
			};
			
			play_item.innerHTML = temp_code;
			
			//console.log($$('div.video-img')[player_index].getFirst().getFirst().src);
			
		}.bind(this));
		
	}
	
});

