function submittopopup(url) { nw=window.open(url,'nw','width=300,height=400,toolbar=no,location=no,top=0,left=0'); document.frm.target='nw'; }
function Show(i){ f=new Image();f.src=(i);Con(i); }
function Con(i){ if((f.width!=0)&&(f.height!=0)){v(i);}else{fu="Con('"+i+"')"; int=setTimeout(fu,20);} }
function v(i){ l=f.width;a=f.height;s="width="+l+",height="+a;f=window.open('/show.php?url='+i,"",s); }


function kx_AddBookmark(title, url) {
	if(window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else if(document.all) // ie
		window.external.AddFavorite(url, title);
}

$(function() {
	$('.colorbox').colorbox();
});

$(function() {
	var latest_topics_cache = {};
	$('.LatestTopicsButtons A').click(function() {
		var type = $(this).attr('rel');
		var params = { 'type' : type }
		var $container = $('.LatestTopicsContainer');
		
		$('.LatestTopicsButtons A').removeClass('Sel');
		$(this).addClass('Sel');

		if(latest_topics_cache[type]) { $container.html(latest_topics_cache[type]); return(true); }

		$container.html('<div class="BoxNotice">Loading data...</div>');
		$.get('/ajax/recent_topics.php', params, function(data) {
			$container.html(data);
			latest_topics_cache[type] = data;
		});
	});
});
