
// remap jQuery to $
(function($){

	// Get and display the weather
	setTimeout(function(){
		$.jsonp({
			type: 'get',
			url: 'http://ws.geonames.org/findNearByWeatherJSON?lat=38.5053&lng=-122.469',
			dataType: 'jsonp',
			callbackParameter: "callback",
			error: function(xhr, status, error) {
				$('#weather').hide();
			},
			success: function(data) {
				$('#weatherText').html( 'Currently ' + Math.round( (1.8 * parseFloat(data.weatherObservation.temperature)) + 32) + '&deg; and ' + (data.weatherObservation.clouds == 'n/a' ? 'clear' : data.weatherObservation.clouds));
			}
		});
	}, 1000);


})(this.jQuery);



// usage: log('inside coolFunc',this,arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
  log.history = log.history || [];   // store logs to an array for reference
  log.history.push(arguments);
  if(this.console){
    console.log( Array.prototype.slice.call(arguments) );
  }
};


// catch all document.write() calls
(function(doc){
  var write = doc.write;
  doc.write = function(q){ 
    log('document.write(): ',arguments); 
    if (/docwriteregexwhitelist/.test(q)) write.apply(doc,arguments);  
  };
})(document);



