var Fiba_Live = new Class({
	
	
	////////////////////////
	// set options
	////////////////////////
	setOptions: function(options) {
		
		this.options = Object.extend(
										{
											confvers					: '',
											onComplete					: Class.empty,
											onStart						: Class.empty,
											refresh_time				: 10000,
											refresh_time_slow			: 300000,
											refresh_schedule_time		: 60000,
											schedule_scrolling_duration	: 750,
											refresh_wide_standing		: 5000,
											event_id					: '',
											game_id						: '',
											FX_duration					: 500,
											shot_chart_point_width		: 50,
											shot_chart_point_height		: 50
										}, 
										options || {}
									);
	},
	
	////////////////////////
	// initialize
	////////////////////////
	initialize: function(config){
		
		this.ini_loaded 	= false;
		this.game_loaded 	= false;
		
		this.setOptions();

		this.act_data_folder = '';
		
		this.version = 'v1';
		
		this.conf_vers = config;
		
		this.url_params = new Object();
		
		this.act_game_time = '';
		this.act_game_msg = '';
		this.act_game_gender = '';
		
		this.url_param = window.location.search;
		this.url_param = this.url_param.replace(/\?/g,'');
		this.array_url_params = $splat(this.url_param.split('&'));
		this.array_url_params.each(function(param_item,param_index) {
			tempArray = param_item.split('=');
			this.url_params[tempArray[0]] = tempArray[1];
		}.bind(this));
		
		if ($type(this.url_params['L']) != false)
		{
			this.options.event_id = this.url_params['L'].toLowerCase();
		}
		else
		{
			this.options.event_id = 'bbl';
		};

		if ($type(this.url_params['H']) != false)
		{
			this.act_data_folder = (this.options.event_id+'/'+this.url_params['H']).toLowerCase();
		}
		else
		{
			this.act_data_folder = '';
		};

		if ($type(this.url_params['game']) != false)
		{
			this.options.game_id = this.url_params['game'].toLowerCase();
		}
		else
		{
		};
		
		if ($type(this.url_params['debug']) != false) 
		{
			if (this.url_params['debug'] == '1')
			{
				$('control').setStyle('display', 'block');
			};
		};
		
		this.ini_counter				= 0;
		this.box_score_choosen_gender	= '';
		this.groupstanding_choosen_gender = '';
		
		this.schedule_update_status		= 0;
		
		this.game_status				= '';
		
		this.first_update				= 1;
		
		this.first_start				= 1;
		
		this.act_news_item 				= 0;
		
		//this.act_date					= new Date(2008,8,13);
		this.act_date					= new Date();
		this.act_date.getDate();
		this.event_xml_data				= new Object;
		
		this.schedule_coosen_liga		= '';
		
		this.schedule_act_group			= '';
		
		this.teamlogos					= false;
		
		this.quarter_request			= new Object();
		
		this.act_set					= '';
		this.act_quarter				= '';
		this.cur_quarter				= '';
		this.choosen_quarter			= '';
		this.choosen_Team				= 'A';
		
		//quarter storage
		this.quarter_storage			= new Object();
		this.quarter_storage_status		= new Object();	
		
		this.shot_chart_choosen_quarter	= 'All';
		
		this.periodical					= '';

		this.data_gameini				= '';
		this.data_game					= '';
		
		this.act_live_content			= 0;
		
		this.live_content				= new Array();
		this.fx_content					= new Array();

		this.live_content[0] 			= $('ContentMain_0');

		this.fx_content[0]				= $('fx_content');
		
		this.Content_FX_in = new Fx.Tween(this.fx_content[0],{duration: this.options.FX_duration});

		this.Content_FX_out = new Fx.Tween(this.fx_content[0],{duration: this.options.FX_duration});

		
		this.live_content[1] 			= $('ContentMain_1');
		this.live_content[1].setStyle('display', 'none');
		
		this.old_img_path				= '';		
		
		this.temp_small_standing 		= '';
		this.temp_wide_standing 		= '';
		this.temp_game_stat				= '';
		this.temp_score_dev				= '';
		this.temp_small_play_by_play	= '';
		this.temp_full_play_by_play		= '';
		this.temp_players				= '';
		this.temp_teams					= '';
		
		this.general_updateing			= false;
		
		this.loading_gif		= $$('img.loading-gif')[0];
		
		this.refresh_storage					= new Object();
		
		this.set_refresh('small_standing'		,this.options.refresh_time);
		this.set_refresh('wide_standing'		,this.options.refresh_time);
		this.set_refresh('game_stat'			,this.options.refresh_time);
		this.set_refresh('score_dev'			,this.options.refresh_time);
		this.set_refresh('small_play_by_play'	,this.options.refresh_time);
		this.set_refresh('full_play_by_play'	,this.options.refresh_time);
		this.set_refresh('players'				,this.options.refresh_time);
		this.set_refresh('teams'				,this.options.refresh_time);
		this.set_refresh('shot_chart'			,this.options.refresh_time);
		
		this.set_refresh('schedule'				,this.options.refresh_time);

		this.set_refresh('liga-bbl'				,this.options.refresh_time);
		this.set_refresh('liga-bbl2proa'		,this.options.refresh_time);
		this.set_refresh('liga-bbl2prob'		,this.options.refresh_time);
		this.set_refresh('liga-extra'			,this.options.refresh_time);

		this.set_refresh('fpbp_Q1'				,this.options.refresh_time);
		this.set_refresh('fpbp_Q2'				,this.options.refresh_time);
		this.set_refresh('fpbp_Q3'				,this.options.refresh_time);
		this.set_refresh('fpbp_Q4'				,this.options.refresh_time);
		
		this.set_refresh('fpbp_X1'				,this.options.refresh_time);
		this.set_refresh('fpbp_X2'				,this.options.refresh_time);
		this.set_refresh('fpbp_X3'				,this.options.refresh_time);
		this.set_refresh('fpbp_X4'				,this.options.refresh_time);
		this.set_refresh('fpbp_X5'				,this.options.refresh_time);
		this.set_refresh('fpbp_X6'				,this.options.refresh_time);
		this.set_refresh('fpbp_X7'				,this.options.refresh_time);
		this.set_refresh('fpbp_X8'				,this.options.refresh_time);
		this.set_refresh('fpbp_X9'				,this.options.refresh_time);

		this.change_css();

		this.load_templates();
		
		
	},
	
	////////////////////////
	// change_css()
	////////////////////////
	change_css: function () {
		
		if (
				(this.options.event_id != 'bbl')
				&& 
				(this.options.event_id != 'extra')
			)
		{
			
			if ($('css').getProperty('href') == 'css/live_v1.css')
			{
				$('css').removeProperty('href');
				$('css').setProperty('href', 'css/bbl2_skin.css');
				
				$('loading-screen').removeProperty('src');
				$('loading-screen').setProperty('src', 'img/bbl2_skin/loadingscreen.png');
				
				$('ajax-loader').removeProperty('src');
				$('ajax-loader').setProperty('src', 'img/bbl2_skin/ajax-loader.gif');
			}
		}
		else
		{
			if ($('css').getProperty('href') == 'css/bbl2_skin.css')
			{
				$('css').removeProperty('href');
				$('css').setProperty('href', 'css/live_v1.css');
				
				$('loading-screen').removeProperty('src');
				$('loading-screen').setProperty('src', 'img/loadingscreen.png');
				
				$('ajax-loader').removeProperty('src');
				$('ajax-loader').setProperty('src', 'img/ajax-loader.gif');
			}
		}
		
		
	},
	
	////////////////////////
	// set_refresh()
	////////////////////////
	set_refresh: function (board,milisec) {
		
		if ($type(this.refresh_storage[board]) != 'object')
		{
			this.refresh_storage[board] = new Object();
		};
		
		this.refresh_storage[board]['max_time'] = milisec;
		
	},
	
	////////////////////////
	// reset_refresh()
	////////////////////////
	reset_refresh: function (board) {
		
		if ($type(this.refresh_storage[board]))
		{
			this.refresh_storage[board]['last_update'] = 0;
		};
		
	},
	
	////////////////////////
	// check_refresh()
	////////////////////////
	check_refresh: function (board) {

		var temp_return = '';
		var time_now 	= $time();
		
		if ($type(this.refresh_storage[board]['last_update']) != 'number')
		{
			this.refresh_storage[board]['last_update'] = time_now;
			temp_return = true;
		}
		else
		{
			if (
					(time_now - this.refresh_storage[board]['last_update']) >= this.refresh_storage[board]['max_time']
				)
			{
				temp_return = true;
				this.refresh_storage[board]['last_update'] = time_now;
			}
			else
			{
				temp_return = false;
			};
		};
		
		return temp_return;
		
	},
	
	////////////////////////
	//  show_loading_gif()
	////////////////////////
	show_loading_gif: function () {

				
		this.loading_gif.fade(1);
		
		var tempFunc = function () 
		{
			this.loading_gif.fade(0);
		}.bind(this);
		
		tempFunc.delay(2500,this);
		
	},
	
	////////////////////////
	//  hide_loading_gif()
	////////////////////////
	hide_loading_gif: function () {
		
	},
	
	////////////////////////
	// load templates
	////////////////////////
	load_templates: function () {
		
		if (Browser.Engine.trident4)
		{
			$$('td.navi')[0].setStyles(
										{
											'background': 'none',
											'filter': 'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src=\'img/header_'+this.options.event_id.toLowerCase()+'_bg.png\', sizingMethod=\'scale\')'
										});
		}
		else
		{
			$$('table.header-1')[0].setStyle('background-image', 'url(img/header_'+this.options.event_id.toLowerCase()+'_bg.png)');
		};
		
		timestamp('load_templates');
		
		this.main_div							= $('bg');
		
		this.elem_navi							= $$('span.main-navi');
		
	// small_Standing
		timestamp('small_Standing start');
	
	// teams
		
		this.choosen_team_member	= '';
		
		$$('a.teams-country-small').addEvent('click', function(){

			this.switch_choosen_team();
			
		}.bind(this));

	// schedule
	
		$$('div.schedule-liga-tab').each( function(tab_item,tab_index) {
			
			tab_item.addEvent('click', function(event){
			
				this.switch_schedule_liga(tab_item.getProperty('id'));
			
			}.bind(this));
			
		}.bind(this));
		
		this.switch_schedule_liga(this.options.event_id);
	
		// shot-chart
	
		this.shot_chart_field									= $('shot-chart-field');

		// login
		this.login_meassage										= $$('div.login-meassage')[0];
		this.login_meassage.setStyle('opacity', 0);
		
		this.login_meassage_fx				= 		new Fx.Tween(this.login_meassage,{duration: this.options.FX_duration});
		timestamp('load_templates finshed');
		
		// navi
		this.build_navi();
		
		//this.switch_set(0);
		this.show_set(0);
		this.act_set = 0;

		tempfunc = function () {
			this.get_standing_schedule(this.options.event_id);
		};
		tempfunc.delay(20,this)
		
		
		tempfunc = function () {
			this.get_standing_schedule('extra');
		};
		tempfunc.delay(1000,this)
		
		this.start_wide_standing_timer();
		
	},
	
	////////////////////////
	// build_navi
	////////////////////////
	build_navi: function ()	{
		
		this.elem_navi.each(
			function(item, index)
			{
				item.addEvent(
					'click', 
					function()
					{
						this.switch_set(index+1)
					}.bind(this)
				);
			}.bind(this)
		);
	},
	
	////////////////////////
	// switch_set
	////////////////////////
	switch_set: function (SetNr) {
		
		if (
				(this.game_loaded)
				||
				(
				 	(SetNr == 10)
					||
				 	(SetNr == 0)
					||
				 	(SetNr == 7)
				)
			)
		{
		
			this.show_set(SetNr)
			
		}

	},
	
	////////////////////////
	// show set
	////////////////////////
	show_set: function (SetNr) {

		$$('div.sets').each(function (set_item,set_index) {
									  
									  set_item.setStyle('display', 'none');
									  
									  });
		
		this.act_set = SetNr;
	
		switch (SetNr) {
			
			case 0:
				//set 0 -> Loading
				$('set-loading').setStyle('display', 'block');
			
			break;

			case 1:
				//set 1 -> Gamestat
				$('set-gamestat').setStyle('display', 'block');
				this.update_data();
			break;

			case 2:
				//set 2 -> Play by Play
				$('set-play-by-play').setStyle('display', 'block');
				this.update_data();
			break;
			
			case 3:
				//set 3 -> Players
				$('set-players').setStyle('display', 'block');
				this.update_data();
			break;
			
			case 4:
				//set 4 -> Teams
				$('set-teams').setStyle('display', 'block');
				this.update_data();
			break;
			
			case 5:
				//set 5 -> shot-Chart
				$('set-shotchart').setStyle('display', 'block');
				this.update_data();
			break;
			
			case 6:
				// set 6 -> Standing
				$('set-standing').setStyle('display', 'block');
				this.update_data();
			break;
			
			case 7:
				//set 7 -> Schedule
				$('set-schedule').setStyle('display', 'block');
				this.update_data();
			break;
			
			case 8:
				// set 8 -> Login
				$('set-login').setStyle('display', 'block');
			break;
			
			case 9:
				// set 9 -> nogame
				$('set-nogame').setStyle('display', 'block');
			break;
			
			case 10:
				// set 10 will start
				$('set-will-start').setStyle('display', 'block');
			break;
			
			default:
				this.show_set(1);
			break;
			
			
		};
		
		this.fx_content[0].setStyle('opacity', 1);
		
	},
	
	////////////////////
	// update_standing_schedule()
	// updates standing and schedule
	// - on first call starts periodic timer for (game-json and gameini-json)
	//		(load_data / start_updating)
	// - sets the live game if any live-game exits
	// - needs data-object
	// - calls "update_standing_schedule()"
	////////////////////
	update_standing_schedule: function() {

		if (this.first_start == 1) {
			
			// set act game
			if (this.options.game_id == '')
			{
				this.options.game_id	= this.find_act_game(this.event_xml_data[this.options.event_id]);
				
				this.switch_set(7);
				
			};
			
			if (this.act_data_folder == '')
			{
				this.act_data_folder = this.get_data_folder(this.options.game_id);
			};
			
			//this.start_updating_schedule();
			
			this.first_start = 0;
			

			this.update_schedule();
			this.load_data();
			this.start_updating();

		};
	
	},
	
	//////////////////////////////////
	// get_data_folder();
	//////////////////////////////////
	get_data_folder: function(game_id) {

		temp_data_folder = ''
		
		this.event_xml_data[this.options.event_id].liga.Spiel.each(
			function(spiel_item,spiel_index)
			{
				if (spiel_item.Game_ID == game_id)
				{
					temp_data_folder = this.options.event_id+'/'+spiel_item.Heim.Team_ID;
				}
			}.bind(this)
		)
		
		return temp_data_folder;
		
	},
	
	//////////////////////////////////
	// switch_schedule_liga(liga);
	//////////////////////////////////
	switch_schedule_liga: function (liga) {

		if (this.schedule_coosen_liga != liga)
		{
			
			$$('div.schedule-liga-tab').each( function(tab_item,tab_index){
				
				if (tab_item.getProperty('id') == liga)
				{
					tab_item.setStyles({
						'border-bottom': '1px solid #ffffff',
						'background-color':'#ffffff'
					});
				}
				else
				{
					tab_item.setStyles({
						'border-bottom': '1px solid #dedede',
						'background-color':'#f0f0f0'
					});
				};
				
			}.bind(this));
			
			$$('div.schedule-scroll').each( function(display_item,display_index) {
				
				if (display_item.hasClass('scroll-content-'+liga))
				{
					display_item.setStyle('display','block');
				}
				else
				{
					display_item.setStyle('display','none');
				};
			}.bind(this));
			
			this.schedule_coosen_liga = liga;
			
			this.update_schedule();
			
		};
		
	},
	
	//////////////////////////////////
	// find_act_game
	//////////////////////////////////
	find_act_game: function (data) {

		temp_game_id = 0;
		
		tempArrayRunning 	= new Array();
		tempArrayFinished	= new Array();
		tempArrayNext 		= new Array();
		tempArrayAll 		= new Array();
		
		$splat(data.liga.Spiel).each(function (game_item,game_index) {
											   
			if (game_item.gcr == 'true')
			{
				tempArrayRunning.push(game_item);
			};
			
			if (game_item.gcr != 'true')
			{
				if (
						(game_item.Heim.Spielstand != '0')
						&&
						(game_item.Gast.Spielstand != '0')
					)
				{
					tempArrayFinished.push(game_item);
				}
				else
				{
					tempArrayNext.push(game_item);
				};
			};

			tempArrayAll.push(game_item);
		
		}.bind(this));
		
		
		// thats the check if we have a given club ID "&H=???"
		if (
				($type(this.url_params['H']) != false)
				&&
				(!$type(this.url_params['game']))
			)
		{
			if ($type(tempArrayAll[0]))
			{
				tempArrayAll.each(function(game_item,game_index)
										   {
											   if 	(
														(temp_game_id == 0)
														&&
														(
														 	(game_item.Heim.Team_ID == this.url_params['H'])
															||
														 	(game_item.Gast.Team_ID == this.url_params['H'])
														 )
													)
											   {
													temp_game_id			= game_item.Game_ID;
													this.act_game_time		= game_item.Startzeit;
													this.act_game_msg		= game_item.MSG;
													this.act_data_folder	= game_item.Heim.Team_ID;
											   }
										   }.bind(this))
			};
		}
		
		if (temp_game_id == 0)
		{

			if (tempArrayRunning.length > 0)
			{
				temp_game_id 			= tempArrayRunning[0].Game_ID;
				this.act_game_time 		= tempArrayRunning[0].Startzeit;
				this.act_game_msg		= tempArrayRunning[0].MSG;
				this.act_data_folder	= tempArrayRunning[0].Heim.Team_ID;
			} 
			else if (tempArrayFinished.length > 0) 
			{
				temp_game_id 			= tempArrayFinished.getLast().Game_ID;
				this.act_game_time 		= tempArrayFinished.getLast().Startzeit;
				this.act_game_msg		= tempArrayFinished.getLast().MSG;
				this.act_data_folder	= tempArrayFinished.getLast().Heim.Team_ID;
			} 
			else if (tempArrayNext.length > 0) 
			{
				temp_game_id 			= tempArrayNext.getLast().Game_ID;
				this.act_game_time 		= tempArrayNext.getLast().Startzeit;
				this.act_game_msg		= tempArrayNext.getLast().MSG;
				this.act_data_folder	= tempArrayNext.getLast().Heim.Team_ID;
			} 
			else 
			{
				if ($type(tempArrayAll[0]))
				{
					temp_game_id 			= tempArrayAll.getLast().Game_ID;
					this.act_game_time 		= tempArrayAll.getLast().Startzeit;
					this.act_game_msg		= tempArrayAll.getLast().MSG;
					this.act_data_folder	= tempArrayAll.getLast().Heim.Team_ID;
				}
				else
				{
					this.switch_set(7);
				};
			};
			
		};
		
		this.act_data_folder = this.options.event_id+'/'+this.act_data_folder;
		
		
		if ($type(temp_game_id) == 'number') {
			
			if (temp_game_id < 10) {
				
				temp_game_id = '0'+temp_game_id;
				
			};
			
		};
		
		
		return temp_game_id;
		
	},
	
	//////////////////////////////////
	// Periodical controls
	//////////////////////////////////
	
	start_wide_standing_timer: function() {

		this.periodical_wide_standing = this.scroll_wide_standing_box.bind(this).periodical(this.options.refresh_wide_standing);
		
	},
	
	start_updating: function() {

		this.periodical = this.load_data.bind(this).periodical(this.options.refresh_time);
		
	},
	
	start_updating_slow: function() {

		this.periodical = this.load_data.bind(this).periodical(this.options.refresh_time_slow);
		
	},
	
	stop_updating: function() {

		$clear(this.periodical);
		
	},
	
	start_general_updating: function() {
		
		this.general_updateing = true;
		this.update_data();
		this.periodical_general = this.update_data.bind(this).periodical(2000);
		
	},
	
	stop_general_updating: function() {
		
		$clear(this.periodical_general);
		
	},
	
	////////////////////////
	// load data
	////////////////////////
	load_data: function () {

		this.get_data_ini();
		
	},

	////////////////////
	// get_standing_schedule()
	// gets standing and schedule
	// - converts xml to object
	// - calls "update_standing_schedule()"
	////////////////////
	get_standing_schedule: function(liga) {
		
		this.show_loading_gif();
		var myRequest = new Request({
										method: 'get',
										//url: 'data/json/event.xml.asp?event_id='+this.options.event_id,
										url: 'data/'+liga.toLowerCase()+'/'+liga.toLowerCase()+'.xml',
										//url: '../json/test/event_xml.js',
										onComplete: function(text) {
											
											var tempXMLObject = '';
											tempXMLObject = xotree.parseXML(text);

											if ($type(tempXMLObject) == 'object')
											{
												this.event_xml_data[liga] = tempXMLObject;
												this.event_xml_data[liga+'-spieltag'] = tempXMLObject.liga['-spieltag'];
												
												if (this.first_start == 1)
												{
													this.update_standing_schedule();
												}
												else
												{
													this.update_schedule();
												};
												
												$(liga).innerHTML = this.event_xml_data[liga].liga['-name'];
												
											};
											
											this.hide_loading_gif();
											
										}.bind(this)
										
									});
		
		myRequest.setHeader('Accept','*');
		myRequest.send();
		
	},

	////////////////////
	// get_data_ini()
	// gets game ini
	// - calls "get_data_game()"
	////////////////////
	get_data_ini: function() {
		
		if (this.ini_counter == 0) {
			
			this.show_loading_gif();
			var data_request = new Request.JSON({
													url:'data/'+this.act_data_folder+'/'+this.options.game_id.toUpperCase()+'_INIT.JSN',
													//url:'../json/test/game_ini.json',
													method: 'get',
													//headers: {'X-Request':'JSON'},
													//encoding: 'iso-8859-1',
													onComplete: function(jsonObj) {
														
														if($type(jsonObj))
														{
															this.data_gameini = jsonObj;
															
															this.version = this.data_gameini.Version;
															
															this.get_data_game();
															this.ini_loaded 	= true;
														}
														else
														{
															
															tempFunc = 	function()
																		{
																			if(this.check_refresh('schedule'))
																			{
																				this.update_schedule();
																			};

																			this.ini_counter = 0;
																			this.get_data_ini();
																		}
																		
															tempFunc.delay(3000,this);
															
														};
															
														this.hide_loading_gif();
	
													}.bind(this)
												
												});
			
			data_request.setHeader('Accept','*');
			data_request.send();
			
		} else {
			
			this.get_data_game();
			
			if (this.ini_counter >= 2) {
				
				this.ini_counter = 0;
				
			};
			
		};
		
		this.ini_counter = this.ini_counter + 1;
		
	},

	////////////////////
	// get_data_game()
	// gets game data
	// - calls "update_data()"
	////////////////////
	get_data_game: function() {

		this.show_loading_gif();
		var data_request = new Request.JSON({
												url:'data/'+this.act_data_folder+'/'+this.options.game_id.toUpperCase()+'.JSN',
												//url:'../json/test/game.json',
												method: 'get',
												onComplete: function(jsonObj) {
													
													this.data_game = jsonObj;
													
													if (
															($type(this.data_game) == 'object')
															&&
															(!this.act_game_msg)
														)
													{
														
														if (this.general_updateing == false)
														{
															this.start_general_updating();
														};
														
														//reset
														if (
																(this.old_game != this.data_game.Game)
																&&
																($type(this.old_game))
															)
														{
															this.reset_refresh('small_standing');
															this.reset_refresh('wide_standing');
															this.reset_refresh('game_stat');
															this.reset_refresh('score_dev');
															this.reset_refresh('small_play_by_play');
															this.reset_refresh('full_play_by_play');
															this.reset_refresh('players');
															this.reset_refresh('teams');
															this.reset_refresh('schedule');

															this.reset_refresh('fpbp_Q1');
															this.reset_refresh('fpbp_Q2');
															this.reset_refresh('fpbp_Q3');
															this.reset_refresh('fpbp_Q4');
															
															this.reset_refresh('fpbp_X1');
															this.reset_refresh('fpbp_X2');
															this.reset_refresh('fpbp_X3');
															this.reset_refresh('fpbp_X4');
															this.reset_refresh('fpbp_X5');
															this.reset_refresh('fpbp_X6');
															this.reset_refresh('fpbp_X7');
															this.reset_refresh('fpbp_X8');
															this.reset_refresh('fpbp_X9');

															this.old_game = this.data_game.Game;
															
															//force update
															this.update_data();
															
														};
														
														this.game_loaded 	= true;
														
													} else {
														
														if (this.act_quarter == '') {
															
															if (this.act_game_time == '')
															{
																this.update_elements('div.will-start',	'Dieses Spiel beginnt in K�rze');
															}
															else
															{
																this.update_elements('div.will-start',	'Dieses Spiel beginnt '+this.act_game_time+' Uhr');
															};
															
															if (this.act_game_msg != '')
															{
																this.update_elements('div.will-start',	this.act_game_msg);
															};
															
															if (this.act_set != 7)
															{
																this.switch_set(10);
															};
															
														};
														
													};
													
													this.hide_loading_gif();
													
												}.bind(this)
											
											});

		data_request.setHeader('Accept','*');
		data_request.send();
		
	},

	////////////////////
	//  get_full_play_by_play_data()
	//  - gets (Ajax Request) full data for given Quarter
	//  - calls given Function with given (diplay as $(Element), requested Data as Object, Quarter as String )
	//  - needs display as $(element), Quarter as String, Function as var
	////////////////////
	get_full_play_by_play_data: function(Quarter,tempfunc) {
		
		tempData = '';
		
		if ($type(this.quarter_request[Quarter]) == false) {
			
			this.quarter_request[Quarter] = 'stoped';
			
		};
		
		if (
				(this.quarter_request[Quarter] == 'stoped')
				&&
				(this.quarter_storage_status[Quarter] != 'finished')
			)
		{
		
			this.quarter_request[Quarter] = 'running';
			
			this.show_loading_gif();
			var data_request = new Request.JSON({
													//url:'data/json/game.asp?event_id='+this.options.event_id+'&game='+this.options.game_id+'&perP='+Quarter+'&Fullmode=0',
													url:'data/'+this.act_data_folder+'/'+(this.options.game_id+Quarter).toUpperCase()+'.JSN',
													//url:'../json/test/game_'+Quarter+'.json',
													method: 'get',
													onComplete: function(jsonObj) {
														
														if ($type(jsonObj) == 'object')
														{
														//save quarter data 
															this.save_quarter_actions_to_object(jsonObj.actions,Quarter);
															
															this.quarter_storage_status[Quarter] = 'finished';
															
															if ($type(tempfunc) == 'function') {
																
																tempfunc(Quarter);
																
															}
															
														};
														
														this.quarter_request[Quarter] = 'stoped';
														this.hide_loading_gif();	
													}.bind(this)
												
												});
			
			data_request.setHeader('Accept','*');
			data_request.send();
			
		};
		
	},
	
	/////////////////////
	// event_change_quater
	// - released if the quater is changed
	/////////////////////
	event_change_quater: function() {
		
		this.empty_short_play_by_play();
		
	},
	
	////////////////////
	// update_data()
	// - sets actual Quarter
	// - sets last Quarter
	// - calls "update_small_standing()"
	// - calls "update_game_stat()"
	// - calls "update_()"
	//   ....
	////////////////////
	update_data: function() {
		
		
		if($type(this.data_game) == 'object')
		{
			
			var old_game_status = this.game_status;
			
			// pre game
			if (
					(this.data_game.PLTIME 	== '')
					&&
					(this.data_game.Lastper == '')
					&&
					(this.data_game.ActPer 	!= '')
				)
			{
				this.game_status = 'pre';
			};
			
			// in game
			if (this.data_game.PLTIME 	!= '')
			{
				this.game_status = 'run';
			};
			
			// break
			if (
					(this.data_game.PLTIME 	== '')
					&&
					(this.data_game.Lastper != '')
					&&
					(this.data_game.ActPer 	!= '')
				)
			{
				this.game_status = 'break';
			};
			
			// ende
			if (
					(this.data_game.ActPer 	== 'E')
				)
			{
				this.game_status = 'end';
			};
			
			
			
			
			///////////////////////
			// game status events
			if (
					(old_game_status != this.game_status)
					&&
					(this.game_status == 'end')
				)
			{
				this.stop_updating();
				this.start_updating_slow();
				
				this.set_refresh('small_standing'		,this.options.refresh_time_slow);
				this.set_refresh('wide_standing'		,this.options.refresh_time_slow);
				this.set_refresh('shot_chart'			,this.options.refresh_time_slow);
				this.set_refresh('game_stat'			,this.options.refresh_time_slow);
				this.set_refresh('score_dev'			,this.options.refresh_time_slow);
				this.set_refresh('small_play_by_play'	,this.options.refresh_time_slow);
				this.set_refresh('full_play_by_play'	,this.options.refresh_time_slow);
				this.set_refresh('players'				,this.options.refresh_time_slow);
				this.set_refresh('teams'				,this.options.refresh_time_slow);
				
				this.display_live_label('hide');

			};
			
			if (
					(old_game_status != this.game_status)
					&&
					(this.game_status == 'run')
				)
			{
				
				this.reset_quarter_tabs();
				
				this.stop_updating();
				this.start_updating();
				
				this.display_live_label('show');
				
			};

			if (
					(old_game_status != this.game_status)
					&&
					(this.game_status == 'break')
				)
			{
				this.display_live_label('show');
			};

			if (
					(old_game_status != this.game_status)
					&&
					(old_game_status != 'run')
					&&
					(old_game_status != 'break')
					&&
					(
					 	(this.game_status == 'run')
						||
						(this.game_status == 'break')
					 )
				)
			{
				this.set_refresh('small_standing'		,this.options.refresh_time);
				this.set_refresh('wide_standing'		,this.options.refresh_time);
				this.set_refresh('game_stat'			,this.options.refresh_time);
				this.set_refresh('shot_chart'			,this.options.refresh_time);
				this.set_refresh('score_dev'			,this.options.refresh_time);
				this.set_refresh('small_play_by_play'	,this.options.refresh_time);
				this.set_refresh('full_play_by_play'	,this.options.refresh_time);
				this.set_refresh('players'				,this.options.refresh_time);
				this.set_refresh('teams'				,this.options.refresh_time);
			};

			// game status events
			///////////////////////

			//////////////////////////////////////////////
			
			var quater_old = this.act_quarter;
			
			switch (this.game_status) {
				
				
				case 'pre':
				
					this.perStr = '';
					this.plTimeMin = '';
				
				break;
	
				case 'run':
				
					this.perStr 		= this.data_2_status_game_string(this.data_game.ActPer);
					this.plTimeMin 		= '('+this.data_game.PLTIME+')<br> Minuten zu spielen';
					this.act_quarter 	= this.data_game.ActPer;
	
				break;
	
				case 'break':
	
					this.perStr 		= this.data_2_status_game_string(this.data_game.Lastper);
					this.plTimeMin		= '(beendet)';
					this.act_quarter 	= this.data_game.Lastper;
	
				break;
	
				case 'end':
				
					this.perStr 		= 'Spiel beendet';
					this.plTimeMin 		= '';
					this.act_quarter 	= this.data_game.Lastper;
					
				break;
				
			};
			
			if (quater_old != this.act_quarter) {
				
				this.event_change_quater();
				
			};
			
			if (this.data_game.length != 0) {
				
				
				if (this.data_game.CurPer != '')
				{
					this.save_quarter_actions_to_object(this.data_game.actions ,this.data_game.CurPer);
					this.check_refresh('fpbp_'+this.data_game.CurPer);
				};
				
				switch (this.act_set) {
					
					case 0:
						//set 0 -> Login
					case 1:
						//set 1 -> Gamestat
						if(this.check_refresh('wide_standing'))
						{
							this.update_wide_standing();
						};
						if(this.check_refresh('game_stat'))
						{
							this.update_game_stat();
						};
						if(this.check_refresh('score_dev'))
						{
							this.update_score_dev();
						};
						if(this.check_refresh('small_play_by_play'))
						{
							this.update_small_play_by_play();
						};
					break;
					case 2:
						//set 2 -> full play by play
						if(this.check_refresh('wide_standing'))
						{
							this.update_wide_standing();
						};
						if(this.check_refresh('full_play_by_play'))
						{
							this.update_full_play_by_play();
						};
					break;
					case 3:
						//set 3 -> Players
						if(this.check_refresh('wide_standing'))
						{
							this.update_wide_standing();
						};
						if(this.check_refresh('players'))
						{
							this.update_players();
						};
						if(this.check_refresh('small_play_by_play'))
						{
							this.update_small_play_by_play();
						};
					break;
					case 4:
						//set 4 -> Teams
						if(this.check_refresh('wide_standing'))
						{
							this.update_wide_standing();
						};
						if(this.check_refresh('teams'))
						{
							this.update_teams();
						};
						if(this.check_refresh('small_play_by_play'))
						{
							this.update_small_play_by_play();
						};
					break;
					case 5:
						//set 5 -> shot-Chart
						if(this.check_refresh('wide_standing'))
						{
							this.update_wide_standing();
						};
						if(this.check_refresh('shot_chart'))
						{
							this.update_shot_chart();
						};
					break;
					case 6:
						// set 6 -> Standing
						if(this.check_refresh('small_standing'))
						{
							this.update_small_standing();
						};
						if(this.check_refresh('small_play_by_play'))
						{
							this.update_small_play_by_play();
						};
					break;
					case 7:
						//set 7 -> Schedule
						if(this.check_refresh('wide_standing'))
						{
							this.update_wide_standing();
						};
						if(this.check_refresh('schedule'))
						{
							this.update_schedule();
						};
						if(this.check_refresh('small_play_by_play'))
						{
							this.update_small_play_by_play();
						};
					break;
					case 8:
						// set 8 -> Login
						if(this.check_refresh('small_standing'))
						{
							this.update_small_standing();
						};
					break;
					default:
						/*
						this.update_small_standing();
						this.update_game_stat();
						this.update_();
						this.update_small_play_by_play();
						this.update_wide_standing();
						//this.update_full_play_by_play();
						this.update_players();
						this.update_teams();
						this.update_shot_chart();
						*/
					break;
					
				};
				
				// switch to statistic screen
				if (this.act_set == 0) 
				{
					temp_func = function()
					{
						this.switch_set(1);
					};
					temp_func.delay(500,this);
				};
				
				if (
						(this.ini_loaded == true)
						&&
						(this.game_loaded == true)
						&&
						(this.act_set == 10)
					)
				{
					this.switch_set(1);
				};
				
			}else{
				
				this.switch_set(9);
				
			};
	
			//timestamp('update_data finish');
		};
		
	},
	
	////////////////////
	// change_game()
	////////////////////
	change_game: function(game_id,act_folder_name) {
		
		this.ini_loaded 	= false;
		this.game_loaded 	= false;
		
		this.change_css();
		
		this.empty_short_play_by_play();
		
		this.old_game = this.options.game_id;
		
		this.data_gameini = '';
		this.data_game = '';
		
		this.update_elements('td.game-stat-status','');
		
		this.update_elements('div.logo_team_A','');
		this.update_elements('div.logo_team_B','');
		
		this.update_elements('td.wide-standing-nat-AB-value','');
		this.update_elements('td.wide-standing-nat-A','');
		
		this.teamlogos = false;
		
		this.ini_counter = 0;
		this.first_update = 1;
		this.stop_updating();
		
		this.game_status			= '';
		this.act_quarter			= '';
		this.choosen_quarter		= '';
		this.choosen_Team			= 'A';

		this.act_data_folder = act_folder_name;
		
		this.options.game_id = game_id;
		
		this.shot_chart_Check = $empty;
		this.shot_chart_Check = new Object;
		
		this.refresh_storage = $empty;
		this.refresh_storage = new Object();
		
		//set timeout

		this.set_refresh('small_standing'		,this.options.refresh_time);
		this.set_refresh('wide_standing'		,this.options.refresh_time);
		this.set_refresh('game_stat'			,this.options.refresh_time);
		this.set_refresh('score_dev'			,this.options.refresh_time);
		this.set_refresh('small_play_by_play'	,this.options.refresh_time);
		this.set_refresh('full_play_by_play'	,this.options.refresh_time);
		this.set_refresh('players'				,this.options.refresh_time);
		this.set_refresh('teams'				,this.options.refresh_time);
		this.set_refresh('schedule'				,this.options.refresh_time);

		this.set_refresh('liga-bbl'				,this.options.refresh_time);
		this.set_refresh('liga-bbl2proa'		,this.options.refresh_time);
		this.set_refresh('liga-bbl2prob'		,this.options.refresh_time);
		this.set_refresh('liga-extra'			,this.options.refresh_time);
		
		this.set_refresh('fpbp_Q1'				,this.options.refresh_time);
		this.set_refresh('fpbp_Q2'				,this.options.refresh_time);
		this.set_refresh('fpbp_Q3'				,this.options.refresh_time);
		this.set_refresh('fpbp_Q4'				,this.options.refresh_time);
		
		this.set_refresh('fpbp_X1'				,this.options.refresh_time);
		this.set_refresh('fpbp_X2'				,this.options.refresh_time);
		this.set_refresh('fpbp_X3'				,this.options.refresh_time);
		this.set_refresh('fpbp_X4'				,this.options.refresh_time);
		this.set_refresh('fpbp_X5'				,this.options.refresh_time);
		this.set_refresh('fpbp_X6'				,this.options.refresh_time);
		this.set_refresh('fpbp_X7'				,this.options.refresh_time);
		this.set_refresh('fpbp_X8'				,this.options.refresh_time);
		this.set_refresh('fpbp_X9'				,this.options.refresh_time);
		
		this.quarter_storage = $empty;
		this.quarter_storage = new Object ();
		this.quarter_storage_status = $empty;
		this.quarter_storage_status = new Object ();

		this.object_full_play_by_play_displays 	= $empty;
		this.object_full_play_by_play_displays	= new Object ();
		this.object_full_play_by_play_data		= $empty;
		this.object_full_play_by_play_data		= new Object ();
		
		this.update_elements('td.full-play-by-play-tab-placeholder-Q1','');
		this.update_elements('td.full-play-by-play-tab-placeholder-Q2','');
		this.update_elements('td.full-play-by-play-tab-placeholder-Q3','');
		this.update_elements('td.full-play-by-play-tab-placeholder-Q4','');
		this.update_elements('td.full-play-by-play-tab-placeholder-OT','');

		this.update_elements('td.full-play-by-play-tab-placeholder-X1','');
		this.update_elements('td.full-play-by-play-tab-placeholder-X2','');
		this.update_elements('td.full-play-by-play-tab-placeholder-X3','');
		this.update_elements('td.full-play-by-play-tab-placeholder-X4','');
		this.update_elements('td.full-play-by-play-tab-placeholder-X5','');
		this.update_elements('td.full-play-by-play-tab-placeholder-X6','');
		this.update_elements('td.full-play-by-play-tab-placeholder-X7','');
		this.update_elements('td.full-play-by-play-tab-placeholder-X8','');
		this.update_elements('td.full-play-by-play-tab-placeholder-X9','');

		this.update_elements('play_by_play_tab_display_Q1','');
		this.update_elements('play_by_play_tab_display_Q2','');
		this.update_elements('play_by_play_tab_display_Q3','');
		this.update_elements('play_by_play_tab_display_Q4','');

		this.update_elements('play_by_play_tab_display_X1','');
		this.update_elements('play_by_play_tab_display_X2','');
		this.update_elements('play_by_play_tab_display_X3','');
		this.update_elements('play_by_play_tab_display_X4','');
		this.update_elements('play_by_play_tab_display_X5','');
		this.update_elements('play_by_play_tab_display_X6','');
		this.update_elements('play_by_play_tab_display_X7','');
		this.update_elements('play_by_play_tab_display_X8','');
		this.update_elements('play_by_play_tab_display_X9','');

		this.switch_set(0);
		
		if (Browser.Engine.trident4)
		{
			$$('td.navi')[0].setStyles(
										{
											'background': 'none',
											'filter': 'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src=\'img/header_'+this.schedule_coosen_liga.toLowerCase()+'_bg.png\', sizingMethod=\'scale\')'
										});
		}
		else
		{
			$$('table.header-1')[0].setStyle('background-image', 'url(img/header_'+this.schedule_coosen_liga.toLowerCase()+'_bg.png)');
		};
		
		my_func_1 = function () {
						this.load_data();
						this.start_updating();
					};
		my_func_1.delay(1000,this);
		
	},
	
	//////////////////////
	// display_live_label()
	//////////////////////
	display_live_label: function(status) {
		
		var temp_label_status = '';
		
		if (status == 'show')
		{
			temp_label_status = 'visible';
		}
		else
		{
			temp_label_status = 'hidden';
		}
		
		$$('div.box_live').each(function(label_item,label_index){
		
			label_item.setStyle('visibility',temp_label_status);
		
		});
		
	},
	
	//////////////////////
	// update functions //
	//////////////////////
	
	//////////////////////
	// reset_quarter_tabs
	//////////////////////
	reset_quarter_tabs: function(){
		
		this.data_game.statper.each(function(item,index)
			{

				var tempQuater = item[this.conf_vers[this.version].statper['Per']];

				this.reset_refresh('full_play_by_play');
				
				this.quarter_storage = $empty;
				this.quarter_storage = new Object ();
				this.quarter_storage_status = $empty;
				this.quarter_storage_status = new Object ();
				
				if ($('play_by_play_tab_display_'+tempQuater)) {
					
					$('play_by_play_tab_display_'+tempQuater).innerHTML = '...';
					
				};				
				
			}.bind(this)
		);
		
		this.update_full_play_by_play();
		
	},
	
	//////////////////////
	// update_elements
	//////////////////////
	update_elements: function(selector,_value)
	{
		
		if (selector.contains('.'))
		{
			tempElem = $$(selector);
		}
		else
		{
			tempElem = document.getElementsByName(selector);
			if ($type(tempElem) == 'collection')
			{
				tempElemArray = new Array();
				for(var i = 0; i < tempElem.length; i++)
				{
					tempElemArray.push(tempElem[i]);
				};
				
				tempElem = tempElemArray;
			};
		};
		
		value_type = $type(_value);
		
		switch (value_type) {
			
			case 'string':
				// string
				$splat(tempElem).each(function (item_elem)
					{
						item_elem.innerHTML = _value;
					}
				);
			break;
			
			case 'number':
				// string
				$splat(tempElem).each(function (item_elem)
					{
						item_elem.innerHTML = _value;
					}
				);
			break;
			
			case 'element':
				// domstrang
				$splat(tempElem).each(function (item_elem)
					{
						item_elem.innerHTML = '';
						_value.inject(item_elem);
					}
				);
			break;
			
		};
		
	},
	
	////////////////////
	// handle_empty
	////////////////////
	handle_empty: function(value,new_string) {
		
		var temp_return = value;
		if (value == '')
		{
			temp_return = new_string
		};
		return temp_return;
		
	},
	
	////////////////////
	//  update small_standing
	////////////////////
	update_small_standing: function() {
		
		this.update_elements('small-standing-header',
							 this.data_gameini.teamroster[0].TeamName + '&nbsp;&nbsp; vs &nbsp;&nbsp;' +this.data_gameini.teamroster[1].TeamName);
		
		this.update_elements('CompName',		 this.data_gameini.CompName);
		this.update_elements('score-left',	 this.data_game.RA);
		this.update_elements('score-right',	 this.data_game.RB);
		
		this.update_elements('status-game',	 this.perStr);
		this.update_elements('status-time',	 this.plTimeMin);
			
		// set header

		if (
				(this.game_status == 'end')
				||
				(this.game_status == 'pre')
			)
		{
			$$('tr.hl-1-stand').each(function (item_){
											   			item_.setStyle('background-image', 'url(img/livestatistic_stand.jpg)');
													});
		} else {
			$$('tr.hl-1-stand').each(function (item_){
											   			item_.setStyle('background-image', 'url(img/livestatistic_stand_live.jpg)');
													});
		};
		
	},

	////////////////////
	//  update wide_standing
	////////////////////
	update_wide_standing: function() {
		
		if (!this.teamlogos)
		{
			if (Browser.Engine.trident4)
			{
				if	(
						($type(this.data_gameini.teamroster[0].TID.toInt()) == 'number')
						&&
						(
							(this.data_gameini.teamroster[0].TID.toInt() != 1008)
							&&
							(this.data_gameini.teamroster[0].TID.toInt() != 1002)
							&&
							(this.data_gameini.teamroster[0].TID.toInt() != 1021)
							&&
							(this.data_gameini.teamroster[0].TID.toInt() != 1030)
						)
					)
				{
					this.update_elements('div.logo_team_A','<div style="width:288px;height:83px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'img/teamlogos/'+this.data_gameini.teamroster[0].TID+'a.png?v2\', sizingMethod=\'image\');"></div>');
				};
				if	(
						($type(this.data_gameini.teamroster[1].TID.toInt()) == 'number')
						&&
						(
							(this.data_gameini.teamroster[1].TID.toInt() != 1008)
							&&
							(this.data_gameini.teamroster[1].TID.toInt() != 1002)
							&&
							(this.data_gameini.teamroster[1].TID.toInt() != 1021)
							&&
							(this.data_gameini.teamroster[1].TID.toInt() != 1030)
						)
					)
				{
					this.update_elements('div.logo_team_B','<div style="width:288px;height:83px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'img/teamlogos/'+this.data_gameini.teamroster[1].TID+'b.png?v2\', sizingMethod=\'image\');"></div>');
				};
			}
			else
			{
				if	(
						($type(this.data_gameini.teamroster[0].TID.toInt()) == 'number')
						&&
						(
							(this.data_gameini.teamroster[0].TID.toInt() != 1008)
							&&
							(this.data_gameini.teamroster[0].TID.toInt() != 1002)
							&&
							(this.data_gameini.teamroster[0].TID.toInt() != 1021)
							&&
							(this.data_gameini.teamroster[0].TID.toInt() != 1030)
						)
					)
				{
					this.update_elements('div.logo_team_A','<img alt="'+this.data_gameini.teamroster[0].TeamName+'" width="288" height="83" src="img/teamlogos/'+this.data_gameini.teamroster[0].TID+'a.png?v2" />');
				};
				if	(
						($type(this.data_gameini.teamroster[1].TID.toInt()) == 'number')
						&&
						(
							(this.data_gameini.teamroster[1].TID.toInt() != 1008)
							&&
							(this.data_gameini.teamroster[1].TID.toInt() != 1002)
							&&
							(this.data_gameini.teamroster[1].TID.toInt() != 1021)
							&&
							(this.data_gameini.teamroster[1].TID.toInt() != 1030)
						)
					)
				{
					this.update_elements('div.logo_team_B','<img alt="'+this.data_gameini.teamroster[1].TeamName+'" width="288" height="83" src="img/teamlogos/'+this.data_gameini.teamroster[1].TID+'b.png?v2" />');
				};
			}
		};
		this.teamlogos = true;
		
		if	(
				($type(this.data_gameini.teamroster[0].TID.toInt()) == 'number')
				&&
				(
					(this.data_gameini.teamroster[0].TID.toInt() != 1008)
					&&
					(this.data_gameini.teamroster[0].TID.toInt() != 1002)
					&&
					(this.data_gameini.teamroster[0].TID.toInt() != 1021)
					&&
					(this.data_gameini.teamroster[0].TID.toInt() != 1030)
				)
			)
		{
			this.update_elements('td.wide-standing-nat-A-value',	'&nbsp;');
		}
		else
		{
			this.update_elements('td.wide-standing-nat-A-value',	this.data_gameini.teamroster[0].TeamName);
		}
		
		if	(
				($type(this.data_gameini.teamroster[1].TID.toInt()) == 'number')
				&&
				(
					(this.data_gameini.teamroster[1].TID.toInt() != 1008)
					&&
					(this.data_gameini.teamroster[1].TID.toInt() != 1002)
					&&
					(this.data_gameini.teamroster[1].TID.toInt() != 1021)
					&&
					(this.data_gameini.teamroster[1].TID.toInt() != 1030)
				)
			)
		{
			this.update_elements('td.wide-standing-nat-B-value',	'&nbsp;');
		}
		else
		{
			this.update_elements('td.wide-standing-nat-B-value',	this.data_gameini.teamroster[1].TeamName);
		}

		this.update_elements('td.wide-standing-nat-AB-value',	this.handle_empty(this.data_game.RA,0) + ' : ' + this.handle_empty(this.data_game.RB,0));
		
		this.update_elements('td.wide-standing-2p-left',	
							 this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P2G],0) + '/' + this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P2A],0) + ' ('+this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P2P],0)+'%)');
		this.update_elements('td.wide-standing-2p-right',	
							 this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P2G],0) + '/' + this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P2A],0) + ' ('+this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P2P],0)+'%)');
		
		this.update_elements('td.wide-standing-3p-left',	
							 this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P3G],0) + '/' + this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P3A],0) + ' ('+this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P3P],0)+'%)');
		this.update_elements('td.wide-standing-3p-right',	
							 this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P3G],0) + '/' + this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P3A],0) + ' ('+this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P3P],0)+'%)');
		
		this.update_elements('td.wide-standing-ft-left',	
							 this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P1G],0) + '/' + this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P1A],0) + ' ('+this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P1P],0)+'%)');
		this.update_elements('td.wide-standing-ft-right',	
							 this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P1G],0) + '/' + this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P1A],0) + ' ('+this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P1P],0)+'%)');

	},
	
	////////////////////
	//  update game-stat
	////////////////////
	update_game_stat: function() {
		
		tempGameStat = '';
		tempGameStat = '<div class="game-stat-perstring">'+this.perStr+'</div>';
		tempGameStat = tempGameStat+'<div class="game-stat-plmin">'+this.plTimeMin+'</div>';

		this.update_elements('td.game-stat-status',tempGameStat);

		this.update_elements('game-stat-TeamA',	 this.data_gameini.teamroster[0].TeamName);
		this.update_elements('game-stat-TeamB',	 this.data_gameini.teamroster[1].TeamName);

		this.update_elements('game-statistics-2-pointers-A',	 this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P2G],0) + '/' + this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P2A],0) + ' ('+this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P2P],0)+'%)');
		this.update_elements('game-statistics-2-pointers-B',	 this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P2G],0) + '/' + this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P2A],0) + ' ('+this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P2P],0)+'%)');

		this.update_elements('game-statistics-3-pointers-A',	 this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P3G],0) + '/' + this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P3A],0) + ' ('+this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P3P],0)+'%)');
		this.update_elements('game-statistics-3-pointers-B',	 this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P3G],0) + '/' + this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P3A],0) + ' ('+this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P3P],0)+'%)');
		
		this.update_elements('game-statistics-FreeThrows-A',	this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P1G],0) + '/' + this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P1A],0) + ' ('+this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.P1P],0)+'%)');
		this.update_elements('game-statistics-FreeThrows-B',	this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P1G],0) + '/' + this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P1A],0) + ' ('+this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.P1P],0)+'%)');
		
		
		this.update_elements('game-statistics-Fouls-A',this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.Foul],0));
		this.update_elements('game-statistics-Fouls-B',this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.Foul],0));
		
		this.update_elements('game-statistics-Steals-A',this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.ST],0));
		this.update_elements('game-statistics-Steals-B',this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.ST],0));
		
		this.update_elements('game-statistics-TurnOver-A',this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.TO],0));
		this.update_elements('game-statistics-TurnOver-B',this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.TO],0));
		
		this.update_elements('game-statistics-OffRebound-A',this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.OREB],0));
		this.update_elements('game-statistics-OffRebound-B',this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.OREB],0));
		
		this.update_elements('game-statistics-DefRebound-A',this.handle_empty(this.data_game.statteam[0][this.conf_vers[this.version].stat_team.DREB],0));
		this.update_elements('game-statistics-DefRebound-B',this.handle_empty(this.data_game.statteam[1][this.conf_vers[this.version].stat_team.DREB],0));
		
		this.update_elements('game-statistics-BiggestLead-A',this.handle_empty(this.data_game.scorestat[this.conf_vers[this.version].scorestat.LeadA],0));
		this.update_elements('game-statistics-BiggestLead-B',this.handle_empty(this.data_game.scorestat[this.conf_vers[this.version].scorestat.LeadB],0));
		
		this.update_elements('game-statistics-BiggestRun-A',this.handle_empty(this.data_game.scorestat[this.conf_vers[this.version].scorestat.RunA],0));
		this.update_elements('game-statistics-BiggestRun-B',this.handle_empty(this.data_game.scorestat[this.conf_vers[this.version].scorestat.RunB],0));
		
	},
	
	////////////////////
	//  update score def
	////////////////////
	update_score_dev: function() {
		

		this.update_elements('score-dev-short-Team-A',	this.data_gameini.teamroster[0].Team);
		this.update_elements('score-dev-short-Team-B',	this.data_gameini.teamroster[1].Team);
		
		this.drw_graph('score_graph',162,238,this.build_point_array());
		this.old_img_path = this.data_game.RA+':'+this.data_game.RB;
		
	},
	
	////////////////////
	// build_point_array()
	////////////////////
	build_point_array: function(team) {
		
		tempObject = new Object();
		tempObject['A'] = new Array();
		tempObject['B'] = new Array();
		
		$splat(this.data_game.scorelist).each(
			function(score_item,score_index)
			{
				
				var posX = this.time_to_point(score_item[this.conf_vers[this.version].scorelist.Min] , score_item[this.conf_vers[this.version].scorelist.Per])
				
				new_Object = new Object;
				new_Object['posX'] = posX;
				new_Object['posY'] = score_item[this.conf_vers[this.version].scorelist.Points_A];
				tempObject['A'].push(new_Object);

				new_Object = new Object;
				new_Object['posX'] = posX;
				new_Object['posY'] = score_item[this.conf_vers[this.version].scorelist.Points_B];
				tempObject['B'].push(new_Object);

			}.bind(this)
		);
		
		return tempObject;
		
	},
	
	////////////////////
	// time_to_point(time,quarter)
	////////////////////
	time_to_point: function(time,quarter){
		
		tempAdd = 0;
		
		switch (quarter)
		{
			
			case "Q1":
				tempAdd = 0;
			break;
			case "Q2":
				tempAdd = 10;
			break;
			case "Q3":
				tempAdd = 20;
			break;
			case "Q4":
				tempAdd = 30;
			break;
			case "X1":
				tempAdd = 35;
			break;
			case "X2":
				tempAdd = 40;
			break;
			case "X3":
				tempAdd = 45;
			break;
			case "X4":
				tempAdd = 50;
			break;
			case "X5":
				tempAdd = 55;
			break;
			case "X6":
				tempAdd = 60;
			break;
			case "X7":
				tempAdd = 65;
			break;
			case "X8":
				tempAdd = 70;
			break;
			case "X9":
				tempAdd = 75;
			break;
			
		};
		temptimearray = time.split(":")
		tempX = temptimearray[0];
		
		tempX = tempAdd + (10-tempX.toInt());
		
		return tempX;
		
	},
	
	////////////////////
	// calculate_real_points(point)
	////////////////////
	calculate_real_points: function (height,width,point){
		
		real_point = new Object();
		
		real_point['x'] = point.posX * width / 40;
		real_point['y'] = height-(point.posY * height / 120);
		return real_point;
		
	},
	
	////////////////////
	// drw_graph()
	////////////////////
	drw_graph: function(element,width,height,data_object) {
		
		array_1 = data_object['A'];
		array_2 = data_object['B'];
		
		//var container = $('chart');
		//var textCanvasController = new TextCanvasController(container);
	
		var map = document.getElementById(element).getContext("2d");
		
		
			CanvasTextFunctions.enable(map);
		
			map.clearRect(0,0,284,height);
			
			//red
			map.strokeStyle = 'red';
			map.beginPath();
			map.moveTo(0, height);
			array_1.each(
				function(item)
				{
					point = this.calculate_real_points(height,width,item);
					map.lineTo(point.x,point.y);
				}.bind(this)
			)
			map.stroke();

			//black
			map.strokeStyle = 'black';
			map.beginPath();
			map.moveTo(0, height);
			array_2.each(
				function(item)
				{
					point = this.calculate_real_points(height,width,item);
					map.lineTo(point.x,point.y);
				}.bind(this)
			)
			map.stroke();
			
			// OT Maske
			tempPeriods 		= this.data_game.statper;

			tempOTCounter = 0
			
			tempPeriods.each(function (item_period){
				if (item_period[0].test("X"))
				{
					tempOTCounter = tempOTCounter + 1;
				}
			});
			tempOTCounter = 6 - tempOTCounter;
			
			map.fillStyle = 'rgba(255,255,255,1)';
			map.fillRect( 284-(tempOTCounter*20), 0, (tempOTCounter*20), 238 );			

			map.strokeStyle = 'rgba(0,0,0,0.2)'; 
			map.lineWidth = 0.5;
			map.strokeRect( 172.5, 99.5, 111, 121 );

			map.fillStyle = 'rgba(255,255,255,0.4)';
			map.fillRect( 173, 100, 110, 120 );

			map.strokeStyle = 'rgba(0,0,0,1)';
			
			tempPeriods.each(function (item_period,index_period){
				
				map.drawText('',9,180,115.5+(14*index_period),this.data_2_status_game_string(item_period[0]));
				
				//map.stringStyle.color = 'black';
				//map.drawString(180, 115.5+(14*index_period),this.data_2_status_game_string(item_period[0]));


				
				var tempFeld_A		= '';
				var tempFeld_B		= '';
				var tempString_1 	= item_period[0].substring(0, 1);
				var tempString_2 	= item_period[0].substring(1, 2);
				
				if (tempString_1.test("Q"))
				{
					tempFeld_A = 'RA'+tempString_2;
					tempFeld_B = 'RB'+tempString_2;
				};
				if (tempString_1.test("X"))
				{
					tempFeld_A = 'OT'+tempString_2+'A';
					tempFeld_B = 'OT'+tempString_2+'B';
				};

				map.drawText('',8,240,115.5+(14*index_period),'('+this.handle_empty(this.data_game[tempFeld_A],0));
																								   
				map.drawText('',8,260,115.5+(14*index_period),':');
				
				map.drawText('',8,265,115.5+(14*index_period),this.handle_empty(this.data_game[tempFeld_B],0)+')');

			}.bind(this));

	},

	////////////////////
	//  empty_short_play_by_play
	////////////////////
	empty_short_play_by_play: function () {
		
		var Zaehler = 0;
		
		while (Zaehler <= 4)
		{
		this.update_elements('td.small-play-by-play-left-'+Zaehler,	'&nbsp;');
		this.update_elements('td.small-play-by-play-right-'+Zaehler, '&nbsp;');
		  Zaehler++;
		};
 
		
	},
	
	////////////////////
	//  update small-play-by-play
	////////////////////
	update_small_play_by_play: function() {

		tempQater = this.act_quarter;
		
		if ($type(this.quarter_storage[tempQater]))
		{
			if ($type(this.quarter_storage[tempQater][0]) == 'string')
			{
				temp_act_data = new Array(0);
				temp_act_data.push(this.quarter_storage[tempQater]);
			} 
			else 
			{
				temp_act_data = this.quarter_storage[tempQater];
			};
		} 
		else 
		{
				temp_act_data = this.quarter_storage[tempQater];
		};
		
		new_temp_array = new Array();
		
		$splat(temp_act_data).each(
			function(item,index)
			{
				new_temp_array.push(item);
			}.bind(this)
		)
		
		//new_temp_array.reverse();

		//this.data_game.actions.each(function(item, index){
		//$splat(this.quarter_storage[tempQater]).each(function(item, index){
		new_temp_array.each(function(item, index){
		
			if (index <= 4) {
				
				if ((item[this.conf_vers[this.version].actions.PlTime]) && (this.get_action_string(item))) {
					
					this.update_elements('small-play-by-play-left-'+index,	item[this.conf_vers[this.version].actions.PlTime]);
					this.update_elements('small-play-by-play-right-'+index,	this.get_action_string(item,tempQater));
					
				};
				
			};
				
		}.bind(this));
		
	},

	////////////////////
	//  update_full_play_by_play
	////////////////////
	update_full_play_by_play: function() {
		
		//check quater tabs
		this.data_game.statper.each(function(item,index){
			
			if (
					((index % 2) == 0 )
					||
					(true)
				)
			{
				var tempQuater = item[this.conf_vers[this.version].statper['Per']];
				
				if ($$('td.full-play-by-play-tab-placeholder-'+tempQuater)[0].innerHTML == '') 
				{
					
					// make tab
					temp_tab = new Element('div', 	{
						'class': 'play-by-play-tab ' + tempQuater,
						'html': this.data_2_status_game_string(tempQuater),
						'styles': {
									'display': 'block',
									'background-color': '#CDCDCD'
						},
						'events': {
									'click': function(){
											this.switch_quarter_in_play_by_play(tempQuater);
									}.bind(this)
						}
					});
				
					temp_tab.inject($$('td.full-play-by-play-tab-placeholder-'+tempQuater)[0]);

					// make display
					
					if (!$('play_by_play_tab_display_'+tempQuater)) {
					
						temp_tab_display = new Element('div', 	{
							'id': 'play_by_play_tab_display_' + tempQuater,
							'class': 'play-by-play-tab-display',
							'html': '...',
							'styles': {
										'display': 'none'
							}
						});
						
						temp_tab_display.inject($$('div.full-play-by-play-scroll')[0]);
						
					};
					
				};
			};
		
		}.bind(this));
		
		// set choosen_quater
		if (this.choosen_quarter == '')
		{
			
			this.switch_quarter_in_play_by_play(this.act_quarter);
			
		};
		
		this.render_play_by_play();

	},
	
	////////////////////
	//  update players
	////////////////////
	update_players: function () {
		
		// header
		this.update_elements('td.players-team-A-Name',this.data_gameini.teamroster[0].TeamName);
		this.update_elements('td.players-team-B-Name',this.data_gameini.teamroster[1].TeamName);
		
		//Data	
		
		temp_TeamsObj = new Object();
		
		temp_TeamsObj['A'] = new Array();
		temp_TeamsObj['B'] = new Array();
		
		this.data_game.statind.each(function (item,index){
			
			if (item[this.conf_vers[this.version].statind['TC']] == 'A') {
				
				temp_TeamsObj['A'].push(item);
				
			}else{
				
				temp_TeamsObj['B'].push(item);
				
			};
			
		}.bind(this));
		
		this.render_players('A',temp_TeamsObj['A']);
		this.render_players('B',temp_TeamsObj['B']);
		
	},

	////////////////////
	//  update teams
	////////////////////
	update_teams: function () {
		
		this.render_teams();
		
	},
	
	////////////////////
	//  update schedule
	////////////////////
	update_schedule: function () {
		
		var tempLiga = this.schedule_coosen_liga;
		
		if (tempLiga == '')
		{
			tempLiga = this.options.event_id;
		};
		
		if (
				($type(this.event_xml_data[tempLiga]))
				&&
				(!this.check_refresh('liga-'+tempLiga.toLowerCase()))
			)
		{
			
			if (this.event_xml_data[tempLiga+'-spieltag']+'' != '0')
			{
				$$('div.schedule-header')[0].innerHTML = 'Spielplan f&uuml;r den '+this.event_xml_data[tempLiga+'-spieltag']+'. Spieltag';
			}
			else
			{
				$$('div.schedule-header')[0].innerHTML = '&nbsp;';
			};
			
			temp_Array_Games = this.build_schedule_array(this.event_xml_data[tempLiga],tempLiga);
	
			///////////////
			// spieltag table
			//
			temp_table = new Element('table', {
				'class'	: 'schedule-table',
				'cellspacing' : 0,
				'cellpadding' : 0,
				'border'	  : 0
			});
	
			temp_tbody = new Element('tbody', {
				'class'	: 'schedule-tbody'
			});
	
			
			act_temp_String_Date 		= '';
			act_temp_String_Gender 		= '';
			act_temp_String_Round 		= '';
			
			
			temp_Array_Games.each(function (item,index) {
				
				if (item['Id'] == this.options.game_id) {
				
					this.act_game_time 		= item['Time'];
					this.act_game_msg		= item['MSG'];
					
					if (!item['MSG'])
					{
						this.switch_MSG_on_off('off');
					}
					else
					{
						this.switch_MSG_on_off('on');
					}
				
				};
				
				modulo = 'odd';
				if ((index % 2) == 1) {
					modulo = 'even';
				};
				
				// Game Entrys
				temp_tr = new Element('tr', {
					'class'		: 'schedule-tr-game-'+modulo
				});
				
				if (
						(item['Status'] == 'R')
						|| 
						(item['Status'] == 'I')
						|| 
						(item['Status'] == 'F')
					)
				{
					temp_tr.setStyle('cursor', 'pointer');
					temp_tr.addEvent('click', function()
													   {
															this.options.event_id = tempLiga;
															this.change_game(item['Id'],item['DataFolder']);
															this.act_game_time = item['Time'];
															this.act_game_msg = item['MSG'];
														}.bind(this)
									);
				};
				
				temp_td = new Element('td', {
					'class'	: 'schedule-td-game-Names',
					'html' : '<div style="padding-bottom:5px;">'+item['Full_Name_A']+'</div><div>'+ item['Full_Name_B']+'</div>'
				});
				temp_td.inject(temp_tr);
				
				var tempDate = '';
				if ($type(item['Date']))
				{
					tempDate = item['Date'];
				}
				else
				{
					tempDate = '';
				}
				
				var tempTime = '';
				if ($type(item['Time']))
				{
					tempTime = item['Time'];
				}
				else
				{
					tempTime = '';
				}
				
				var temp_standing 		= '';
				var temp_Date_Time 		= '';
				var temp_quarter_time 	= '';
				var temp_top_scorer		= '';
				if	(
						(item['TopName_A'] != '')
						||
						(item['TopName_B'] != '')
					)
				{
					temp_top_scorer	= '<div>Topscorer '+item['TopName_A']+' '+item['TopPkt_A']+' Pkt.</div>'+
									  '<div>Topscorer '+item['TopName_B']+' '+item['TopPkt_B']+' Pkt.</div>';
				}
				else
				{
					temp_top_scorer = '&nbsp;';
				}
				//  Status:
				//  I: upcoming
				//  R: running
				//  S: ???
				//	F: finished
				
				if (!item['MSG'])
				{
					
					
					if  (
							(item['quarter'] != '')
							&&
							(item['plTime'] != '')
						)
					{
						temp_quarter_time 	= item['quarter']+' - '+item['plTime'];
					}
					else
					{
						temp_quarter_time 	= item['quarter']+'&nbsp;'+item['plTime'];
					}
					
					
					if (item['Status'] == 'R') {
						temp_standing 		= this.build_standing_str(item['Pts_A'],item['Pts_B'])+'&nbsp;';
						temp_Date_Time 		= '<span style="color:red;">live</span>';
					} else if ((item['Status'] == 'S') || (item['Status'] == 'I')) {
						temp_Date_Time 	= tempDate+'<br>'+tempTime+'h';
						temp_top_scorer = '&nbsp;';
						temp_quarter_time = '&nbsp;';
						temp_standing	= '&nbsp;';
					} else {
						temp_standing 	= this.build_standing_str(item['Pts_A'],item['Pts_B'])+'</b>';
						temp_Date_Time 	= tempDate+'<br>'+tempTime+'h';
					}
					if (temp_standing == '')
					{
						temp_Date_Time 	= tempDate+'<br>'+tempTime+'h';
						temp_top_scorer = '&nbsp;';
						temp_quarter_time = '&nbsp;';
					}
					if (item['Status'] == 'F')
					{
						temp_quarter_time = '(Endstand)';
					};
					
					temp_td = new Element('td', {
						'class'	: 'schedule-td-game-Time',
						'html' : temp_Date_Time
					});
					temp_td.inject(temp_tr);
					
				}
				else
				{
					temp_td = new Element('td', {
						'class'	: 'schedule-td-game-MSG',
						'html' : item['MSG']
					});
					temp_td.inject(temp_tr);
				}

				//standing
				temp_td = new Element('td', {
					'class'	: 'schedule-td-game-Standing',
					'html' : temp_standing
				});
				temp_td.inject(temp_tr);
				
				//quarter
				temp_td = new Element('td', {
					'class'	: 'schedule-td-game-quarter-min',
					'html' : temp_quarter_time
				});
				temp_td.inject(temp_tr);
				
				//top Player
				temp_td = new Element('td', {
					'class'	: 	'schedule-td-game-top-player',
					'html' 	: 	temp_top_scorer
				});
				temp_td.inject(temp_tr);


			tempGameObject['TopName_A']		= temp_String_TopName_A;
			tempGameObject['TopPkt_A']		= temp_String_TopPkt_A;
			tempGameObject['TopName_B']		= temp_String_TopName_B;
			tempGameObject['TopPkt_B']		= temp_String_TopPkt_B;


				
				temp_tr.inject(temp_tbody);
	
			}.bind(this));
			
			temp_tbody.inject(temp_table);
			
			this.update_elements('div.scroll-content-'+tempLiga, temp_table);
			
			//
			// spieltag table
			///////////////

			///////////////
			// today table
			//
			
			/*
			temp_table = new Element('table', {
				'class'	: 'schedule-table',
				'cellspacing' : 0,
				'cellpadding' : 0,
				'border'	  : 0
			});
	
			temp_tbody = new Element('tbody', {
				'class'	: 'schedule-tbody'
			});
	
			
			act_temp_String_Date 		= '';
			act_temp_String_Gender 		= '';
			act_temp_String_Round 		= '';
			
			
			i = 0;
			
			var jetzt = new Date();
			var Tag 	=  jetzt.getDate();
			var Monat 	=  jetzt.getMonth()+1;
			var Jahr 	=  jetzt.getFullYear()
			
			var Heute	= this.string_to_date(Tag+'.'+Monat+'.'+Jahr);
			
			temp_Array_Games.each(function (item,index) {
				
				item_date_object = this.string_to_date(item['Date']);
				
				if (item_date_object == Heute)
				{
					

					modulo = 'odd';
					if ((i % 2) == 1) {
						modulo = 'even';
					};
					i = i + 1;
					
					// Game Entrys
					temp_tr = new Element('tr', {
						'class'		: 'schedule-tr-game-'+modulo
					});
					
					if (
							(item['Status'] == 'R')
							|| 
							(item['Status'] == 'I')
							|| 
							(item['Status'] == 'F')
						)
					{
						temp_tr.setStyle('cursor', 'pointer');
						temp_tr.addEvent('click', function()
														   {
																this.options.event_id = tempLiga;
																this.change_game(item['Id'],item['DataFolder']);
																this.act_game_time = item['Time'];
															}.bind(this)
										);
					};
					
					temp_td = new Element('td', {
						'class'	: 'schedule-td-game-Names',
						'html' : '<div style="padding-bottom:5px;">'+item['Full_Name_A']+'</div><div>'+ item['Full_Name_B']+'</div>'
					});
					temp_td.inject(temp_tr);
					
					temp_td = new Element('td', {
						'class'	: 'schedule-td-game-Time',
						'html'	: item['Time']+'h'
					});
					temp_td.inject(temp_tr);
					
					temp_standing = '';
					if (item['Status'] == 'R') {
						temp_standing = '<span style="color:red;">live</span>';
						temp_standing = temp_standing+'<br>'+this.build_standing_str(item['Pts_A'],item['Pts_B']);
					} else if ((item['Status'] == 'S') || (item['Status'] == 'I')) {
						temp_standing = '';
					} else {
						temp_standing = '<b>'+this.build_standing_str(item['Pts_A'],item['Pts_B'])+'</b>';
					}
					if (temp_standing == '')
					{
						temp_standing = '&nbsp;';
					}
					
					temp_td = new Element('td', {
						'class'	: 'schedule-td-game-Standing',
						'html' : temp_standing
					});
					temp_td.inject(temp_tr);
					
					temp_tr.inject(temp_tbody);
					
				};
	
			}.bind(this));
			
			temp_tbody.inject(temp_table);
			
			this.update_elements('div.scroll-today-content-'+tempLiga, temp_table);
			*/
			
			
			//
			// today table
			///////////////

		}
		else
		{
			this.get_standing_schedule(tempLiga);
		};

	},
	
	////////////////////
	//  string_to_date(date)
	////////////////////
	string_to_date: function (date) {
		
		//replace - / .
		
		if (date)
		{
			var temp_date = date.replace(/-/g,'.');
			var temp_date = date.replace(/\//g,'.');
			
			//splitting string;
			var temp_date_array = temp_date.split('.');
			
			var temp_day = temp_date_array[0].toInt();
			var temp_month = temp_date_array[1].toInt();
			var temp_year = temp_date_array[2].toInt();
			
			if ((temp_year+'').length < 4)
			{
				if ((temp_year+'').length == 1)
				{
					temp_year = ('200'+temp_year).toInt();
				}
				else if ((temp_year+'').length > 1)
				{
					temp_year = ('20'+temp_year).toInt();
				}; 
			};
			
			this_date_str = temp_day+'.'+temp_month+'.'+temp_year;
			this_date = new Date(temp_year, temp_month-1, temp_day);
		}
		else
		{
			this_date_str = '01.01.1969';
		}
		
		return this_date_str;
		
	},
	
	////////////////////
	//  update shot-chart
	////////////////////
	update_shot_chart: function () {
		
		//quarter emptys choose
		var shoot_chart_tabs = $('shotchart_tabs');
		shoot_chart_tabs.empty();
		//this.shot_chart_quarter_choose_slide.empty();
		
		temp_class = 'shot-chart-quarter-butten-no';
		if (this.shot_chart_choosen_quarter == 'All') {
			temp_class = 'shot-chart-quarter-butten-act';
		};
		
		temp_DIV = new Element('div', {
			'class'			: temp_class,
			'html'			: 'Gesamt'
		});
		if (this.shot_chart_choosen_quarter != 'All') 
		{
			temp_DIV.addEvent('click', function()
				{
					this.change_shot_chart_quarter('All');
				}.bind(this)
			);
		};

		temp_DIV.inject(shoot_chart_tabs);
		
		tempDIV = new Array();
		
		this.get_quarter_array().each( function(quarter_item,quarter_index) {
										
			temp_class = 'shot-chart-quarter-butten-no';
			if (this.shot_chart_choosen_quarter == quarter_item) {
				temp_class = 'shot-chart-quarter-butten-act';
			};
			
			tempDIV[quarter_index] = new Element('div', {
				'class'			: temp_class,
				'html'			: this.data_2_status_game_string(quarter_item)
			});
			
			if (this.shot_chart_choosen_quarter != quarter_item) {
				
				tempDIV[quarter_index].addEvent('click', function(){
					
					this.change_shot_chart_quarter(quarter_item);
					
				}.bind(this));
			
			};
			
			tempDIV[quarter_index].inject(shoot_chart_tabs,'bottom');
			
		}.bind(this));
		
		this.check_render_shot_chart();
		
	},
	
	////////////////////
	// helperfunctions
	////////////////////

	////////////////////
	// switch_MSG_on
	////////////////////
	switch_MSG_on_off: function (type){
		
		$$('div.wide-standing-msg').each(
										 	function(item,item_index){
												
												if (type == 'on')
												{
													item.setStyle('display', '');
													item.innerHTML = this.act_game_msg;
												}
												else
												{
													item.setStyle('display', 'none');
													item.innerHTML = '';
												}
												
										 	}.bind(this)
										)

		$$('div.wide-standing-box').each(
										 	function(item,item_index){
												
												if (type == 'on')
												{
													item.setStyle('display', 'none');
												}
												else
												{
													item.setStyle('display', '');
												}
												
										 	}.bind(this)
										)

	},

	////////////////////
	// change_shot_chart_quarter
	////////////////////
	change_shot_chart_quarter: function (choise) {
		
		this.shot_chart_choosen_quarter = choise;
		this.update_shot_chart();
		
	},
	
	////////////////////
	// render_shot_chart()
	////////////////////
	render_shot_chart: function () {
		
		temp_actions = new Array();
		
		// prepare action array (filtering)
		if (this.shot_chart_choosen_quarter == 'All') {
			
			this.get_quarter_array().each( function (quarter_item,quarter_index) {
				
				
				if ($type(this.quarter_storage[quarter_item]) == 'array')
				{
					temp_actions.extend(this.quarter_storage[quarter_item]);
				};
			
			}.bind(this));
			
		} else {
			
			temp_actions = this.quarter_storage[this.shot_chart_choosen_quarter];
			
		};
		
		// ausgabe
		
		this.shot_chart_field.empty();
		
		temp_actions.each( function (action_item,action_index) {
			
			if (
					(
						(action_item[this.conf_vers[this.version].actions['Succ']] == '+')
						|| 
						(action_item[this.conf_vers[this.version].actions['Succ']] == '-')
					)
					&&
					(
						(action_item[this.conf_vers[this.version].actions['xShot']] != '')
						&&
						(action_item[this.conf_vers[this.version].actions['yShot']] != '')
					)
					&&
					(
					 	(action_item[this.conf_vers[this.version].actions['xShot']] != 0)
						&&
					 	(action_item[this.conf_vers[this.version].actions['yShot']] != 0)
						
					)
				)
			{
				
				this.create_shot_chart_point(action_item).inject(this.shot_chart_field);
				
			};
	
		}.bind(this))
		
		
	},
	
	////////////////////
	// check_render_shot_chart
	////////////////////
	check_render_shot_chart: function () {
		
		this.shot_chart_Check = new Object;
		
		if (this.shot_chart_choosen_quarter == 'All')
		{
			
			this.data_game.statper.each(function(item,index){
												 
				var tempQuater = item[this.conf_vers[this.version].statper['Per']];
				
				this.shot_chart_Check[tempQuater] = true;
				
				if (
						(!$type(this.quarter_storage[this.shot_chart_choosen_quarter]))
					)
				{
					this.shot_chart_Check[tempQuater] = true;
					
					//getting data
					tempfunc = function () {
						this.check_render_shot_chart();
					}.bind(this);
					
					this.get_full_play_by_play_data(tempQuater,tempfunc);
				}
				else
				{
					this.shot_chart_Check[tempQuater] = true;
				};
												 
			}.bind(this))
			
			tempCheck = true;
			this.data_game.statper.each(
				function(item,index)
				{
					var tempQuaterX = item[this.conf_vers[this.version].statper['Per']];
					if (!this.shot_chart_Check[tempQuaterX])
					{
						tempCheck = false;
					};
				}.bind(this)
			)

			if (tempCheck)
			{
				this.render_shot_chart();
			};
			
		}
		else
		{

			if ($type(this.quarter_storage[this.shot_chart_choosen_quarter]))
			{
				this.render_shot_chart();
			}
			else
			{
				//getting data
				tempfunc = function () {
					
					this.check_render_shot_chart();
					
				}.bind(this);
				
				this.get_full_play_by_play_data(this.shot_chart_choosen_quarter,tempfunc);
			};
			
		};
		
	},
	
	////////////////////
	// create_shot_chart_point
	////////////////////
	create_shot_chart_point: function (action_item) {
		
		//color
		
		//Position
		
		temp_pos = this.get_position_on_field(action_item);
		
		temp_Point = new Element('div', {
			'class'			: 'shot-chart-point'
		});
		
		
		if ((Browser.Engine.trident4 == true) || (Browser.Engine.trident5 == true)) {
			// only if browser is ie 6
			
			// filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='varyAlpha.png',sizingMethod='scale')
			
			tempImg = '';
			if (action_item[this.conf_vers[this.version].actions['Succ']] == '+') {
				tempImg = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='img/point_green.png',sizingMethod='scale')";
			} else {
				tempImg = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='img/point_red.png',sizingMethod='scale')";
			};
			
			temp_Point.setStyles({
				'top'				: temp_pos.y,
				'left'				: temp_pos.x,
//				'filter:'			: tempImg,
				'width'				: this.options.shot_chart_point_width,
				'height'			: this.options.shot_chart_point_height,
				'position'			: 'absolute',
				'opacity'			: 1
			});
			temp_Point.style.filter = tempImg;
			
		} else {
			
			tempImg = '';
			if (action_item[this.conf_vers[this.version].actions['Succ']] == '+') {
				tempImg = 'url(img/point_green.png)';
			} else {
				tempImg = 'url(img/point_red.png)';
			};
			// every browser which is not ie 6		
			temp_Point.setStyles({
				'top'				: temp_pos.y,
				'left'				: temp_pos.x,
				'background-image'	: tempImg,
				'width'				: this.options.shot_chart_point_width,
				'height'			: this.options.shot_chart_point_height,
				'position'			: 'absolute',
				'opacity'			: 1
			});
			
		};

		return temp_Point;
		
	},
	
	////////////////////
	// get_position_on_field()
	////////////////////
	get_position_on_field: function (action_object) {
		
		temp_pos = new Object();
		temp_pos['x'] = 0;
		temp_pos['y'] = 0;
		
		if (action_object[this.conf_vers[this.version].actions['TC']] == 'A') {
			
			temp_pos['x'] = Math.round(action_object[this.conf_vers[this.version].actions['yShot']] * 192 / 200)-(this.options.shot_chart_point_width/2);
			temp_pos['y'] = Math.round(268 - (action_object[this.conf_vers[this.version].actions['xShot']] * 268 / 279))-(this.options.shot_chart_point_width/2);
			
		} else {
			
			temp_pos['x'] = Math.round(496 - (action_object[this.conf_vers[this.version].actions['yShot']] * 192 / 200))-(this.options.shot_chart_point_width/2);
			temp_pos['y'] = Math.round(action_object[this.conf_vers[this.version].actions['xShot']] * 268 / 279)-(this.options.shot_chart_point_width/2);
			
		};
		
		return temp_pos;
		
	},
	
	////////////////////
	// get_quarter_array()
	// returns array with all quarter
	////////////////////
	get_quarter_array: function () {
		
		temp_QuaterArray = new Array();
		
		this.data_game.statper.each(
			function(item,index)
			{
				var tempQuater = item[this.conf_vers[this.version].statper['Per']];
				
				temp_QuaterArray.push(tempQuater);
				
			}.bind(this)
		);
		
		//temp_QuaterArray = temp_QuaterArray.sort();
		
		return temp_QuaterArray.reverse();
		
	},
	
	////////////////////
	// save_quarter_actions_to_object()
	////////////////////
	save_quarter_actions_to_object: function(data,quarter) {
		
		this.quarter_storage[quarter] = data;//.reverse();
		
	},
	
	////////////////////
	// build_standing string
	////////////////////
	build_standing_str: function (resA,resB) {
		
		tempStr = '&nbsp;';
		
		if (($type(resA) != 'object') && ($type(resB) != 'object')) {
			tempStr = resA + ' : ' + resB;
		}
		
		return tempStr;
		
	},
	
	////////////////////
	// get_games 
	////////////////////
	get_games: function (data) {
		
		temp_Array = new Array();
		
		// start get_groups
		$splat(data.BBevent.BBround).each( function (round_item,round_index) {
			
			if ($type(round_item.game) != false) {
				
				$splat(round_item.game).each( function (game_item,game_index) {
				
					temp_Array.push(game_item);
				
				}.bind(this));
				
			};
							 
		}.bind(this));
		// end get_groups
		return temp_Array;
		
	},
	
	////////////////////
	// get groups (for standing)
	////////////////////
	get_groups: function (data) {
		
		temp_Array = new Array();
		
		// start get_groups
		$splat(data.BBevent.BBround).each( function (round_item,round_index) {
			
			if ($type(round_item.group) != false) {
				
				$splat(round_item.group).each( function (group_item,group_index) {
				
					temp_Array.push(group_item);
				
				}.bind(this));
				
			};
							 
		}.bind(this));
		// end get_groups
		return temp_Array;
		
	},

	////////////////////
	// get groups by gender (for standing)
	////////////////////
	get_groups_by_gender: function (data) {
		
		temp_Object = new Object();
		temp_Object['M'] = new Array();
		temp_Object['F'] = new Array();
		
		data.each( function ( group_item, group_index) {
			
			if (group_item.gender == 'M') {
				
				temp_Object['M'].push(group_item);
				
			} else if (group_item.gender == 'F') {
				
				temp_Object['F'].push(group_item);
				
			};
			
		}.bind(this));
		
		return temp_Object;
		
	},
	
	//////////////////////
	// get games by gender
	//////////////////////
	get_games_by_gender: function (data) {
		
		temp_Object = new Object();
		temp_Object['M'] = new Array();
		temp_Object['F'] = new Array();
		
		data.each( function ( game_item, game_index) {
			
			if (game_item.gender == 'M') {
				
				temp_Object['M'].push(game_item);
				
			} else if (game_item.gender == 'F') {
				
				temp_Object['F'].push(game_item);
				
			};
			
		}.bind(this));
		
		return temp_Object;
		
	},
	
	////////////////////
	// build schedule array
	////////////////////
	build_schedule_array: function (data,templiga) {

		temp_RoundName = '';
		temp_Object_Games = '';
		
		temp_Array_Games = new Array();
		
		tempData = $splat(data.liga.Spiel);
			
		temp_Object_Games = tempData;
		
		// loop thru Games
		temp_Object_Games.each(function (GameItem,index) {
			
			tempGameObject = new Object();
			
			temp_String_Date 			= GameItem.Tag;
			temp_String_Time 			= GameItem.Startzeit;
			temp_String_id 				= GameItem.Game_ID;
			if (GameItem.gcr == 'true')
			{
				temp_String_status = 'R';
			}
			else
			{
				if (
						(GameItem.Heim.Spielstand == '0')
						&&
						(GameItem.Gast.Spielstand == '0')
					)
				{
					temp_String_status = 'I';
				}
				else if (
							(GameItem.Heim.Spielstand == '')
							&&
							(GameItem.Gast.Spielstand == '')
						 )
				{
					temp_String_status = 'S';
				}
				else
				{
					temp_String_status = 'F';
				};
			};
			
			if ($type(GameItem.Daten))
			{
				temp_String_DataFolder		= GameItem.Daten;
			}
			else
			{
				temp_String_DataFolder		= templiga+'/'+GameItem.Heim.Team_ID;
			}
			temp_String_Team_short_A	= GameItem.Heim.Team_ID;
			temp_String_Team_short_B	= GameItem.Gast.Team_ID;
			temp_String_Team_full_A		= GameItem.Heim.Name;
			temp_String_Team_full_B		= GameItem.Gast.Name;
			temp_String_Pts_A			= GameItem.Heim.Spielstand;
			temp_String_Pts_B			= GameItem.Gast.Spielstand;
			temp_String_MSG				= GameItem.MSG;
			if (GameItem.Halbzeit)
			{
				temp_String_quarter			= GameItem.Halbzeit;
			}
			else
			{
				temp_String_quarter			= '';
			}
			if (GameItem.Spieluhr)
			{
				temp_String_pltime			= GameItem.Spieluhr;
			}
			else
			{
				temp_String_pltime			= '';
			}
			if (GameItem.Heim.TopScorer) {
				//temp_String_TopName_A = GameItem.Heim.TopScorer.Name;
				//temp_String_TopPkt_A = GameItem.Heim.TopScorer.Pkt;
				//temp_String_TopName_B = GameItem.Gast.TopScorer.Name;
				//temp_String_TopPkt_B = GameItem.Gast.TopScorer.Pkt;
				if (GameItem.Heim.TopScorer.Name)
				{
					temp_String_TopName_A = GameItem.Heim.TopScorer.Name;
					temp_String_TopPkt_A = GameItem.Heim.TopScorer.Pkt;
					temp_String_TopName_B = GameItem.Gast.TopScorer.Name;
					temp_String_TopPkt_B = GameItem.Gast.TopScorer.Pkt;
				}
				else
				{
					temp_String_TopName_A = '';
					temp_String_TopPkt_A = '';
					temp_String_TopName_B = '';
					temp_String_TopPkt_B = '';
				}
			}
			else
			{
				temp_String_TopName_A = '';
				temp_String_TopPkt_A = '';
				temp_String_TopName_B = '';
				temp_String_TopPkt_B = '';
			}
			
			tempGameObject['MSG'] 			= temp_String_MSG;
			tempGameObject['Date'] 			= temp_String_Date;
			tempGameObject['DataFolder'] 	= temp_String_DataFolder;
			tempGameObject['Time'] 			= temp_String_Time;
			tempGameObject['Id'] 			= temp_String_id;
			tempGameObject['Status'] 		= temp_String_status;
			tempGameObject['Short_Name_A'] 	= temp_String_Team_short_A;
			tempGameObject['Short_Name_B'] 	= temp_String_Team_short_B;
			tempGameObject['Full_Name_A'] 	= temp_String_Team_full_A;
			tempGameObject['Full_Name_B'] 	= temp_String_Team_full_B;
			tempGameObject['Pts_A'] 		= temp_String_Pts_A;
			tempGameObject['Pts_B'] 		= temp_String_Pts_B;
			tempGameObject['quarter']		= temp_String_quarter;
			tempGameObject['plTime']		= temp_String_pltime;
			tempGameObject['TopName_A']		= temp_String_TopName_A;
			tempGameObject['TopPkt_A']		= temp_String_TopPkt_A;
			tempGameObject['TopName_B']		= temp_String_TopName_B;
			tempGameObject['TopPkt_B']		= temp_String_TopPkt_B;
			
			temp_Array_Games.push(tempGameObject);
			
		}.bind(this));
		
		return temp_Array_Games;

	},
	
	////////////////////
	// updates innerHTML of Element
	// not used @ moment
	////////////////////
	update_element: function (Element,value) {
		
		old_value = Element.innerHTML;
		new_value = value;
		if (new_value != old_value) {

			Element.innerHTML = new_value;
			
			Element.highlight('#C30');
			
		};
		
	},

	////////////////////
	// render_teams
	////////////////////
	render_teams: function() {
		
		var temp_array_player_img_1 = new Array();
		var temp_array_player_img_2 = new Array();
		
		if (this.choosen_Team == 'A') 
		{
			this.update_elements('td.teams-country-big',	this.data_gameini.teamroster[0].TeamName);
			this.update_elements('a.teams-country-small',	this.data_gameini.teamroster[1].TeamName);
		} 
		else 
		{
			this.update_elements('td.teams-country-big',	this.data_gameini.teamroster[1].TeamName);
			this.update_elements('a.teams-country-small',	this.data_gameini.teamroster[0].TeamName);
		};
		
		temp_table = new Element('table', 	{
			'class'	: 'teams-table',
			'cellspacing' : 0,
			'cellpadding' : 0,
			'border'	  : 0
		});
		temp_table_body = new Element('tbody', 	{
			'class'	: 'teams-tbody'
		});

		// Alle im Spiel
		i = 0;
		this.data_game.statind.each(function (item,index) {
			
			if (((item[this.conf_vers[this.version].statind['p_Is']] == 'S') || (item[this.conf_vers[this.version].statind['p_Is']] == '*') ) && (item[this.conf_vers[this.version].statind['TC']] == this.choosen_Team)) {
				
				// player img
				var temp_img = new Element('img', 	{
									'class'	: 'teams-player-image',
									'height': 50,
									'width'	: 38,
									'id'	: 'img_member_'+this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).ID,
									'src'	: 'http://statistik.basketball-bundesliga.de/images/players/2009/'+this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).ID+'.jpg'
								});
				temp_img.addEvent('mouseenter', function()
					{
						this.highlight_team_member(this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).ID,'show');
					}.bind(this)
				);
				temp_img.addEvent('mouseleave', function()
					{
						this.highlight_team_member(this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).ID,'hide');
					}.bind(this)
				);
				temp_array_player_img_1.push(temp_img);
				
				//////////////////////////////
				// Rows

				modulo = 'odd';
				if ((i % 2) == 1) {
					modulo = 'even';
				};
				
				temp_row = new Element('tr', 	{
					'class'	: 'teams-tr-'+modulo,
					'id'	: 'tr_member_'+this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).ID
				});
				temp_row.addEvent('mouseenter', function()
					{
						this.highlight_team_member(this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).ID,'show');
					}.bind(this)
				);
				temp_row.addEvent('mouseleave', function()
					{
						this.highlight_team_member(this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).ID,'hide');
					}.bind(this)
				);

				temp_td_nr = new Element('td', 	{
					'class'	: 'teams-td-nr',
					'html'	: item[this.conf_vers[this.version].statind['Nr']]
				});
				temp_td_nr.inject(temp_row);
				
				temp_td_name = new Element('td', 	{
					'class'	: 'teams-td-name',
					'html'	: this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).Name +', ' + this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).FirstName
				});
				temp_td_name.inject(temp_row);
	
				temp_td_min = new Element('td', 	{
					'class'	: 'teams-td-Min',
					'html'	: item[this.conf_vers[this.version].statind['Min']]
				});
				temp_td_min.inject(temp_row);
	
				temp_td_2pm = new Element('td', 	{
					'class'	: 'teams-td-2PM-A',
					'html'	: this.handle_empty(item[this.conf_vers[this.version].statind['P2G']],0) + ' - ' + this.handle_empty(item[this.conf_vers[this.version].statind['P2A']],0)
				});
				temp_td_2pm.inject(temp_row);
				
				temp_td_3pm = new Element('td', 	{
					'class'	: 'teams-td-3PM-A',
					'html'	: this.handle_empty(item[this.conf_vers[this.version].statind['P3G']],0) + ' - ' + this.handle_empty(item[this.conf_vers[this.version].statind['P3A']],0)
				});
				temp_td_3pm.inject(temp_row);
				
				temp_td_ftm = new Element('td', 	{
					'class'	: 'teams-td-FTM-A',
					'html'	: this.handle_empty(item[this.conf_vers[this.version].statind['P1G']],0) + ' - ' + this.handle_empty(item[this.conf_vers[this.version].statind['P1A']],0)
				});
				temp_td_ftm.inject(temp_row);
				
				temp_td_pts = new Element('td', 	{
					'class'	: 'teams-td-pts',
					'html'	: this.handle_empty(item[this.conf_vers[this.version].statind['Pts']],0)
				});
				temp_td_pts.inject(temp_row);
				
				temp_td_ass = new Element('td', 	{
					'class'	: 'teams-td-ass',
					'html'	: this.handle_empty(item[this.conf_vers[this.version].statind['ASS']],0)
				});
				temp_td_ass.inject(temp_row);
				
				temp_td_r = new Element('td', 	{
					'class'	: 'teams-td-r',
					'html'	: this.handle_empty(item[this.conf_vers[this.version].statind['REB']],0)
				});
				temp_td_r.inject(temp_row);
				
				temp_td_f = new Element('td', 	{
					'class'	: 'teams-td-f',
					'html'	: this.handle_empty(item[this.conf_vers[this.version].statind['Foul']],0)
				});
				temp_td_f.inject(temp_row);
				
				temp_row.inject(temp_table_body);
				
				i = i + 1;

			};
											  
		}.bind(this));
		
		// Trenner

		temp_row = new Element('tr');
			
		temp_td_trenner = new Element('td', 	{
			'class'	: 'teams-td-trenner',
			'colspan'	: 11
		});
		temp_td_trenner.inject(temp_row);
		temp_row.inject(temp_table_body);

		// Alle nicht im Spiel
		i = 0;
		this.data_game.statind.each(function (item,index) {
											  
			if ((item[this.conf_vers[this.version].statind['p_Is']] == 'N') && (item[this.conf_vers[this.version].statind['TC']] == this.choosen_Team)) {

				// player img
				var temp_img = new Element('img', 	{
									'class'	: 'teams-player-image',
									'id'	: 'img_member_'+this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).ID,
									'height': 50,
									'width'	: 38,
									'src'	: 'http://statistik.basketball-bundesliga.de/images/players/2009/'+this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).ID+'.jpg'
								});
				temp_img.addEvent('mouseenter', function()
					{
						this.highlight_team_member(this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).ID,'show');
					}.bind(this)
				);
				temp_img.addEvent('mouseleave', function()
					{
						this.highlight_team_member(this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).ID,'hide');
					}.bind(this)
				);
				temp_array_player_img_2.push(temp_img);
				
				//////////////////////////////
				// Rows

				modulo = 'odd';
				if ((i % 2) == 1) {
					modulo = 'even';
				};
				
				temp_row = new Element('tr', 	{
					'class'	: 'teams-tr-'+modulo,
					'id'	: 'tr_member_'+this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).ID
				});
				temp_row.addEvent('mouseenter', function()
					{
						this.highlight_team_member(this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).ID,'show');
					}.bind(this)
				);
				temp_row.addEvent('mouseleave', function()
					{
						this.highlight_team_member(this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).ID,'hide');
					}.bind(this)
				);

				temp_td_nr = new Element('td', 	{
					'class'	: 'teams-td-nr',
					'html'	: item[this.conf_vers[this.version].statind['Nr']]
				});
				temp_td_nr.inject(temp_row);
				
				temp_td_name = new Element('td', 	{
					'class'	: 'teams-td-name',
					'html'	: this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).Name +', ' + this.get_player_info(this.choosen_Team,item[this.conf_vers[this.version].statind['Nr']]).FirstName
				});
				temp_td_name.inject(temp_row);
	
				temp_td_min = new Element('td', 	{
					'class'	: 'teams-td-Min',
					'html'	: item[this.conf_vers[this.version].statind['Min']]
				});
				temp_td_min.inject(temp_row);
	
				temp_td_2pm = new Element('td', 	{
					'class'	: 'teams-td-2PM-A',
					'html'	: this.handle_empty(item[this.conf_vers[this.version].statind['P2G']],0) + ' - ' + this.handle_empty(item[this.conf_vers[this.version].statind['P2A']],0)
				});
				temp_td_2pm.inject(temp_row);
				
				temp_td_3pm = new Element('td', 	{
					'class'	: 'teams-td-3PM-A',
					'html'	: this.handle_empty(item[this.conf_vers[this.version].statind['P3G']],0) + ' - ' + this.handle_empty(item[this.conf_vers[this.version].statind['P3A']],0)
				});
				temp_td_3pm.inject(temp_row);
				
				temp_td_ftm = new Element('td', 	{
					'class'	: 'teams-td-FTM-A',
					'html'	: this.handle_empty(item[this.conf_vers[this.version].statind['P1G']],0) + ' - ' + this.handle_empty(item[this.conf_vers[this.version].statind['P1A']],0)
				});
				temp_td_ftm.inject(temp_row);
				
				temp_td_pts = new Element('td', 	{
					'class'	: 'teams-td-pts',
					'html'	: this.handle_empty(item[this.conf_vers[this.version].statind['Pts']],0)
				});
				temp_td_pts.inject(temp_row);
				
				temp_td_ass = new Element('td', 	{
					'class'	: 'teams-td-ass',
					'html'	: this.handle_empty(item[this.conf_vers[this.version].statind['ASS']],0)
				});
				temp_td_ass.inject(temp_row);
				
				temp_td_r = new Element('td', 	{
					'class'	: 'teams-td-r',
					'html'	: this.handle_empty(item[this.conf_vers[this.version].statind['REB']],0)
				});
				temp_td_r.inject(temp_row);
				
				temp_td_f = new Element('td', 	{
					'class'	: 'teams-td-f',
					'html'	: this.handle_empty(item[this.conf_vers[this.version].statind['Foul']],0)
				});
				temp_td_f.inject(temp_row);
				
				temp_row.inject(temp_table_body);
				
				i = i + 1;

			};
											  
		}.bind(this));

		temp_table_body.inject(temp_table);

		this.update_elements('div.teams-content', temp_table);
		
		var temp_image_container_1 = $$('div.teams-player-image-container_1')[0];
		var temp_image_container_2 = $$('div.teams-player-image-container_2')[0];
		
		temp_image_container_1.empty();
		temp_image_container_2.empty();
		
		temp_array_player_img_1.each(function (image_item,image_index){
			
			image_item.inject(temp_image_container_1);
		
		 }.bind(this));
		temp_array_player_img_2.each(function (image_item,image_index){
			
			image_item.inject(temp_image_container_2);
		
		 }.bind(this));
		
	},
	
	////////////////////
	// highlight_team_member()
	////////////////////
	highlight_team_member: function (id,type) {
		
		if (type == 'show')
		{
			$('tr_member_'+id).addClass('teams-mark');
			$('img_member_'+id).addClass('teams-mark');
		}
		else
		{
			$('tr_member_'+id).removeClass('teams-mark');
			$('img_member_'+id).removeClass('teams-mark');
		};
		
	},

	////////////////////
	// switch_choosen_team()
	// - sets the choosen team
	// - forces new rendering of team display "this.update_teams()"
	////////////////////
	switch_choosen_team: function() {
		
		this.choosen_team_member = '';
		
		if (this.choosen_Team == 'A') {
			
			this.choosen_Team = 'B';
			
		} else {
			
			this.choosen_Team = 'A';
			
		};
		
		this.update_teams();
		
	},

	////////////////////
	// render players
	////////////////////
	render_players: function (container,data) {
		
		temp_table = new Element('table', 	{
			'class'	: 'players-table',
			'cellspacing' : 0,
			'cellpadding' : 0,
			'border'	  : 0
		});

		temp_table_body = new Element('tbody', 	{
			'class'	: 'players-tbody'
		});

		// Alle im Spiel
		i = 0;
		
		data.each(function(item,index){
						   
						   
			if ((item[this.conf_vers[this.version].statind['p_Is']] == 'S') || (item[this.conf_vers[this.version].statind['p_Is']] == '*')) {

				modulo = 'odd';
				if ((i % 2) == 1) {
					modulo = 'even';
				};

				temp_row = new Element('tr', 	{
					'class'	: 'players-tr-'+modulo
				});
					
				temp_td_nr = new Element('td', 	{
					'class'	: 'players-td-nr',
					'html'	: item[this.conf_vers[this.version].statind['Nr']]
				});
				temp_td_nr.inject(temp_row);
				
				temp_td_name = new Element('td', 	{
					'class'	: 'players-td-name',
					'html'	: this.get_player_info(container,item[this.conf_vers[this.version].statind['Nr']]).Name +', ' + this.get_player_info(container,item[this.conf_vers[this.version].statind['Nr']]).FirstName
				});
				temp_td_name.inject(temp_row);
	
				temp_td_Pts = new Element('td', 	{
					'class'	: 'players-td-Pts',
					'html'	: item[this.conf_vers[this.version].statind['Pts']]
				});
				temp_td_Pts.inject(temp_row);
	
				temp_td_F = new Element('td', 	{
					'class'	: 'players-td-F',
					'html'	: this.handle_empty(item[this.conf_vers[this.version].statind['Foul']],0)
				});
				temp_td_F.inject(temp_row);
				
				temp_row.inject(temp_table_body);
				
				i = i + 1;
				
			};
			
		}.bind(this));
		
		// Trenner

		temp_row = new Element('tr');
			
		temp_td_nr = new Element('td', 	{
			'class'	: 'players-td-trenner',
			'colspan'	: 4
		});
		temp_td_nr.inject(temp_row);
		
		temp_row.inject(temp_table_body);

		// Alle nicht im Spiel

		i = 0;

		data.each(function(item,index){
						   
			if (item[this.conf_vers[this.version].statind['p_Is']] == 'N') {

				modulo = 'odd';
				if ((i % 2) == 1) {
					modulo = 'even';
				};

				temp_row = new Element('tr', 	{
					'class'	: 'players-tr-'+modulo
				});
					
				temp_td_nr = new Element('td', 	{
					'class'	: 'players-td-nr',
					'html'	: item[this.conf_vers[this.version].statind['Nr']]
				});
				temp_td_nr.inject(temp_row);
				
				temp_td_name = new Element('td', 	{
					'class'	: 'players-td-name',
					'html'	: this.get_player_info(container,item[this.conf_vers[this.version].statind['Nr']]).Name +', ' + this.get_player_info(container,item[this.conf_vers[this.version].statind['Nr']]).FirstName
				});
				temp_td_name.inject(temp_row);
	
				temp_td_Pts = new Element('td', 	{
					'class'	: 'players-td-Pts',
					'html'	: item[this.conf_vers[this.version].statind['Pts']]
				});
				temp_td_Pts.inject(temp_row);
	
				temp_td_F = new Element('td', 	{
					'class'	: 'players-td-F',
					'html'	: this.handle_empty(item[this.conf_vers[this.version].statind['Foul']],0)
				});
				temp_td_F.inject(temp_row);
				
				temp_row.inject(temp_table_body);

				i = i + 1;

			};
			
		}.bind(this));

		temp_table_body.inject(temp_table);
		
		this.update_elements('div.players-team-'+container+'-content', temp_table);
		
	},

	////////////////////
	// render_play_by_play()
	// - renders play by play list for a given quarter
	// - needs display ->$(element) , data (object) , Quarter ("String")
	// - creates new Quarter Display & Tab if given Quarter not exists
	// - switches to the new diplay if a new one is createt
	// - fills display with given data
	////////////////////
	render_play_by_play: function () {
		
		var temp_quater = this.choosen_quarter;
		
		if (temp_quater == '')
		{
			temp_quater = 'Q1';
			this.switch_quarter_in_play_by_play(temp_quater);
		};
		
		if (	
				(
				 	(temp_quater != this.data_game.CurPer)
					&&
					(this.check_refresh('fpbp_'+temp_quater))
				)
			)
		{
			
			//getting data
			this.quarter_request[temp_quater] = 'stoped';
			this.quarter_storage_status[temp_quater] = '';
			tempfunc = function () {
				
				this.render_play_by_play();
				
			}.bind(this);
			
			this.get_full_play_by_play_data(temp_quater,tempfunc);
			
		}
		else
		{
			
			var data = this.quarter_storage[temp_quater];
		
			temp_row_array = new Array();
			
			if ($type(data)) {
			
				if ($type(data[0]) == 'string') {
				
					temp_act_data = new Array(0);
					
					temp_act_data.push(data);
					
				} else {
					
					temp_act_data = data;
				};
				
			} else {
	
					temp_act_data = data;
					
			};
			
			$('play_by_play_tab_display_'+temp_quater).empty();
												
												
			var odd_even = 0;
												
			$splat(temp_act_data).each(function(item,index){
							   
				modulo = 'odd';
				if ((index % 2) == 1) {
					modulo = 'even';
				};
				
				temp_row = new Element('div', 	{
					'class': 'full-play-by-play-row full-play-by-play-row-'+modulo,
					'id': 'actID_'+item[this.conf_vers[this.version].actions['noact']],
					'styles': 	{
								'display': 'block'
								}
				});
				
				temp_score = '';
				if ((this.handle_empty(item[this.conf_vers[this.version].actions['GoalA']],0) != 0) || (this.handle_empty(item[this.conf_vers[this.version].actions['GoalB']],0) != 0)) {
					temp_score = '&nbsp;&nbsp;&nbsp;('+item[this.conf_vers[this.version].actions['GoalA']] + ' : ' + item[this.conf_vers[this.version].actions['GoalB']]+')';
				};
				temp_time = new Element('div', 	{
					'class': 'full-play-by-play-time-'+item[this.conf_vers[this.version].actions['TC']],
					'html': item[this.conf_vers[this.version].actions['PlTime']] + temp_score
				});
				temp_time.inject(temp_row);
	
				temp_action = new Element('div', 	{
					'class': 'full-play-by-play-action-'+item[this.conf_vers[this.version].actions['TC']],
					'html': this.get_action_string(item,temp_quater)
				});
				temp_action.inject(temp_row);
				
				temp_clear = new Element('div', 	{
					'class': 'clear'
				});
				temp_clear.inject(temp_row);
				
				//temp_row.inject($('play_by_play_tab_display_'+temp_quater),'top');
				temp_row.inject($('play_by_play_tab_display_'+temp_quater),'bottom');
				
			}.bind(this));
			
		};
		
	},

	////////////////////
	// update_play_quarter_tabs()
	// - old not used @ moment
	////////////////////
	update_play_quarter_tabs: function () {
		
		temp_tabs = ''
		
		this.temp_full_play_by_play_quarter_tabs.empty();
		
		this.data_game.statper.each(function(item, index) {
		
			if (item[2] == 'A') {
				
				temp_tab = new Element('div', 	{
					'class': 'play-by-play-tab ' + item[3],
					'html': this.data_2_status_game_string(item[3]),
					'styles': {
								'display': 'block',
								'background-color': '#CDCDCD'
					},
					'events': {
								'click': function(){
										this.switch_quarter_in_play_by_play(item[3]);
								}.bind(this)
					}
				});
				
				temp_tab.inject(this.temp_full_play_by_play_quarter_tabs_array[item[3]]);
				
				// check if Tab already exists
				if (!this.temp_full_play_by_play_scroll.getElementById('play_by_play_tab_display_'+item[3])) {
					
					temp_tab_display = new Element('div', 	{
						'id': 'play_by_play_tab_display_ ' + item[3],
						'class': 'play-by-play-tab-display',
						'html': this.data_2_status_game_string(item[3]),
						'styles': {
									'display': 'none'
						}
					});
					
					this.object_full_play_by_play_displays[item[3]] = temp_tab_display.inject(this.temp_full_play_by_play_scroll);
					
				};
				
			};
		
		}.bind(this));
		
	},

	////////////////////
	// create_full_play_by_play_quarter_tab_and_display()
	// - creates a tab and display for full play by play
	// - needs quarter as String
	////////////////////
	create_full_play_by_play_quarter_tab_and_display: function(Quarter) {
		
		// make tab
		temp_tab = new Element('div', 	{
			'class': 'play-by-play-tab ' + Quarter,
			'html': this.data_2_status_game_string(Quarter),
			'styles': {
						'display': 'block',
						'background-color': '#CDCDCD'
			},
			'events': {
						'click': function(){
								this.switch_quarter_in_play_by_play(Quarter);
						}.bind(this)
			}
		});
	
		temp_tab.inject(this.temp_full_play_by_play_quarter_tabs_array[Quarter]);
		
		// make display
		
		temp_tab_display = new Element('div', 	{
			'id': 'play_by_play_tab_display_ ' + Quarter,
			'class': 'play-by-play-tab-display',
			'html': '&nbsp;',
			'styles': {
						'display': 'none'
			}
		});
		this.object_full_play_by_play_displays[Quarter] = temp_tab_display.inject(this.temp_full_play_by_play_scroll);
		
	},
	
	////////////////////
	// show_act_quarter_in_play_by_play()
	// - gets actquarter from dataObject (data_game)
	// - switches to actual Quarter of choosen game
	////////////////////
	show_act_quarter_in_play_by_play: function () {
		
		if (this.data_game.ActPer == '') {
			
			this.switch_quarter_in_play_by_play('Q1');
		
		} else if (this.data_game.ActPer == 'E') {

			this.switch_quarter_in_play_by_play(this.last_quarter);

		} else {
			
			this.switch_quarter_in_play_by_play(this.act_quarter);
			
		};
	
	},
	
	////////////////////
	// switch_quarter_in_play_by_play()
	// 1. sets all tabs to inactive style
	// 2. sets actual choosen tab to active style
	// 3. sets all displays to style (display:none)
	// 4. sets actual choosen display to style (display:block)
	// 5. sets the Var "choosen_quarter" to actual choosen Quarter
	////////////////////
	switch_quarter_in_play_by_play: function (quarter_nr) {
		
		if (this.choosen_quarter != quarter_nr)
		{
			this.choosen_quarter = quarter_nr;
			// change buttons
			$$('div.play-by-play-tab').each(function (tab_item,tab_index) {
				
				tab_item.setStyles({
					'background-color': '#f7f7f7',
					'font-weight': 'normal',
					'border-top': '1px solid #e3e3e3'
				});
				
			});
			$$('div.'+quarter_nr).setStyles({
				'background': 'none',
				'font-weight': 'bold',
				'border-top': '1px solid #ffffff'
			});
			
			// show display
			$$('div.play-by-play-tab-display').each(function (display_item,display_index) {
				display_item.setStyle('display', 'none');
			});
			
			//$$('td.full-play-by-play-header')[0].innerHTML = '&nbsp;' + this.data_2_status_game_string(quarter_nr);
			$('play_by_play_tab_display_'+quarter_nr).setStyle('display', 'block');

			this.render_play_by_play();

		};
		
	},
	
	////////////////////
	// Get Action String
	// - converts the given Object to an Action -> String
	// - uses "array conf_vers[this.version].actions_dev" as database for Action Strings
	// - uses "get_player_info()" for name
	// - replaces some Placeholder in record of "conf_vers[this.version].actions_dev" with (name / Nat / No) of given dataObject 
	// - returns the full Action description as String
	////////////////////
	get_action_string: function(action_item_obj,tempQuater) {
		
		temp_action_str = 'nix';
		
		
		temp_action 	= action_item_obj[this.conf_vers[this.version].actions['action']];
		temp_z1			= action_item_obj[this.conf_vers[this.version].actions['Z1']];
		if (this.version == '2.0')
		{
			temp_z3			= '|'+action_item_obj[this.conf_vers[this.version].actions['Z3']];
		}
		else
		{
			temp_z3			= '';
		};
		temp_succ		= action_item_obj[this.conf_vers[this.version].actions['Succ']];
		temp_ass		= action_item_obj[this.conf_vers[this.version].actions['ass_Nr']];
		
		temp_action_str = ''+this.conf_vers[this.version].actions_dev[temp_action+'|'+temp_z1+temp_z3+'|'+temp_succ];
		if (temp_action_str == 'undefined') 
		{
			// TODO: remove once all actions are defined!
			temp_action_str = temp_action+'|'+temp_z1+temp_z3+'|'+temp_succ;
		}; 
		
		// replace NAT
		temp_Team = '';
		
		if (action_item_obj[this.conf_vers[this.version].actions['TC']] == 'A') {
			temp_Nat_Opponent = this.data_gameini.teamroster[1].Team;
			temp_Nat_Opponent_AB = 'B';
			temp_Nat = this.data_gameini.teamroster[0].Team;
			temp_Team = this.data_gameini.teamroster[0].TeamName;
		} else if (action_item_obj[this.conf_vers[this.version].actions['TC']] == 'B') {
			temp_Nat_Opponent = this.data_gameini.teamroster[0].Team;
			temp_Nat_Opponent_AB = 'A';
			temp_Nat = this.data_gameini.teamroster[1].Team;
			temp_Team = this.data_gameini.teamroster[1].TeamName;
		} else {
			temp_Nat_Opponent = '';
			temp_Nat_Opponent_AB = '';
			temp_Nat = '';
			temp_Team = '';
		};

		temp_action_str = temp_action_str.replace('[PER]'		, ''+this.data_2_status_game_string(tempQuater)+'');

		temp_action_str = temp_action_str.replace('[NAT]'		, ''+temp_Nat);
		
		temp_action_str = temp_action_str.replace('[TEAM]'		, ''+temp_Team);

		temp_action_str = temp_action_str.replace('[Name]'		, ''+this.get_player_info(action_item_obj[this.conf_vers[this.version].actions['TC']],action_item_obj[this.conf_vers[this.version].actions['p_Nr']]).Name + ', ' + this.get_player_info(action_item_obj[this.conf_vers[this.version].actions['TC']],action_item_obj[this.conf_vers[this.version].actions['p_Nr']]).FirstName);
		
		temp_action_str = temp_action_str.replace('[NO]'		, ''+action_item_obj[this.conf_vers[this.version].actions['p_Nr']]);
		
		if (temp_action_str.test('[Opponent]'))
		{
			temp_action_str = temp_action_str.replace('[Opponent]'	, ' gegen '+this.get_player_info(temp_Nat_Opponent_AB,temp_ass).Name + ', ' + this.get_player_info(temp_Nat_Opponent_AB,temp_ass).FirstName+' ('+temp_Nat_Opponent+')');
		}

		if (temp_ass != '')
		{
			temp_action_str = temp_action_str.replace('[AssistName]', ''+this.get_player_info(action_item_obj[this.conf_vers[this.version].actions['TC']],temp_ass).Name + ', ' + this.get_player_info(action_item_obj[this.conf_vers[this.version].actions['TC']],temp_ass).FirstName);
		};
		

		temp_ass_string = ''
		if (temp_ass != '')
		{
			temp_ass_string = ', Assist Nr. '+temp_ass+' '+this.get_player_info(action_item_obj[this.conf_vers[this.version].actions['TC']],temp_ass).Name + ', ' + this.get_player_info(action_item_obj[this.conf_vers[this.version].actions['TC']],temp_ass).FirstName;
		};

		temp_action_str = temp_action_str.replace('[ASS_STRING]', temp_ass_string);

		return temp_action_str;
		
	},
	
	////////////////////
	// get_player_info()
	// - needs (TC -> "A/B"),(Number of Player)
	// - retuns object with specifik data for a singel player
	////////////////////
	get_player_info: function (TC,NO) {
		
		temp_obj = '';
		
		this.data_gameini.roster.each(function(item, index){
											   
			if ((item['Nr'] == NO) && (item['TC'] == TC)) {
				temp_obj = item;
			};
											   
		}.bind(this));
		
		return temp_obj;
		
	},
	
	////////////////////
	// data_2_status_game_string()
	// - needs GameStatus as String
	// - returns a readeble String of what state the game is
	////////////////////
	data_2_status_game_string: function(DataString) {
		
		temp_string = ''
		
		switch (DataString) {
			case 'E':
				temp_string = 'finished';
			break;
			
			case 'F':
				temp_string = 'finished';
			break;

			case 'Q1':
				temp_string = '1. Viertel';
			break;
			
			case 'Q2':
				temp_string = '2. Viertel';
			break;
			
			case 'Q3':
				temp_string = '3. Viertel';
			break;
			
			case 'Q4':
				temp_string = '4. Viertel';
			break;
			
			case 'X1':
				temp_string = '1. Verläng.';
			break;
			
			case 'X2':
				temp_string = '2. Verläng.';
			break;
			
			case 'X3':
				temp_string = '3. Verläng.';
			break;
			
			case 'X4':
				temp_string = '4. Verläng.';
			break;
			
			case 'X5':
				temp_string = '5. Verläng.';
			break;
			
			case 'X6':
				temp_string = '6. Verläng.';
			break;

			case 'X7':
				temp_string = '7. Verläng.';
			break;

			case 'X8':
				temp_string = '8. Verläng.';
			break;

			case 'X9':
				temp_string = '9. Verläng.';
			break;

			default:
				temp_string = '';
			break;
			
		};
		
		return temp_string;
		
	},
	
	////////////////////
	// scroll_wide_standing_box()
	////////////////////
	scroll_wide_standing_box: function () {
		
		$$('div.wide-standing-box').each
		(	
			function (wide_standing_item,wide_standing_index)
			{
				
				var tempContainer = wide_standing_item.getFirst('div.slider');
				
				var tempSlideFX = 	new Fx.Slide
									(
										tempContainer,
										{
											/*										
											onComplete: function(){
												
												this.temp_wide_standing_box.getFirst('div.slider').dispose().inject(this.temp_wide_standing_box);
												this.temp_wide_standing_box.getLast('div.slider').setStyle('margin', 0);
																						
											}.bind(this)
											*/
										}
									).slideOut('vertical').chain(function(){
										
											tempContainer.dispose().inject(wide_standing_item);
											tempContainer.setStyle('margin', 0);
										
									}.bind(this));

			}.bind(this)
		);
		
	},
	
	////////////////////
	// change_gender()
	// changes background image for template
	////////////////////
	change_gender: function (gender) {
		
		if (gender == 'Men') {
			
			this.main_div.setStyle('background-image', 'url(img/bg.png)');
			
		} else if (gender == 'Women') {
			
			this.main_div.setStyle('background-image', 'url(img/bg.png)');
			
		};
		
	},
	
	////////////////////
	// get_per_array
	////////////////////
	get_per_array: function() {
	}
	
});

