// JavaScript Document

function winOpen(url) {
	window.open(url, 'subWindow', 'width=650,scrollbars=yes,resizable=yes,menubar=yes');
}

$(document).ready( function() {
	$.getJSON("uplog.php", function(json){
		var table = $("<table>");
		for( var i=0; i<json.topics.length; i++ ) {
			var tr = $("<tr>").addClass( json.topics[i].category );
			var th = $("<th>").html( json.topics[i].date );
			var td;
			if( json.topics[i].link.length > 0 ) {
				var a = $("<a>").attr("href", json.topics[i].link).attr("target", "_blank").html( json.topics[i].cont );
				if( json.topics[i].link.match( "(.png)|(.jpg)|(.gif)$" ) ) {
					a.lightBox();
				}
				td = $("<td>").append( a );
			} else {
				td = $("<td>").html( json.topics[i].cont );
			}
			table.append( tr.append( th ).append( td ) );
		}
		$("#newsInner").append( table );
	});
} );

