var news_th = new Class({
	Implements: [Options],
	/* standart egenskap */
	options: {
		nyere_link_id						: 'nyere_news',
		eldre_link_id						: 'eldre_news',
		news_ths_cont_id					: 'news_ths_container',
		news_from 							: 0,
		total_news							: 0
	},  		
	ths_cont: {},
	/* -- constructor -- */
	initialize: function($options){
		this.setOptions($options);			
		this.ths_cont[this.options.news_from] = {'DOM' : $('ths_cont_'+this.options.news_from)};
		this.ths_cont[this.options.news_from]['news_ths'] = new Array();
		var children_list = this.ths_cont[this.options.news_from].DOM.getChildren();
		var children_list_n = children_list.length;
		for (var i = 0; i < children_list_n; i ++){
			var a_DOM = children_list[i].getElement('a.news_th_cont');
			this.ths_cont[this.options.news_from].news_ths[i] = {'a_DOM' : a_DOM, 'selected':false};
			//a_DOM.addEvent('click', this.th_mouse_click.bind(this, [i, this.options.news_from, a_DOM]));
			a_DOM.addEvent('mouseover', this.th_mouse_over.bind(this, [i, this.options.news_from, a_DOM]));
			a_DOM.addEvent('mouseout', this.th_mouse_out.bind(this, [i, this.options.news_from, a_DOM]));
			a_DOM.addEvent('focus', this.th_mouse_over.bind(this, [i, this.options.news_from, a_DOM]));
			a_DOM.addEvent('blur', this.th_mouse_out.bind(this, [i, this.options.news_from, a_DOM]));
			if (a_DOM.hasClass('news_th_selected') == true){
				a_DOM.setStyle('background-color', '#e0e0e0');
				this.ths_cont[this.options.news_from].news_ths[i].selected = true;
			}
			else a_DOM.setStyle('background-color', '#ffffff');
		}		
		/*var nyere_news_DOM = $(this.options.nyere_link_id);
		nyere_news_DOM.addEvent('click', this.nyere_news_click.bind(this, [nyere_news_DOM]));
		var eldre_news_DOM = $(this.options.eldre_link_id);
		eldre_news_DOM.addEvent('click', this.eldre_news_click.bind(this, [eldre_news_DOM]));*/
		//SWFAddress.addEventListener(SWFAddressEvent.EXTERNAL_CHANGE, this.deep_link_handler.bind(this));			
		//SWFAddress.addEventListener(SWFAddressEvent.INTERNAL_CHANGE, deep_link_handler);
		//deep_link_handler(null);																
	},
	th_mouse_over: function(ind, $from, $a_DOM){
		if (this.ths_cont[$from].news_ths[ind].selected == true) return false;
		$a_DOM.set('tween', {'duration':'short'});
		$a_DOM.tween('background-color', '#DEDEDE');		
		return false;
	}, 
	th_mouse_out: function(ind, $from, $a_DOM){		
		if (this.ths_cont[$from].news_ths[ind].selected == true) return false;
		$a_DOM.set('tween', {'duration':'normal'});
		$a_DOM.tween('background-color', '#ffffff');	
		return false;
	},
	th_mouse_click: function(ind, $from, $a_DOM){		
		return true;
		if (this.ths_cont[$from].news_ths[ind].selected == true) return false;
		var loader = $('loader_icon').clone();
		loader.inject($('main_page_td'), 'top');
		loader.setStyles({'height' : '0px', 'display':'block'});
		loader.tween('height', '13px');		
		parseUtri
		main_page_td.load($a_DOM.getProperty('href'));
		//alert('click');
		return false;
	},
	nyere_news_click: function($button_DOM){
		//alert('clickn');
		return true;
	},
	eldre_news_click: function($button_DOM){
		//alert('clicke');
		return true;
	}/*,
	deep_link_handler: function (e){				
		var uriObj = parseUri(window.location);		
		if (uriObj.anchor != ''){
			//var test_uri = parseUri(uriObj.anchor);
			//SWFAddress.getValue('tab='+this.tab_id+'&group='+this.group_id);											
			var anchor = uriObj.anchor.substr(1);
			if (uriObj.anchor.indexOf('from') != -1 && uriObj.anchor.indexOf('page_id') != -1){
				anchor = anchor.split('&');
				var from = anchor[0].split('=')[1];
				var page_id = anchor[1].split('=')[1];				
				load_page(from, page_id);						
				(function(){							
					$(flash_id).goto_year(this.event_ind);
				}).delay(1000, {'new_event_title':event_ind});					
				SWFAddress.setTitle(current_page_name + ' - ' + event_name);		
			} 			      
		}	
	},			
	load_page: function ($id, $name, $ind){				
		if (EDIT_CORE.redig_user == 'true'){					
			document.location = EDIT_CORE.JSSiteRoot + 'site/<?=$this->db->page->script;?>?page_id='+$id;
		} else {
			var tl_page_DOM = $('timeline_page_html');
			var container_height = tl_page_DOM.getSize();
			//$('timeline_page_html').setStyles({'height':container_height.y+'px'});
			tl_page_DOM.empty();
			var loding_gif = $('dummy_loader').clone();
			loding_gif.inject(tl_page_DOM);
			var myRequest_2 = new Request.HTML({method: 'get', url: EDIT_CORE.JSSiteRoot + 'site/timeline/load_page.php?page_id=' + $id, onSuccess :function(responseTree, responseElements, responseHTML, responseJavaScript){									 																								
				var $r_id = $id;
				var $r_tl_page_DOM = tl_page_DOM;
				$(responseElements[0]).inject($r_tl_page_DOM);
				var respons_size = $(responseElements[0]).getSize();
				//alert(parseInt($('timeline_page_html').getStyle('min-height')) + ' ' + respons_size.y);
				if (respons_size.y > parseInt($r_tl_page_DOM.getStyle('min-height')) || parseInt($r_tl_page_DOM.getStyle('height')) > respons_size.y) $r_tl_page_DOM.tween('height', respons_size.y);						
				if (EDIT_CORE.redig_user == 'false'){
					SWFAddress.setValue('event='+$r_id+'&name='+$name+'&index='+$ind);
					SWFAddress.setTitle(current_page_name + ' - ' +$name);		
				}
			}});						
			myRequest_2.send();					
			window_FX_scroll.start(0, 20);
		}
	}	*/
	
});
