function wipe_featured_param()
	{
		if(strstr(sections[17]['extra_params'], 'featured_id'))
		{
		var param_array = explode('&', sections[17]['extra_params']);
		var param_length = param_array[param_array.length -1].length + 1;
		sections[17]['extra_params'] = sections[17]['extra_params'].substr(0, (sections[17]['extra_params'].length - param_length));
		} 
	}

function show_article(id, force_load, title)
	{

		if(section_ids['news'] !== info['current'])
		{
		//fade_content(section_ids['news'], 'side-main', 0);
		
		sections[section_ids['news']]['extra_params'] = sections[section_ids['news']]['extra_params']+'&featured_id='+id;
		go_to(section_ids['news']);
		} else {


			if( (info['main'] !== 'loading') || (force_load == 'true') )
			{
			wipe_featured_param();
			update_url(title);
			
			update_status('main', 'loading');
			toggle_loading(1);
	//		fade_out_thumb(id);
			setTimeout(function() {fade_out_thumb(id)}, 500);		
			
			
			document.getElementById('main').style.height = 'auto';
			
			
			slide_thumbs('0px', '9px');
			
		
			var params = 'id='+id+'&article_id='+id;
		
			var req = new Request.HTML({
				method: 'get',
				url: 'system/components/content/page-content.php',
				update: $('main'), 
				onComplete: function(){
				update_status('main', 'idle');
				toggle_loading(0);
				}
			}).send(params);
	
		
			return false;
			}
			
		}
		
	}
	
	
	
	
	
current_widget_page = 0;

function go_to_widget_page(p, total, width)
	{
	
		if( (info['animating'] == false) )
		{
		update_status('animating', true);

			if(p == 'prev')
			{
			(current_widget_page > 0) ? p=current_widget_page-1 : p=0;
			} else if(p == 'next') {
			(current_widget_page >= (total - 1)) ? p=current_widget_page : p=current_widget_page+1;
			}
		

		
		var n = 0;
		var offset = 0;
		var left = 0;
	
		load_widget_thumbs(p);
		
			while(n < total)
			{
			var div = document.getElementById('widget-thumbs'+n);
			
			
				if(n < p)
				{
				offset = p - n;
				left = -(offset * width);
				} else {
				offset = n - p;
				left = offset * width;
				} 
	
	
			var fxStart = new Fx.Tween(div.id, {duration:500});
			fxStart.start('left', div.style.left, left+'px').chain(function() {
		
				update_status('animating', false);
		
				});

	
	//		div.style.left = left+'px';
			n++;
			}
		
		
		current_widget_page = p;	
		return false;
		} 
		
	}
	
	
	
	
	
	
function load_widget_thumbs(page)
	{

		
		for ( keyVar in widget_thumbs ) 
		{
			
			if(widget_thumbs[keyVar]['id'])
			{
			var id = widget_thumbs[keyVar]['id'];
			var thumb = widget_thumbs[keyVar]['thumb'];
			var title = widget_thumbs[keyVar]['title'];
			
			
				if( document.getElementById('widget-thumb-'+page+'-'+id) )
				{
					if(!document.getElementById('widget-thumb-'+page+'-'+id).innerHTML.length)
					{
					document.getElementById('widget-thumb-'+page+'-'+id).innerHTML = '<img id="image-'+page+'-'+id+'" onload="show_thumb(\'image-'+page+'-'+id+'\')" style="visibility: hidden;" src="'+thumb+'" alt="'+title+'" width="156" height="88" />';
					}
				}
			
			}
			
		}
	
	}
	
	
	
	