var selected_row = 0;

function page_loaded(id) {
    window.onresize = resize_list;
    window.onload = '';
    resize_list ();
    form_item ('all_contect').className = '';
    news_item (id);
}

function resize_list ()
{
    var height = document.documentElement.clientHeight;
    var width = document.documentElement.clientWidth;
    var list = form_item ('news_list');
    if (!list) return;
    height -= list.offsetTop;
    height -= 70; 
    list.style.height = height +"px";
    
    width = Math.min (Math.floor(width / 3), 450);
    width = Math.max (width, 200);
    list.style.width = width + 'px';
    
    var details = form_item ('details');
    width = document.documentElement.clientWidth - width - 270;
    width = Math.min (width, 550);
    details.style.width = width + 'px';
}


function news_item (id)
{
	if (selected_row != 0)
		remove_class (form_item ('row_' + selected_row), 'newsItemsListSelected');
	var url = '../news/news_details.php?id=' + id;
	load_from_server_into_element(url, 'details', null, false);
	selected_row = id;
	add_class (form_item ('row_' + selected_row), 'newsItemsListSelected');
	set_form_item_inner_html ('star_' + id, '');

	addthis.toolbox('#addthis_toolbox', addthis_config, {url: 'http://www.arnd.nl/news/news.php?id=' + id}); 
	addthis.button('#share_image', addthis_config, {url: 'http://www.arnd.nl/news/news.php?id=' + id});
	twttr.widgets.load ();
	gapi.plusone.go ();
	FB.XFBML.parse();
	IN.parse(form_item ('linkedin_button'));
}

function news_item_admin (id)
{
	var url = '../news/news_details.php?id=' + id;
	load_from_server_into_element(url, 'details', null, false);
	selected_row = id;
}
