/**
 * @param id string ID of the list
 * @param type string type of the list
 */
function createList(id, type, url_api) {
	jQuery.post(
		url_api,
		{'type':type},
		function(data, textStatus){
			if (textStatus == 'success') {
				try {
					var obj = eval('(' + data + ')');
				} catch (e) {
					$(id+' .content').html("<div>Informatie is tijdelijk niet beschikbaar.</div>");
					return;
				}
				var html = '';
				for (i = 0;(obj[i] != null);i++) {
					switch (type) {
					case 'job':
					case 'intern':
					case 'room':
							html += '<div class="'+(i%2==1?'odd':'even')+'"><div class="separator"></div><div class="iteration">'+(i+1)+'</div><div class="title"><b><a href="'+obj[i]['url']+'">'+obj[i]['title']+'</a></b></div><div class="description">'+obj[i]['description']+'</div><div class="type">'+obj[i]['context']+'</div><div class="separator"></div></div>';
						break;
					case 'clubjudge':
					case 'clubjudge_nieuws':
					case 'clubjudge_reviews':
						html += '<div class="'+(i%2==1?'odd':'even')+'"><div class="separator"></div><div class="iteration">'+(i+1)+'</div><div class="title"><b><a href="'+obj[i]['url']+'">'+obj[i]['title']+'</a></b></div><div class="description">'+obj[i]['description']+'</div><div class="type">'+obj[i]['type']+'</div><div class="separator"></div></div>';
						break;
					case 'blog':
					case 'photo':
					case 'user':
						html += '<div class="'+(i%2==1?'odd':'even')+'"><div class="separator"></div><div class="img"><img src="'+obj[i]['image_url']+'" alt="" /></div><div class="title"><b><a href="'+obj[i]['url']+'">'+obj[i]['title']+'</a></b></div><div class="description">'+obj[i]['description']+'</div><div class="separator"></div></div>';
						break;
					case 'rss':
						html += '<div class="'+(i%2==1?'odd':'even')+'"><div class="separator"></div><div class="iteration">'+(i+1)+'</div><div class="title"><b><a href="'+obj[i]['url']+'">'+obj[i]['title']+'</a></b></div><div class="description">'+obj[i]['description']+'</div><div class="separator"></div></div>';
						break;
					}
				}
				$(id+' .content').html(html);
				$(id+' .content a').click(function(){
						switch (type) {
						case 'clubjudge_nieuws':
						case 'clubjudge_reviews':
							window.location(this.href);
							break;
						default:
							window.open(this.href);
							return false;
						}
					});
			} else {
				$(id+' .content').html("<div>Informatie is tijdelijk niet beschikbaar.</div>");
			}
		});
	
	$(id+' .left').removeClass('selected');
	$(id+' .center').removeClass('selected');
	$(id+' .right').removeClass('selected');
	
	switch (type) {
	case 'job':
	case 'photo':
	case 'rss':
	case 'clubjudge':
		$(id+' .left').addClass('selected');
		break;
	case 'intern':
	case 'blog':
	case 'clubjudge_nieuws':
		$(id+' .center').addClass('selected');
		break;
	case 'room':
	case 'user':
	case 'clubjudge_reviews':
		$(id+' .right').addClass('selected');
		break;
	}
	
	return false;
}
