© livedoor 天気情報
$(function() {
	escapeTag = function(string) {
		if (string == null) return string;
		return string.replace(/[&<>"']/g,
		function(match) {
			return {
				'&' : '&',
				'<' : '<',
				'>' : '>',
				'"' : '"',
				"'" : '#&39;'
			}[match];
		});
	};
	var city = '130010'; // Tokyo
	var wetherURL = 'http://weather.livedoor.com/forecast/webservice/json/v1?city='+city;
	$.getJSON('http://pipes.yahoo.com/pipes/pipe.run?u='+encodeURI(wetherURL)+'&_id=332d9216d8910ba39e6c2577fd321a6a&_render=json&_callback=?',
	{},
	function(json) {
		var item = json.value.items[0];
		$(''
			+ 'どこ:'
			+ escapeTag(item.location.city)
			+ '
いつ:'
			+ escapeTag(item.forecasts[0].dateLabel)
			+ '
どう:'
			+ '
"
			+ escapeTag(item.forecasts[0].telop)
			+ '
気温:'
			+ escapeTag(item.forecasts[1].temperature.max.celsius)
			+ '
'
		).appendTo('#weather');
	});
});