var Page = {};

if (typeof $ == "undefined") {
	function $(id)
	{
		return document.getElementById(id);
	};
}

Page.RecentJobs = {
	_url: "http://www.collectivechina.com/recent_jobs_api.asp",

	_show: function() {
		if (typeof recent_jobs == "undefined") {
			return;
		}
		
		if (typeof $("recent_jobs") == "undefined") {
			return;
		}
		
		var nJobs = recent_jobs.length;
		var contents = '<ul>';
		for (var i = 0; i < nJobs; i++) {
			contents += '<li><a href="/en/career.asp#j' + recent_jobs[i].id + '" target="_blank">' + recent_jobs[i].title + '</a></li>';
		}
		contents += '</ul>';

		$("recent_jobs").innerHTML = contents;
	},

	show: function() {
		var loader = new IO.Script({script_charset:'UTF-8'});
		loader.load(this._url, this._show.Bind(this));
	}
};