$(document).ready(function() {
	$.ajax({
		type: 'GET',
		url: './includes/weather.php',
		dataType: 'xml',
		success: function(xml) {
			var weather = $(xml).find('item:first title').text().split(':');
			var conditions = $.trim(weather[1]);
			var temperature = $.trim(weather[2].replace('C', ''));
			var icon = ($(xml).find('item:first description').text().split('"'))[1];

			icon = icon.replace('http://vortex.accuweather.com/phoenix2/images/common/icons/', 'images/weather/');
			icon = icon.replace('_31x31.gif', '-trans.png');
			
			var html = '<img src="' + icon + '" alt="' + conditions + '" />';
			html += '<span class="temperature">' + temperature + '&deg;</span>';

			$('#weather').html(html).click(function() {
				window.open('http://www.accuweather.com/world-index-forecast.asp?loccode=OCN|AU|NSW|BOWRAL');
			}).css('cursor', 'pointer');
		}
	});
});